Sha256: 33299ddc265a658eff1ef7f150e64e8fe43813387eb626c1e9802b07de075db6

Contents?: true

Size: 656 Bytes

Versions: 6

Compression:

Stored size: 656 Bytes

Contents

require 'yaml'

module YAMLConfig  
  def initialize
    super()
  end
  
  def load_config_by_task_name(task_name)
    task_config = "#{task_name}.yml"
    task_config = File.join(Albacore::yaml_config_folder, task_config) unless Albacore::yaml_config_folder.nil?
    configure(task_config) if File.exists?(task_config)
  end
  
  def configure(yml_file)
    config = YAML::load(File.open(yml_file))
    parse_config config
  end  
  
  def parse_config(config)
    config.each do |key, value|
      setter = "#{key}="
      self.class.send(:attr_accessor, key) if !respond_to?(setter)
      send setter, value
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
albacore-0.1.5 lib/albacore/support/yamlconfig.rb
albacore-0.1.4 lib/albacore/support/yamlconfig.rb
albacore-0.1.3 lib/albacore/support/yamlconfig.rb
albacore-0.1.2 lib/albacore/support/yamlconfig.rb
albacore-0.1.1 lib/albacore/support/yamlconfig.rb
albacore-0.1.0 lib/albacore/support/yamlconfig.rb