Commit 689c41d7ae79c4166ad060a8a071b975319fdf8d

Authored by Jared Pace
1 parent daf56064
Exists in master and in 1 other branch production

Add a bootstrap task

.gitignore
... ... @@ -3,4 +3,5 @@ db/*.sqlite3
3 3 log/*.log
4 4 tmp/**/*
5 5 config/config.yml
6   -config/deploy.rb
7 6 \ No newline at end of file
  7 +config/deploy.rb
  8 +config/mongoid.yml
8 9 \ No newline at end of file
... ...
db/seeds.rb
  1 +puts "Seeding database"
  2 +puts "-------------------------------"
  3 +
1 4 # Create an initial Admin User
2 5 admin_email = "errbit@#{Errbit::Config.host}"
3 6 admin_pass = 'password'
... ...
lib/tasks/errbit/bootstrap.rake 0 → 100644
... ... @@ -0,0 +1,31 @@
  1 +require 'fileutils'
  2 +
  3 +namespace :errbit do
  4 +
  5 + desc "Copys of example config files"
  6 + task :copy_configs do
  7 + configs = {
  8 + 'config.example.yml' => 'config.yml',
  9 + 'deploy.example.rb' => 'deploy.rb',
  10 + 'mongoid.example.yml' => 'mongoid.yml'
  11 + }
  12 +
  13 + puts "Copying example config files..."
  14 + configs.each do |old, new|
  15 + if File.exists?("config/#{new}")
  16 + puts "-- Skipping config/#{new}: already exists"
  17 + else
  18 + puts "-- Copying config/#{old} to config/#{new}"
  19 + FileUtils.cp "config/#{old}", "config/#{new}"
  20 + end
  21 + end
  22 + end
  23 +
  24 + desc "Copy's over example files and seeds the database"
  25 + task :bootstrap do
  26 + Rake::Task['errbit:copy_configs'].execute
  27 + puts "\n"
  28 + Rake::Task['db:seed'].invoke
  29 + end
  30 +
  31 +end
0 32 \ No newline at end of file
... ...