lib/rails/generators/app_base.rb in railties-3.1.12 vs lib/rails/generators/app_base.rb in railties-3.2.0.rc1
- old
+ new
@@ -1,7 +1,7 @@
require 'digest/md5'
-require 'active_support/secure_random'
+require 'securerandom'
require 'active_support/core_ext/string/strip'
require 'rails/version' unless defined?(Rails::VERSION)
require 'rbconfig'
require 'open-uri'
require 'uri'
@@ -136,33 +136,37 @@
def rails_gemfile_entry
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'
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'
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 => 'git://github.com/rails/rails.git'
GEMFILE
end
end
def gem_for_database
# %w( mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql )
case options[:database]
- when "oracle" then "ruby-oci8"
- when "postgresql" then "pg"
- when "frontbase" then "ruby-frontbase"
- when "mysql" then "mysql2"
- when "sqlserver" then "activerecord-sqlserver-adapter"
+ when "oracle" then "ruby-oci8"
+ when "postgresql" then "pg"
+ when "frontbase" then "ruby-frontbase"
+ when "mysql" then "mysql2"
+ when "sqlserver" then "activerecord-sqlserver-adapter"
when "jdbcmysql" then "activerecord-jdbcmysql-adapter"
when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter"
when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
when "jdbc" then "activerecord-jdbc-adapter"
else options[:database]
@@ -186,49 +190,41 @@
else
"gem 'ruby-debug19', :require => 'ruby-debug'"
end
end
- def turn_gemfile_entry
- unless RUBY_VERSION < "1.9.2" || options[:skip_test_unit]
- version = RUBY_VERSION >= "1.9.3" ? "'~> 0.8.3'" : "'0.8.2'"
- <<-GEMFILE.strip_heredoc
- group :test do
- # Pretty printed test output
- gem 'turn', #{version}, :require => false
+ 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 '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
+ else
+ <<-GEMFILE
+ # Gems used only for assets and not required
+ # in production environments by default.
+ group :assets do
+ gem 'sass-rails', '~> 3.2.0'
+ gem 'coffee-rails', '~> 3.2.0'
+ #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
+ gem 'uglifier', '>= 1.0.3'
+ end
+ GEMFILE
end
- end
- def assets_gemfile_entry
- return if options[:skip_sprockets]
- gemfile = <<-GEMFILE.strip_heredoc
- # Gems used only for assets and not required
- # in production environments by default.
- group :assets do
- gem 'sass-rails', #{options.dev? || options.edge? ? " :git => 'git://github.com/rails/sass-rails.git', :branch => '3-1-stable'" : " '~> 3.1.5'"}
- gem 'coffee-rails', #{options.dev? || options.edge? ? ":git => 'git://github.com/rails/coffee-rails.git', :branch => '3-1-stable'" : "'~> 3.1.1'"}
-
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
- #{javascript_runtime_gemfile_entry}
- 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'\n"
- end
end
def bundle_command(command)
say_status :run, "bundle #{command}"