Class: Belt::CLI::ConsoleCommand
- Inherits:
-
Object
- Object
- Belt::CLI::ConsoleCommand
- Defined in:
- lib/belt/cli/console_command.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ ConsoleCommand
constructor
A new instance of ConsoleCommand.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ ConsoleCommand
Returns a new instance of ConsoleCommand.
12 13 14 15 16 |
# File 'lib/belt/cli/console_command.rb', line 12 def initialize(args) @args = args @options = {} end |
Class Method Details
.run(args) ⇒ Object
8 9 10 |
# File 'lib/belt/cli/console_command.rb', line 8 def self.run(args) new(args).run end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/belt/cli/console_command.rb', line 18 def run ENV['BUNDLE_GEMFILE'] ||= File.join(Belt.root, 'Gemfile') unless File.exist?(ENV['BUNDLE_GEMFILE']) abort "Error: No Gemfile found at #{ENV['BUNDLE_GEMFILE']}. Are you in a Belt project?" end @environment = @args.first || ENV['BELT_ENV'] || 'dev' ENV['ENVIRONMENT'] = @environment if @options[:run] exec_runner(@options[:run]) else exec_console end end |