lib/napa/cli.rb in napa-0.2.1 vs lib/napa/cli.rb in napa-0.3.0
- old
+ new
@@ -28,21 +28,24 @@
say Napa::VERSION
end
desc 'console [environment]', 'Start the Napa console'
options aliases: 'c'
- def console(environment = 'development' )
- ENV['RACK_ENV'] = environment
+ def console(environment = nil)
+ ENV['RACK_ENV'] = environment || 'development'
require 'racksh/init'
begin
require "pry"
interpreter = Pry
rescue LoadError
require "irb"
require "irb/completion"
interpreter = IRB
+ # IRB uses ARGV and does not expect these arguments.
+ ARGV.delete('console')
+ ARGV.delete(environment) if environment
end
Rack::Shell.init
$0 = "#{$0} console"