Commit 689c41d7ae79c4166ad060a8a071b975319fdf8d
1 parent
daf56064
Exists in
master
and in
1 other branch
Add a bootstrap task
Showing
3 changed files
with
36 additions
and
1 deletions
Show diff stats
.gitignore
| @@ -3,4 +3,5 @@ db/*.sqlite3 | @@ -3,4 +3,5 @@ db/*.sqlite3 | ||
| 3 | log/*.log | 3 | log/*.log |
| 4 | tmp/**/* | 4 | tmp/**/* |
| 5 | config/config.yml | 5 | config/config.yml |
| 6 | -config/deploy.rb | ||
| 7 | \ No newline at end of file | 6 | \ No newline at end of file |
| 7 | +config/deploy.rb | ||
| 8 | +config/mongoid.yml | ||
| 8 | \ No newline at end of file | 9 | \ No newline at end of file |
db/seeds.rb
| @@ -0,0 +1,31 @@ | @@ -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 | \ No newline at end of file | 32 | \ No newline at end of file |