class Fixman::Configuration
Constants
- CONDITION_OR_CLEANUP_SCHEMA
- CONF_SCHEMA
- DEFAULT_CONF_FILE
- DEFAULT_LEDGER_FILE
- REPO_INFO_SCHEMA
- TASK_SCHEMA
Attributes
extra_repo_info[R]
fixture_ledger[R]
fixtures_base[R]
groups[R]
raw_tasks[R]
Public Class Methods
initialize_defaults(conf_hash)
click to toggle source
# File lib/fixman/configuration.rb, line 118 def initialize_defaults(conf_hash) conf_hash[:tasks].each do |task| command = task[:command] command[:exit_status] = 0 unless command[:exit_status] unless task[:target_placeholder] task[:target_placeholder] = 'TARGET' end condition = task[:condition] if !condition task[:condition] = { type: :ruby, action: 'proc { true }' } elsif condition[:type] == :shell && !condition[:exit_status] condition[:exit_status] = 0 end cleanup = task[:cleanup] if !cleanup task[:cleanup] = { type: :ruby, action: 'proc { true }' } end task[:variables] = [] unless task[:variables] end unless conf_hash[:fixture_ledger] conf_hash[:fixture_ledger] = DEFAULT_LEDGER_FILE end [:groups, :extra_repo_info].each do |key| conf_hash[key] = [] unless conf_hash[key] end conf_hash[:extra_repo_info].each do |repo_info| repo_info[:prompt] << ' ' end end
new(fixtures_base, fixture_ledger, raw_tasks, groups, extra_repo_info)
click to toggle source
# File lib/fixman/configuration.rb, line 88 def initialize(fixtures_base, fixture_ledger, raw_tasks, groups, extra_repo_info) @fixtures_base = Pathname.new(fixtures_base) @fixture_ledger = Pathname.new(fixture_ledger) @raw_tasks = raw_tasks @extra_repo_info = extra_repo_info @groups = groups end
read(path_to_conf)
click to toggle source
# File lib/fixman/configuration.rb, line 101 def read(path_to_conf) conf_yaml = YAML.load IO.read(path_to_conf) ClassyHash.validate conf_yaml, CONF_SCHEMA initialize_defaults conf_yaml raw_tasks = conf_yaml[:tasks].map do |task| RawTask.new task end Configuration.new(conf_yaml[:fixtures_base], conf_yaml[:fixture_ledger], raw_tasks, conf_yaml[:groups], conf_yaml[:extra_repo_info]) end