Methods
- A
- B
- C
- D
- E
- G
- I
- J
- K
- N
- R
- S
- T
Constants
DATABASES | = | %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) |
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 205 def assets_gemfile_entry # 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.0".inspect} gem 'coffee-rails', #{options.dev? || options.edge? ? ":git => 'git://github.com/rails/coffee-rails.git', :branch => '3-1-stable'" : "~> 3.1.0".inspect} gem 'uglifier' end.strip_heredoc 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 217 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 `"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" #{command}` end
# File railties/lib/rails/generators/app_base.rb, line 171 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 156 def gem_for_database # %w( mysql oracle postgresql sqlite3 frontbase ibm_db 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 "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}'.strip_heredoc elsif options.edge? gem 'rails', :git => 'git://github.com/rails/rails.git'.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