lib/daiku/plugins/database-sql/cli.rb in daiku-0.2.0 vs lib/daiku/plugins/database-sql/cli.rb in daiku-0.2.1
- old
+ new
@@ -21,18 +21,51 @@
append_to_file "#{app}/.env", "DATABASE_NAME=#{dbname}\n"
append_to_file "#{app}/.env", "DATABASE_URL=#{dburl}\n"
end
def config
- template('_templates/db_helper.rb.tt', "#{app}/spec/db_helper.rb")
+ template '_templates/db_helper.rb.tt', "#{app}/spec/db_helper.rb"
end
def gemfile
insert_into_file "#{app}/Gemfile", " gem 'database_cleaner'\n", after: "group :test do\n"
end
- def spechelper
- insert_into_file "#{app}/spec/spec_helper.rb", "DatabaseCleaner.strategy = :truncation\n", after: "Bundler.setup(:test)\n"
+ def rake
+ template "_templates/db.rake.tt", "#{app}/lib/tasks/db.rake"
+ end
+
+ 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
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"