Module: Cody::Variables

Included in:
Project, Role, Schedule
Defined in:
lib/cody/variables.rb

Instance Method Summary collapse

Instance Method Details

#load_variablesObject



3
4
5
6
7
8
9
# File 'lib/cody/variables.rb', line 3

def load_variables
  load_variables_file("base")
  load_variables_file(Cody.env)
  # Then load type scope variables, so they take higher precedence
  load_variables_file("base", @options[:type])
  load_variables_file(Cody.env, @options[:type])
end

#load_variables_file(filename, type = nil) ⇒ Object



11
12
13
14
15
# File 'lib/cody/variables.rb', line 11

def load_variables_file(filename, type=nil)
  items = ["#{Cody.root}/.cody", type, "variables/#{filename}.rb"].compact
  path = items.join('/')
  instance_eval(IO.read(path), path) if File.exist?(path)
end