Methods
- A
- B
- C
- D
- E
- G
- I
- J
- K
- N
- R
- S
Constants
DATABASES | = | %w( mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver ) |
JDBC_DATABASES | = | %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc ) |
Attributes
[RW] | rails_template |
Class Public methods
Instance Protected methods
# File railties/lib/rails/generators/app_base.rb, line 195 def assets_gemfile_entry return if options[:skip_sprockets] gemfile = if options.dev? || options.edge? " # 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', :branch => '3-2-stable' gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git', :branch => '3-2-stable' # See https://github.com/sstephenson/execjs#readme for more supported runtimes #{javascript_runtime_gemfile_entry} gem 'uglifier', '>= 1.0.3' end " else " # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes #{javascript_runtime_gemfile_entry} gem 'uglifier', '>= 1.0.3' end " end gemfile.strip_heredoc.gsub(%r^[ \t]*$/, '') end
# File railties/lib/rails/generators/app_base.rb, line 76 def builder @builder ||= begin if path = options[:builder] if URI(path).is_a?(URI::HTTP) contents = open(path, "Accept" => "application/x-thor-template") {|io| io.read } else contents = open(File.expand_path(path, @original_wd)) {|io| io.read } end prok = eval("proc { #{contents} }", TOPLEVEL_BINDING, path, 1) instance_eval(&prok) end builder_class = get_builder_class builder_class.send(:include, ActionMethods) builder_class.new(self) end end
# File railties/lib/rails/generators/app_base.rb, line 241 def bundle_command(command) say_status :run, "bundle #{command}" # We are going to shell out rather than invoking Bundler::CLI.new(command) # because `rails new` loads the Thor gem and on the other hand bundler uses # its own vendored Thor, which could be a different version. Running both # things in the same process is a recipe for a night with paracetamol. # # We use backticks and #print here instead of vanilla #system because it # is easier to silence stdout in the existing test suite this way. The # end-user gets the bundler commands called anyway, so no big deal. # # Thanks to James Tucker for the Gem tricks involved in this call. print %x"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" #{command}` end
# File railties/lib/rails/generators/app_base.rb, line 176 def convert_database_option_for_jruby if defined?(JRUBY_VERSION) case options[:database] when "oracle" then options[:database].replace "jdbc" when "postgresql" then options[:database].replace "jdbcpostgresql" when "mysql" then options[:database].replace "jdbcmysql" when "sqlite3" then options[:database].replace "jdbcsqlite3" end end end
# File railties/lib/rails/generators/app_base.rb, line 160 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 "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] end 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.
# File railties/lib/rails/generators/app_base.rb, line 137 def rails_gemfile_entry if options.dev? " 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', :branch => '3-0-stable' ".strip_heredoc elsif options.edge? " gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-2-stable' gem 'journey', :git => 'git://github.com/rails/journey.git' gem 'arel', :git => 'git://github.com/rails/arel.git', :branch => '3-0-stable' ".strip_heredoc else " gem 'rails', '#{Rails::VERSION::STRING}' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' ".strip_heredoc end end