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/app_generator.rb | |
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/app_generator.rb')
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 36 |
1 files changed, 21 insertions, 15 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 |