diff options
author | José Valim <jose.valim@gmail.com> | 2010-02-04 13:53:37 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-04 13:53:37 +0100 |
commit | 79376e3c9d0838ff1562e0a46239c6b0337058b3 (patch) | |
tree | 38b8304b4f70ca19ead6cbee6544d5a2f0d5a2e7 /railties/lib/generators/rails/app | |
parent | ab14e3f8628da81535c09eab3ba48d06725c6769 (diff) | |
download | rails-79376e3c9d0838ff1562e0a46239c6b0337058b3.tar.gz rails-79376e3c9d0838ff1562e0a46239c6b0337058b3.tar.bz2 rails-79376e3c9d0838ff1562e0a46239c6b0337058b3.zip |
Update Gemfile to use latest bundler config.
Diffstat (limited to 'railties/lib/generators/rails/app')
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 36 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/templates/Gemfile | 10 |
2 files changed, 26 insertions, 20 deletions
diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index dcb8af208f..c439ed89f5 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -9,6 +9,8 @@ module Rails::Generators class AppGenerator < Base DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) + + attr_accessor :rails_template add_shebang_option! argument :app_path, :type => :string @@ -90,18 +92,6 @@ module Rails::Generators template "config/boot.rb" end - def gem_for_database - # %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) - case options[:database] - when "mysql" then "mysql" - when "oracle" then "ruby-oci8" - when "postgresql" then "pg" - when "sqlite3" then "sqlite3-ruby" - when "frontbase" then "ruby-frontbase" - when "ibm_db" then "ibm_db" - end - end - def create_activerecord_files return if options[:skip_activerecord] template "config/databases/#{options[:database]}.yml", "config/database.yml" @@ -185,7 +175,10 @@ module Rails::Generators end protected - attr_accessor :rails_template + + def self.banner + "rails #{self.arguments.map(&:usage).join(' ')} [options]" + end def set_default_accessors! self.rails_template = case options[:template] @@ -230,8 +223,21 @@ module Rails::Generators options.dev? || options.edge? end - def self.banner - "#{$0} #{self.arguments.map(&:usage).join(' ')} [options]" + def gem_for_database + # %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) + case options[:database] + when "oracle" then "ruby-oci8" + when "postgresql" then "pg" + when "sqlite3" then "sqlite3-ruby" + when "frontbase" then "ruby-frontbase" + else options[:database] + end + end + + def require_for_database + case options[:database] + when "sqlite3" then "sqlite3" + end end def mysql_socket diff --git a/railties/lib/generators/rails/app/templates/Gemfile b/railties/lib/generators/rails/app/templates/Gemfile index 2ad3041ab9..f51edc4d2f 100644 --- a/railties/lib/generators/rails/app/templates/Gemfile +++ b/railties/lib/generators/rails/app/templates/Gemfile @@ -18,17 +18,17 @@ gem "rails", "<%= Rails::VERSION::STRING %>" # ActiveRecord requires a database adapter. By default, # Rails has selected sqlite3. <% end -%> -gem "<%= gem_for_database %>" +gem "<%= gem_for_database %>"<% if require_for_database %>, :require => "<%= require_for_database %>"<% end %> <% end -%> ## Bundle the gems you use: # gem "bj" # gem "hpricot", "0.6" -# gem "sqlite3-ruby", :require_as => "sqlite3" -# gem "aws-s3", :require_as => "aws/s3" +# gem "sqlite3-ruby", :require => "sqlite3" +# gem "aws-s3", :require => "aws/s3" ## Bundle gems used only in certain environments: -# gem "rspec", :only => :test -# only :test do +# gem "rspec", :group => :test +# group :test do # gem "webrat" # end |