Class: Cupper::Cupperfile
- Inherits:
-
Object
- Object
- Cupper::Cupperfile
- Defined in:
- lib/cupper/cupperfile.rb
Instance Method Summary collapse
- #cupper_config(name, env) ⇒ Object
-
#initialize(key) ⇒ Cupperfile
constructor
A new instance of Cupperfile.
- #machine_being_read(name, env) ⇒ Object
- #new_machine(name, config, env) ⇒ Object
Constructor Details
#initialize(key) ⇒ Cupperfile
Returns a new instance of Cupperfile.
4 5 6 7 |
# File 'lib/cupper/cupperfile.rb', line 4 def initialize(key) @key = key @config, _ = Cupper::Config.load(key) end |
Instance Method Details
#cupper_config(name, env) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cupper/cupperfile.rb', line 32 def cupper_config(name, env) cupperfile = env.find_cupperfile(env.root_path) if cupperfile config = Cupper::Config.load(cupperfile) end return { config: config, # TODO: add other meaningfull returns } end |
#machine_being_read(name, env) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/cupper/cupperfile.rb', line 9 def machine_being_read(name, env) # Load the configuration for the machine results = cupper_config(name, env) config = results[:config] # Create the machine and cache it for future calls. This will also # return the machine from this method. return new_machine(name, config, env) end |
#new_machine(name, config, env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cupper/cupperfile.rb', line 19 def new_machine(name, config, env) machine = Attribute.new class << machine attr_accessor :name attr_accessor :config attr_accessor :env end machine.name = name machine.config = config machine.env = env machine end |