diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-02-04 13:14:44 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-02-04 13:14:44 +0000 |
commit | 8260f0b40f8954f1822a0f856f7c0706afbba0bd (patch) | |
tree | 1ec6fe65274eeb87c2030ba2daa3e230a375e846 /railties/lib/generators/rails/app/app_generator.rb | |
parent | 6241d4e5535190b817e546130cfe179b641da1ba (diff) | |
parent | 6d6e6105c074eb9f266619e77a0873635af94124 (diff) | |
download | rails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.tar.gz rails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.tar.bz2 rails-8260f0b40f8954f1822a0f856f7c0706afbba0bd.zip |
Merge remote branch 'mainstream/master'
Conflicts:
railties/guides/source/3_0_release_notes.textile
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 |