bin/irt in irt-1.3.1 vs bin/irt in irt-1.3.2
- old
+ new
@@ -35,11 +35,11 @@
end
options[:rails_env] = ENV['RAILS_ENV'] || 'development'
opts.on( '-e', '--rails-env [ENVIRONMENT]', 'Sets the Rails Environment' ) do |env|
ENV['RAILS_ENV'] = options[:rails_env] = env
- end
+ end
options[:no_rails] = false
opts.on( '-n', '--no-rails', 'Does not autoload the Rails Environment' ) do
options[:no_rails] = true
end
@@ -83,21 +83,21 @@
IRT::Prompter.say_notice 'No *.irt files to run'
exit
end
cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
- if File.exists?('./script/rails')
+ if File.exists?('./script/rails') || File.exists?('./bin/rails')
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_path, 'a') do |f|
f.puts %(\ngem "irt")
end
end
end
- minor, patch = gemfile.match(/\bgem\b.+\brails\b.+3\.(\d+)\.(\d+)/).captures
+ minor, patch = gemfile.match(/\bgem\b.+\brails\b.+(3|4)\.(\d+)\.(\d+)/).captures
rails_version = (minor.to_i > 0 || patch.to_i > 9) ? :new : :old
'rails c %s %s %s'
elsif File.exists?('./script/console')
rails_version = :old
'ruby script/console --irb="irt_rails2 %2$s" %1$s %3$s'