Class: Blazing::Config

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/blazing/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration_file = nil) ⇒ Config

Returns a new instance of Config.



11
12
13
14
15
16
# File 'lib/blazing/config.rb', line 11

def initialize(configuration_file = nil)
  @file = configuration_file || Blazing::DEFAULT_CONFIG_LOCATION
  @targets = []
  @rake_task = nil
  @env_script = nil
end

Instance Attribute Details

#env_scriptObject

Returns the value of attribute env_script.



9
10
11
# File 'lib/blazing/config.rb', line 9

def env_script
  @env_script
end

#fileObject (readonly)

Returns the value of attribute file.



8
9
10
# File 'lib/blazing/config.rb', line 8

def file
  @file
end

#rake_taskObject

Returns the value of attribute rake_task.



9
10
11
# File 'lib/blazing/config.rb', line 9

def rake_task
  @rake_task
end

#targetsObject

Returns the value of attribute targets.



9
10
11
# File 'lib/blazing/config.rb', line 9

def targets
  @targets
end

Class Method Details

.parse(configuration_file = nil) ⇒ Object



19
20
21
22
23
# File 'lib/blazing/config.rb', line 19

def parse(configuration_file = nil)
  config = new(configuration_file)
  Blazing::DSL.new(config).instance_eval(File.read(config.file))
  config
end

Instance Method Details

#target(target_name) ⇒ Object



26
27
28
# File 'lib/blazing/config.rb', line 26

def target(target_name)
  targets.find { |t| t.name.to_s == target_name.to_s }
end