You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/05/14 11:39:46 UTC

svn commit: r656187 - in /ode/sandbox/singleshot: Rakefile lib/tasks/database.rake

Author: assaf
Date: Wed May 14 02:39:46 2008
New Revision: 656187

URL: http://svn.apache.org/viewvc?rev=656187&view=rev
Log:
Brought back db:populate task.

Modified:
    ode/sandbox/singleshot/Rakefile
    ode/sandbox/singleshot/lib/tasks/database.rake

Modified: ode/sandbox/singleshot/Rakefile
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/Rakefile?rev=656187&r1=656186&r2=656187&view=diff
==============================================================================
--- ode/sandbox/singleshot/Rakefile (original)
+++ ode/sandbox/singleshot/Rakefile Wed May 14 02:39:46 2008
@@ -11,5 +11,4 @@
 require 'lib/tasks/setup.rb'
 
 
-task 'setup'=>['gems:install', 'db:create'] do |task|
-end
+task 'setup'=>['gems:install', 'db:populate']

Modified: ode/sandbox/singleshot/lib/tasks/database.rake
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/database.rake?rev=656187&r1=656186&r2=656187&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/database.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/database.rake Wed May 14 02:39:46 2008
@@ -5,5 +5,17 @@
   desc 'Rebuild the database by running all migrations again'
   task 'rebuild'=>['environment', 'drop', 'create', 'migrate', 'test:clone', 'annotate_models']
 
+  desc 'Populate the database with mock values'
+  task 'populate'=>['environment', 'create', 'migrate'] do
+    if person = Person.find_by_identity(ENV['USER'])
+      puts "Populating database for #{person.identity}"
+    else
+      Person.create(:email=>"#{ENV['USER']}@apache.org", :password=>'secret')
+      puts 'Created an account for you:'
+      puts "  Username: #{ENV['USER']}"
+      puts '  Password: secret'
+    end
+  end
+
 end