diff options
Diffstat (limited to 'railties/lib/rails/generators/app_base.rb')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 324199e71c..998957f313 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -12,7 +12,6 @@ module Rails DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql ) DATABASES.concat(JDBC_DATABASES) - JAVASCRIPTS = %w( jquery prototype ) attr_accessor :rails_template add_shebang_option! @@ -38,6 +37,9 @@ module Rails class_option :database, :type => :string, :aliases => "-d", :default => "sqlite3", :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})" + class_option :javascript, :type => :string, :aliases => '-j', :default => 'jquery', + :desc => 'Preconfigure for selected JavaScript library' + class_option :skip_javascript, :type => :boolean, :aliases => "-J", :default => false, :desc => "Skip JavaScript files" @@ -130,16 +132,10 @@ module Rails if options.dev? <<-GEMFILE.strip_heredoc gem 'rails', :path => '#{Rails::Generators::RAILS_DEV_PATH}' - gem 'arel', :git => 'git://github.com/rails/arel.git' - gem 'rack', :git => 'git://github.com/rack/rack.git' - gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git' GEMFILE elsif options.edge? <<-GEMFILE.strip_heredoc gem 'rails', :git => 'git://github.com/rails/rails.git' - gem 'arel', :git => 'git://github.com/rails/arel.git' - gem 'rack', :git => 'git://github.com/rack/rack.git' - gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git' GEMFILE else <<-GEMFILE.strip_heredoc @@ -147,9 +143,6 @@ module Rails # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' - # gem 'arel', :git => 'git://github.com/rails/arel.git' - # gem 'rack', :git => 'git://github.com/rack/rack.git' - # gem 'sprockets', :git => 'git://github.com/sstephenson/sprockets.git' GEMFILE end end @@ -167,7 +160,7 @@ module Rails else options[:database] end end - + def gem_for_ruby_debugger if RUBY_VERSION < "1.9.2" "gem 'ruby-debug'" @@ -175,7 +168,7 @@ module Rails "gem 'ruby-debug19', :require => 'ruby-debug'" end end - + def gem_for_turn unless RUBY_VERSION < "1.9.2" <<-GEMFILE.strip_heredoc @@ -187,6 +180,10 @@ module Rails end end + def gem_for_javascript + "gem '#{options[:javascript]}-rails'" unless options[:skip_javascript] + end + def bundle_if_dev_or_edge bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') run "#{bundle_command} install" if dev_or_edge? @@ -200,7 +197,7 @@ module Rails empty_directory(destination, config) git_keep(destination) end - + def git_keep(destination) create_file("#{destination}/.gitkeep") unless options[:skip_git] end @@ -216,4 +213,4 @@ module Rails end end end -end
\ No newline at end of file +end |