- A
- B
- C
- D
- E
- G
- I
- J
- K
- N
- R
- S
- T
DATABASES | = | %w( mysql oracle postgresql sqlite3 frontbase ibm_db sqlserver ) |
JDBC_DATABASES | = | %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc ) |
[RW] | rails_template |
Source: show
Source: show
# File railties/lib/rails/generators/app_base.rb, line 68 def initialize(*args) @original_wd = Dir.pwd super convert_database_option_for_jruby end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 108 def apply_rails_template apply rails_template if rails_template rescue Thor::Error, LoadError, Errno::ENOENT => e raise Error, "The template [#{rails_template}] could not be loaded. Error: #{e}" end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 207 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.5'"} gem 'coffee-rails', #{options.dev? || options.edge? ? ":git => 'git://github.com/rails/coffee-rails.git', :branch => '3-1-stable'" : "'~> 3.1.1'"} gem 'uglifier', '>= 1.0.3' end ".strip_heredoc end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 95 def build(meth, *args) builder.send(meth, *args) if builder.respond_to?(meth) end
Source: show
# 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
Source: show
# File railties/lib/rails/generators/app_base.rb, line 219 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
Source: show
# File railties/lib/rails/generators/app_base.rb, line 133 def comment_if(value) options[value] ? '# ' : '' end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 172 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
Source: show
# File railties/lib/rails/generators/app_base.rb, line 99 def create_root self.destination_root = File.expand_path(app_path, destination_root) valid_const? empty_directory '.' set_default_accessors! FileUtils.cd(destination_root) unless options[:pretend] end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 125 def database_gemfile_entry options[:skip_active_record] ? "" : "gem '#{gem_for_database}'\n" end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 239 def empty_directory_with_gitkeep(destination, config = {}) empty_directory(destination, config) git_keep(destination) end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 156 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
Source: show
# File railties/lib/rails/generators/app_base.rb, line 244 def git_keep(destination) create_file("#{destination}/.gitkeep") unless options[:skip_git] end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 129 def include_all_railties? !options[:skip_active_record] && !options[:skip_test_unit] && !options[:skip_sprockets] end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 203 def javascript_gemfile_entry "gem '#{options[:javascript]}-rails'" unless options[:skip_javascript] 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.
Source: show
# File railties/lib/rails/generators/app_base.rb, line 250 def key_value(key, value) if options[:old_style_hash] || RUBY_VERSION < '1.9' ":#{key} => #{value}" else "#{key}: #{value}" end end
Source: show
# 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
Source: show
# File railties/lib/rails/generators/app_base.rb, line 183 def ruby_debugger_gemfile_entry if RUBY_VERSION < "1.9" "gem 'ruby-debug'" else "gem 'ruby-debug19', :require => 'ruby-debug'" end end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 235 def run_bundle bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle] end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 114 def set_default_accessors! self.rails_template = case options[:template] when /^https?:\/\// options[:template] when String File.expand_path(options[:template], Dir.pwd) else options[:template] end end
Source: show
# File railties/lib/rails/generators/app_base.rb, line 191 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'" " group :test do # Pretty printed test output gem 'turn', #{version}, :require => false end ".strip_heredoc end end