bin/irt in irt-1.2.11 vs bin/irt in irt-1.2.12
- old
+ new
@@ -34,11 +34,11 @@
options[:irb_options] = opt
end
options[:rails_env] = ENV['RAILS_ENV'] || 'development'
opts.on( '-e', '--rails-env [ENVIRONMENT]', 'Sets the Rails Environment' ) do |env|
- options[:rails_env] = env
+ ENV['RAILS_ENV'] = options[:rails_env] = env
end
options[:no_rails] = false
opts.on( '-n', '--no-rails', 'Does not autoload the Rails Environment' ) do
options[:no_rails] = true
@@ -83,16 +83,16 @@
IRT::Prompter.say_notice 'No *.irt files to run'
exit
end
cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
- ENV['RAILS_ENV'] = options[:rails_env] if options[:rails_env]
if File.exists?('./script/rails')
- gemfile = File.read('Gemfile')
+ gemfile_path = ENV['BUNDLE_GEMFILE'] || 'Gemfile'
+ gemfile = File.read(gemfile_path)
unless gemfile.match(/\bgem\b.+\birt\b/)
IRT::Prompter.say_warning %(The Gemfile doesn't look to include any 'gem "irt"' statement.\nIRT will probably not work until you add it!)
IRT::Prompter.yes?("Do you want to add irt to your Gemfile?", :hint => '[enter=y|n]', :default => 'y') do
- File.open('Gemfile', 'a') do |f|
+ File.open(gemfile_path, 'a') do |f|
f.puts %(\ngem "irt")
end
end
end
minor, patch = gemfile.match(/\bgem\b.+\brails\b.+3\.(\d+)\.(\d+)/).captures