v0.1.0: YAML Configuration Changes And Global Settings

2010-01-25 00:00:00 -0800

The YAML configuration process has a few changes to it for the v0.1.0 release, which should make it more flexible and allow better organization of the YAML data files. We also added a few global configuration options to Albacore – these are options you can set once to affect all tasks.

YAML Configuration Changes

I received some great feedback about the YAML configuration after the last release, in the form of people telling us how it didn’t support what they wanted to do with it.

Specify Folder To Load YAML From

Several people wanted to use the convention based configuration so that they did not have to specify the file names, but found that they could not store the YAML data files in any folder other than the one where the rakefile lived. The workaround was to manually specify the YAML file to use, which allowed you to specify the folder as well: msb.configure "folder/msbuild.yml"

To correct this, we introduced our first global setting Albacore::yaml_config_folder. This setting allows you to specify the folder that all of the convention based YAML files will be loaded from, for your tasks.

Now, when you call an Albacore task and you have set this option, the YAML files will load form the folder you specified.

require 'albacore'
Albacore::yaml_config_folder = "/some/arbitrary/folder/"

msbuild :build do |msb|
 #YAML is loaded from "/some/arbitrary/folder/build.yml"

Load YAML File By Task Name

Several people also ran into an issue where they had multiple instances of the same task in their buildfile, and the tasks were loading up the same YAML data file. This was causing problems because the two calls to the same task were meant to have differe configurations. For example:

msbuild :build do |msb| 
  # want to configure for building the code, here

msbuild :deploy do |msb|
  # want to configure for deploying web project, here

In this sitution, you would have to manually specify the YAML file to load, to get the right configuration. To fix this, as well as to standardize the naming of the YAML files (some tasks had slightly odd names for various reasons), we the convention that the YAML configuration uses for the default file to load.

All Albacore tasks will now be configured with a YAML file that is named after the task.

So in the situation stated previously, the :build task would be configured with a build.yml file, and the :deploy task would be configured with a deploy.yml file. This lets you have as many instances of the same task as you need, without having to manually specify the YAML file.

Global Option: Logging Verbosity

The other global option that we added to Albacore was Albacore::log_level. This setting allows you to turn on :verbose logging at the root of your rakefile, and have all tasks log in verbose mode.

require 'albacore'
Albacore::log_level = :verbose

msbuild :build do |msb|
  # is now logging in verbose mode, with the global setting

This makes it easier to change your logging level for every task, to get additional information from your build process.

blog comments powered by Disqus