Module: Beaker::Shared::SubcommandsUtil

Included in:
Beaker::Shared
Defined in:
lib/beaker/shared/subcommands_util.rb

Overview

Methods used in execution of Subcommands  - should we write the config?

  • reset ARGV

  • execute Beaker

Constant Summary collapse

CONFIG_PATH =
".beaker/config"
@@write_config =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.write_config=(val) ⇒ Object



12
13
14
# File 'lib/beaker/shared/subcommands_util.rb', line 12

def self.write_config=( val )
  @@write_config = val
end

.write_config?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/beaker/shared/subcommands_util.rb', line 16

def self.write_config?
  @@write_config
end

Instance Method Details

#execute_beaker(*args) ⇒ Object

Update ARGV and call Beaker  @param [Array<String>] args the arguments determined by a specific subcommand



31
32
33
34
# File 'lib/beaker/shared/subcommands_util.rb', line 31

def execute_beaker(*args)
  reset_argv(args)
  Beaker::CLI.new.execute! 
end

#reset_argv(args) ⇒ Object

Reset ARGV to contain the arguments determined by a specific subcommand  @param [Array<String>] args the arguments determined by a specific subcommand



22
23
24
25
26
27
# File 'lib/beaker/shared/subcommands_util.rb', line 22

def reset_argv(args)
  ARGV.clear
  args.each do |arg|
    ARGV << arg
  end
end