Skip to content

Commit

Permalink
added irt bin compatibility with rails 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Aug 5, 2011
1 parent 71e16db commit 91d5dd9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/irt
Expand Up @@ -96,8 +96,10 @@ cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
end
end
end
rails_version = gemfile.match(/\bgem\b.+\brails\b.+3\.0\.\d/) ? '=3.0.*' : '>=3.1.*'
'rails c %s %s %s'
elsif File.exists?('./script/console')
rails_version = '2.*'
'ruby script/console --irb="irt_rails2 %2$s" %1$s %3$s'
end
else
Expand All @@ -107,6 +109,11 @@ cmd_format = if File.exists?('./config/environment.rb') && !options[:no_rails]
ENV['IRT_INTERACTIVE_EOF'] = options[:interactive_eof].inspect if options[:interactive_eof]

files.each do |file|
ENV['IRT_COMMAND'] = sprintf cmd_format, options[:irb_options], file, options[:rails_env]
ENV['IRT_COMMAND'] = case rails_version
when '2.*', '=3.0.*'
sprintf cmd_format, options[:irb_options], file, options[:rails_env]
when '>=3.1.*'
sprintf cmd_format, options[:rails_env], options[:irb_options], file
end
exit(1) unless system ENV['IRT_COMMAND']
end

0 comments on commit 91d5dd9

Please sign in to comment.