Class: Blazing::Config
- Inherits:
-
Object
- Object
- Blazing::Config
- Extended by:
- DSLSetter
- Includes:
- Logger
- Defined in:
- lib/blazing/config.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#recipes ⇒ Object
Returns the value of attribute recipes.
-
#targets ⇒ Object
Returns the value of attribute targets.
Class Method Summary collapse
Instance Method Summary collapse
- #default_target ⇒ Object
-
#find_target(target_name) ⇒ Object
TODO: Spec it!.
-
#initialize(configuration_file = nil) ⇒ Config
constructor
A new instance of Config.
- #rake(task_name, env = nil) ⇒ Object
- #recipe(name, options = {}) ⇒ Object
- #repository(*args) ⇒ Object
- #target(name, location, options = {}) ⇒ Object
Methods included from DSLSetter
Constructor Details
#initialize(configuration_file = nil) ⇒ Config
Returns a new instance of Config.
25 26 27 28 29 |
# File 'lib/blazing/config.rb', line 25 def initialize(configuration_file = nil) @file = configuration_file || Blazing::DEFAULT_CONFIG_LOCATION @targets = [] @recipes = [] end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
10 11 12 |
# File 'lib/blazing/config.rb', line 10 def file @file end |
#recipes ⇒ Object
Returns the value of attribute recipes.
11 12 13 |
# File 'lib/blazing/config.rb', line 11 def recipes @recipes end |
#targets ⇒ Object
Returns the value of attribute targets.
11 12 13 |
# File 'lib/blazing/config.rb', line 11 def targets @targets end |
Class Method Details
.parse(configuration_file = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/blazing/config.rb', line 16 def parse(configuration_file = nil) Blazing::Recipe.load_recipes! config = self.new(configuration_file) config.instance_eval(File.read(config.file)) config end |
Instance Method Details
#default_target ⇒ Object
49 50 51 52 53 |
# File 'lib/blazing/config.rb', line 49 def default_target if @targets.size == 1 @targets.first end end |
#find_target(target_name) ⇒ Object
TODO: Spec it!
56 57 58 |
# File 'lib/blazing/config.rb', line 56 def find_target(target_name) targets.find { |t| t.name.to_s == target_name.to_s } end |
#rake(task_name, env = nil) ⇒ Object
40 41 42 43 |
# File 'lib/blazing/config.rb', line 40 def rake(task_name, env = nil) @rake = { :task => task_name } @rake[:env] = env if env end |
#recipe(name, options = {}) ⇒ Object
36 37 38 |
# File 'lib/blazing/config.rb', line 36 def recipe(name, = {}) @recipes << Blazing::Recipe.init_by_name(name, ) end |
#repository(*args) ⇒ Object
45 46 47 |
# File 'lib/blazing/config.rb', line 45 def repository(*args) warn 'Ther repository DSL method has been deprecated and is no longer used. This method will be removed in Version 0.3' end |