Class: Figobox::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/figobox/cli.rb

Instance Method Summary collapse

Instance Method Details

#setObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/figobox/cli.rb', line 12

def set
  with_environments do |figaro_environment, nanobox_alias|
    parser = Figobox::ConfigParser.new
    variables = parser.get_keys_for_environment(figaro_environment)
    compiler = Figobox::CommandCompiler.new(nanobox_alias, variables)

    if options.dry_run?
      puts <<~OUTPUT
        Command to be executed:
          #{compiler.add}
      OUTPUT
    else
      command = compiler.add
      puts "Executing command:\n  #{command}"
      system command
    end
  end
end