Skip to content

Commit

Permalink
umlaut generator rails version option
Browse files Browse the repository at this point in the history
  • Loading branch information
jrochkind committed Sep 18, 2014
1 parent bef6197 commit b7d99e7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions bin/umlaut
Expand Up @@ -64,10 +64,14 @@ def parse_options!
opts.separator ""
opts.separator "Specific options:"

opts.on("--umlaut-path PATH", "Gemfile :path to local umlaut") do |umlaut_path|
opts.on("-u", "--umlaut-path PATH", "Gemfile :path to local umlaut") do |umlaut_path|
options.umlaut_path = umlaut_path
end

opts.on("-r", "--rails-version VERSION", "Rails version to use to install") do |rails_version|
options.rails_version = rails_version
end

opts.on_tail("-h", "--help", "Show this message") do
$stderr.puts opts
exit
Expand All @@ -76,7 +80,7 @@ def parse_options!

begin
parser.parse!
rescue OptionParser::InvalidOption => e
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
$stderr.puts "\n#{e.message}\n\n"
$stderr.puts parser
exit 1
Expand All @@ -94,11 +98,13 @@ def parse_options!
exit 1
end

# Trick bundler into telling us the most recent installed
# version of Rails compatible with this version of Umlaut
gem 'rails', *Umlaut::RAILS_COMPAT_SPEC
require 'rails/version'
options.rails_version = Rails::VERSION::STRING
unless options.rails_version
# Trick bundler into telling us the most recent installed
# version of Rails compatible with this version of Umlaut
gem 'rails', *Umlaut::RAILS_COMPAT_SPEC
require 'rails/version'
options.rails_version = Rails::VERSION::STRING
end

return options
end
Expand Down

0 comments on commit b7d99e7

Please sign in to comment.