aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/app_base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators/app_base.rb')
-rw-r--r--railties/lib/rails/generators/app_base.rb86
1 files changed, 49 insertions, 37 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 3fbde0d989..8c8ed5010f 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -60,9 +60,6 @@ module Rails
class_option :help, :type => :boolean, :aliases => "-h", :group => :rails,
:desc => "Show this help message and quit"
-
- class_option :old_style_hash, :type => :boolean, :default => false,
- :desc => "Force using old style hash (:foo => 'bar') on Ruby >= 1.9"
end
def initialize(*args)
@@ -123,7 +120,7 @@ module Rails
end
def database_gemfile_entry
- options[:skip_active_record] ? "" : "gem '#{gem_for_database}'\n"
+ options[:skip_active_record] ? "" : "gem '#{gem_for_database}'"
end
def include_all_railties?
@@ -138,21 +135,23 @@ module Rails
if options.dev?
<<-GEMFILE.strip_heredoc
gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}'
- gem 'journey', :git => 'git://github.com/rails/journey.git'
- gem 'arel', :git => 'git://github.com/rails/arel.git'
+ gem 'journey', :git => 'https://github.com/rails/journey.git'
+ gem 'arel', :git => 'https://github.com/rails/arel.git'
+ gem 'active_record_deprecated_finders', :git => 'git://github.com/rails/active_record_deprecated_finders.git'
GEMFILE
elsif options.edge?
<<-GEMFILE.strip_heredoc
- gem 'rails', :git => 'git://github.com/rails/rails.git'
- gem 'journey', :git => 'git://github.com/rails/journey.git'
- gem 'arel', :git => 'git://github.com/rails/arel.git'
+ gem 'rails', :git => 'https://github.com/rails/rails.git'
+ gem 'journey', :git => 'https://github.com/rails/journey.git'
+ gem 'arel', :git => 'https://github.com/rails/arel.git'
+ gem 'active_record_deprecated_finders', :git => 'git://github.com/rails/active_record_deprecated_finders.git'
GEMFILE
else
<<-GEMFILE.strip_heredoc
gem 'rails', '#{Rails::VERSION::STRING}'
# Bundle edge Rails instead:
- # gem 'rails', :git => 'git://github.com/rails/rails.git'
+ # gem 'rails', :git => 'https://github.com/rails/rails.git'
GEMFILE
end
end
@@ -184,31 +183,54 @@ module Rails
end
end
- def ruby_debugger_gemfile_entry
- if RUBY_VERSION < "1.9"
- "gem 'ruby-debug'"
+ def assets_gemfile_entry
+ return if options[:skip_sprockets]
+
+ gemfile = if options.dev? || options.edge?
+ <<-GEMFILE
+ # Gems used only for assets and not required
+ # in production environments by default.
+ group :assets do
+ gem 'sprockets-rails', :git => 'https://github.com/rails/sprockets-rails.git'
+ gem 'sass-rails', :git => 'https://github.com/rails/sass-rails.git'
+ gem 'coffee-rails', :git => 'https://github.com/rails/coffee-rails.git'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ #{javascript_runtime_gemfile_entry}
+ gem 'uglifier', '>= 1.0.3'
+ end
+ GEMFILE
else
- "gem 'ruby-debug19', :require => 'ruby-debug'"
+ <<-GEMFILE
+ # Gems used only for assets and not required
+ # in production environments by default.
+ group :assets do
+ gem 'sprockets-rails', :git => 'https://github.com/rails/sprockets-rails.git'
+ gem 'sass-rails', '~> 4.0.0.beta'
+ gem 'coffee-rails', '~> 4.0.0.beta'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ #{javascript_runtime_gemfile_entry}
+ gem 'uglifier', '>= 1.0.3'
+ end
+ GEMFILE
end
- end
- def assets_gemfile_entry
- <<-GEMFILE.strip_heredoc
- # Gems used only for assets and not required
- # in production environments by default.
- group :assets do
- gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git'
- gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git'
- #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
- gem 'uglifier', '>= 1.0.3'
- end
- GEMFILE
+ gemfile.strip_heredoc.gsub(/^[ \t]*$/, '')
end
def javascript_gemfile_entry
"gem '#{options[:javascript]}-rails'" unless options[:skip_javascript]
end
+ def javascript_runtime_gemfile_entry
+ if defined?(JRUBY_VERSION)
+ "gem 'therubyrhino'\n"
+ else
+ "# gem 'therubyracer', :platform => :ruby\n"
+ end
+ end
+
def bundle_command(command)
say_status :run, "bundle #{command}"
@@ -226,7 +248,7 @@ module Rails
end
def run_bundle
- bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle]
+ bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle] || options[:pretend]
end
def empty_directory_with_gitkeep(destination, config = {})
@@ -237,16 +259,6 @@ module Rails
def git_keep(destination)
create_file("#{destination}/.gitkeep") unless options[:skip_git]
end
-
- # Returns Ruby 1.9 style key-value pair if current code is running on
- # Ruby 1.9.x. Returns the old-style (with hash rocket) otherwise.
- def key_value(key, value)
- if options[:old_style_hash] || RUBY_VERSION < '1.9'
- ":#{key} => #{value}"
- else
- "#{key}: #{value}"
- end
- end
end
end
end