Skip to content

Commit

Permalink
[#639 state:resolved] error check ruby & rails existence and version
Browse files Browse the repository at this point in the history
in hobo script
  • Loading branch information
bryanlarsen committed Feb 28, 2010
1 parent 68c6a29 commit 670f6ff
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions hobo/bin/hobo
Expand Up @@ -7,6 +7,11 @@ require 'rbconfig'

RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"')

if RUBY.empty?
puts "ruby not found"
exit 2
end

Signal.trap("INT") { puts; exit }

hobo_src = File.join(File.dirname(__FILE__), "../hobo_files/plugin")
Expand Down Expand Up @@ -87,11 +92,17 @@ if run_rails
opts = []
if rails_version
opts << "_#{rails_version}_"
# else
# if `rails -v`.split[1].split(".").slice(0,2)!=['2', '3']
# puts "Rails 2.3 required!"
# exit 2
# end
else
v=`#{RUBY} -S rails -v`.split[1].split(".")
unless v.length===3
puts "rails not found!"
exit 2
end
unless v[0]=='2' && ['2', '3'].include?(v[1])
puts "Rails 2.2 or 2.3 required!"
puts "Rails 3 requires Hobo 1.1 or later."
exit 2
end
end
opts << "-d #{database_type}" if database_type
system("#{RUBY} -S rails #{opts * ' '} #{app_path}")
Expand Down

0 comments on commit 670f6ff

Please sign in to comment.