Sha256: ae49bd51611254c1d6f6ba226cc81683080673528f2313a5abeabd8be06a4fd0
Contents?: true
Size: 976 Bytes
Versions: 1
Compression:
Stored size: 976 Bytes
Contents
class Recipes::Database < Rails::AppBuilder def ask databases = { mysql: "MySQL", postgresql: "PostgreSQL", none: "None, thanks" } database = answer(:db) do databases.keys[Ask.list("Which database are you using?", databases.values)] end set :database, database.to_sym end def create databases = { mysql: { name: 'mysql', gem_name: 'mysql2', version: '~> 0.3.18', relational: true }, postgresql: { name: 'postgresql', gem_name: 'pg', relational: true } } if db = databases[get(:database)] if db[:relational] activate_for_active_record(db) end end end private def activate_for_active_record(db) remove_file 'config/database.yml' template "../assets/config/database_#{db[:name]}.yml.erb", 'config/database.yml' discard_gem 'sqlite3' if db[:version] gather_gem db[:gem_name], db[:version] else gather_gem db[:gem_name] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
potassium-2.0.0 | lib/potassium/recipes/database.rb |