class Daiku::Plugins::DatabaseSql::CLI
Public Class Methods
source_root()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 14 def self.source_root File.expand_path('../', __FILE__) end
Public Instance Methods
config()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 25 def config template '_templates/db_helper.rb.tt', "#{app}/spec/db_helper.rb" end
dotenv()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 18 def dotenv dbname = options.fetch(:'db-url') { app } dburl = options.fetch(:'db-name') { "postgres://localhost/#{app}" } append_to_file "#{app}/.env", "DATABASE_NAME=#{dbname}\n" append_to_file "#{app}/.env", "DATABASE_URL=#{dburl}\n" end
gemfile()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 29 def gemfile insert_into_file "#{app}/Gemfile", " gem 'database_cleaner'\n", after: "group :test do\n" end
rake()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 33 def rake template "_templates/db.rake.tt", "#{app}/lib/tasks/db.rake" end
readme()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 37 def readme content = <<-DBREADME ## Sync It _Instructions on how to sync the database..._ `production` to `staging` Sync DB: # instructions go here... --- ### `production` to `development` Sync DB: # instructions go here... --- ### `staging` to `development` Sync DB: # instructions go here... DBREADME append_to_file "#{app}/README.md", content end
travisyml()
click to toggle source
# File lib/daiku/plugins/database-sql/cli.rb, line 70 def travisyml insert_into_file "#{app}/.travis.yml", " - postgresql\n", after: "services:\n" insert_into_file "#{app}/.travis.yml", " postgresql: 9.3\n", after: "addons:\n" insert_into_file "#{app}/.travis.yml", %Q( - psql -c 'create database "#{app}_test";' -U postgres\n), after: "before_script:\n" end