Sha256: d1aa5d3ba221a23376d1cfc136b3b7bbf3261afaad26487f5d77934ef5f21019

Contents?: true

Size: 934 Bytes

Versions: 6

Compression:

Stored size: 934 Bytes

Contents

module Beaker
  module Shared
    # Methods used in execution of Subcommands
    # - should we write the config?
    # - reset ARGV 
    # - execute Beaker
    module SubcommandsUtil
      CONFIG_PATH = ".beaker/config"
    
      @@write_config = false

      def self.write_config=( val )
        @@write_config = val
      end
      
      def self.write_config?
        @@write_config
      end
      
      # Reset ARGV to contain the arguments determined by a specific subcommand
      # @param [Array<String>] args the arguments determined by a specific subcommand
      def reset_argv(args)
        ARGV.clear
        args.each do |arg|
          ARGV << arg
        end
      end

      # Update ARGV and call Beaker
      # @param [Array<String>] args the arguments determined by a specific subcommand
      def execute_beaker(*args)
        reset_argv(args)
        Beaker::CLI.new.execute! 
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
beaker-3.7.0 lib/beaker/shared/subcommands_util.rb
beaker-3.6.0 lib/beaker/shared/subcommands_util.rb
beaker-3.5.0 lib/beaker/shared/subcommands_util.rb
beaker-3.4.0 lib/beaker/shared/subcommands_util.rb
beaker-3.3.0 lib/beaker/shared/subcommands_util.rb
beaker-3.2.0 lib/beaker/shared/subcommands_util.rb