lib/padrino-gen/generators/components/orms/sequel.rb in padrino-gen-0.10.7 vs lib/padrino-gen/generators/components/orms/sequel.rb in padrino-gen-0.11.0

- old
+ new

@@ -8,26 +8,35 @@ end SEQUEL def setup_orm sequel = SEQUEL - db = @app_name.underscore + db = @project_name.underscore require_dependencies 'sequel' - require_dependencies case options[:adapter] + case options[:adapter] + when 'mysql-gem' + sequel.gsub!(/!DB_DEVELOPMENT!/, "\"mysql://localhost/#{db}_development\"") + sequel.gsub!(/!DB_PRODUCTION!/, "\"mysql://localhost/#{db}_production\"") + sequel.gsub!(/!DB_TEST!/,"\"mysql://localhost/#{db}_test\"") + require_dependencies 'mysql', :version => "~> 2.8.1" + 'mysql' when 'mysql', 'mysql2' - sequel.gsub!(/!DB_DEVELOPMENT!/, "\"#{options[:adapter]}://localhost/#{db}_development\"") - sequel.gsub!(/!DB_PRODUCTION!/, "\"#{options[:adapter]}://localhost/#{db}_production\"") - sequel.gsub!(/!DB_TEST!/,"\"#{options[:adapter]}://localhost/#{db}_test\"") - options[:adapter] + sequel.gsub!(/!DB_DEVELOPMENT!/, "\"mysql2://localhost/#{db}_development\"") + sequel.gsub!(/!DB_PRODUCTION!/, "\"mysql2://localhost/#{db}_production\"") + sequel.gsub!(/!DB_TEST!/,"\"mysql2://localhost/#{db}_test\"") + require_dependencies 'mysql2' + 'mysql2' when 'postgres' sequel.gsub!(/!DB_DEVELOPMENT!/, "\"postgres://localhost/#{db}_development\"") sequel.gsub!(/!DB_PRODUCTION!/, "\"postgres://localhost/#{db}_production\"") sequel.gsub!(/!DB_TEST!/,"\"postgres://localhost/#{db}_test\"") + require_dependencies 'pg' 'pg' else sequel.gsub!(/!DB_DEVELOPMENT!/,"\"sqlite://\" + Padrino.root('db', \"#{db}_development.db\")") sequel.gsub!(/!DB_PRODUCTION!/,"\"sqlite://\" + Padrino.root('db', \"#{db}_production.db\")") sequel.gsub!(/!DB_TEST!/,"\"sqlite://\" + Padrino.root('db', \"#{db}_test.db\")") + require_dependencies 'sqlite3' 'sqlite3' end create_file("config/database.rb", sequel) empty_directory('db/migrate') end