Permalink
Browse files

Add a bootstrap task

  • Loading branch information...
1 parent daf5606 commit 689c41d7ae79c4166ad060a8a071b975319fdf8d @jdpace jdpace committed Aug 16, 2010
Showing with 36 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +3 −0 db/seeds.rb
  3. +31 −0 lib/tasks/errbit/bootstrap.rake
View
@@ -3,4 +3,5 @@ db/*.sqlite3
log/*.log
tmp/**/*
config/config.yml
-config/deploy.rb
+config/deploy.rb
+config/mongoid.yml
View
@@ -1,3 +1,6 @@
+puts "Seeding database"
+puts "-------------------------------"
+
# Create an initial Admin User
admin_email = "errbit@#{Errbit::Config.host}"
admin_pass = 'password'
@@ -0,0 +1,31 @@
+require 'fileutils'
+
+namespace :errbit do
+
+ desc "Copys of example config files"
+ task :copy_configs do
+ configs = {
+ 'config.example.yml' => 'config.yml',
+ 'deploy.example.rb' => 'deploy.rb',
+ 'mongoid.example.yml' => 'mongoid.yml'
+ }
+
+ puts "Copying example config files..."
+ configs.each do |old, new|
+ if File.exists?("config/#{new}")
+ puts "-- Skipping config/#{new}: already exists"
+ else
+ puts "-- Copying config/#{old} to config/#{new}"
+ FileUtils.cp "config/#{old}", "config/#{new}"
+ end
+ end
+ end
+
+ desc "Copy's over example files and seeds the database"
+ task :bootstrap do
+ Rake::Task['errbit:copy_configs'].execute
+ puts "\n"
+ Rake::Task['db:seed'].invoke
+ end
+
+end

0 comments on commit 689c41d

Please sign in to comment.