Author: assaf
Date: Mon Jun 2 21:53:13 2008
New Revision: 662648
URL: http://svn.apache.org/viewvc?rev=662648&view=rev
Log:
Cleaned up setup/database tasks.
Added:
ode/sandbox/singleshot/lib/tasks/setup.rake
Modified:
ode/sandbox/singleshot/README
ode/sandbox/singleshot/Rakefile
ode/sandbox/singleshot/lib/tasks/database.rake
ode/sandbox/singleshot/lib/tasks/populate.rake
Modified: ode/sandbox/singleshot/README
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/README?rev=662648&r1=662647&r2=662648&view=diff
==============================================================================
--- ode/sandbox/singleshot/README (original)
+++ ode/sandbox/singleshot/README Mon Jun 2 21:53:13 2008
@@ -1,7 +1,7 @@
== Setting up the environment
Singleshot is developed against Rails 2.1. To get moving you need to first
-install Rails 2.1 RC1 or later.
+install Rails 2.1 or later.
To get the latest copy use one of the following:
@@ -28,8 +28,9 @@
== Setting up the database
The database is configured in config/databases.yml. The development and test
-database is set to use SQLite3, so there's no need for extra setup. For
-production you should consider using something else.
+database is set to use SQLite3, and the SQLite3 drive is installed when running
+rake setup. For production, you should consider using something else (the
+default configuration is MySQL).
== Migrations
@@ -45,11 +46,14 @@
Those changes are recorded in the form of migration, but to update run:
-$ rake db:rebuild
+$ rake db:migrate:reset
This task will recreate the entire development and test database. In addition,
-it uses the annotate-models Gems to, well, annotate the Rails models with the
-most recent database schema.
+we uses the annotate-models Gems to, well, annotate the Rails models with the
+most recent database schema. So when changing the database schema, follow
+with:
+
+$ rake annotate_models
To recreate the dummy data used for development:
Modified: ode/sandbox/singleshot/Rakefile
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/Rakefile?rev=662648&r1=662647&r2=662648&view=diff
==============================================================================
--- ode/sandbox/singleshot/Rakefile (original)
+++ ode/sandbox/singleshot/Rakefile Mon Jun 2 21:53:13 2008
@@ -28,6 +28,3 @@
require 'tasks/rails'
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
-desc 'Run this task first to setup your test/development environment'
-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=662648&r1=662647&r2=662648&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/database.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/database.rake Mon Jun 2 21:53:13 2008
@@ -1,8 +1 @@
require 'annotate_models/tasks'
-
-namespace 'db' do
-
- desc 'Rebuild the database by running all migrations again'
- task 'rebuild'=>['environment', 'drop', 'create', 'migrate', 'test:clone',
'annotate_models']
-
-end
Modified: ode/sandbox/singleshot/lib/tasks/populate.rake
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/populate.rake?rev=662648&r1=662647&r2=662648&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/populate.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/populate.rake Mon Jun 2 21:53:13 2008
@@ -37,7 +37,7 @@
defaults = { :title=>Faker::Lorem.sentence,
:description=>Faker::Lorem.paragraphs(3).join("\n\n"),
:rendering=>{
:perform_url=>'http://localhost:3001/sandwich', :completing=>true },
:potential_owners=>[you, other] }
returning Task.new(defaults.merge(attributes || {})) do |task|
- task.modified_by(you).save!
+ task.modify_by(you).save!
def task.delay(duration = 2.hours)
Task.delay(duration)
self
@@ -55,7 +55,7 @@
# - observer
# - admin
create :creator=>you
- create(:creator=>you).delay(25.minutes).modified_by(you).update_attributes
:owner=>you
+ create(:creator=>you).delay(25.minutes).modify_by(you).update_attributes
:owner=>you
create :observers=>you
create :admins=>you
# Tasks in which we are only or one of many potential owners.
@@ -68,9 +68,9 @@
create :owner=>you, :due_on=>Time.today
create :owner=>you, :due_on=>Time.today + 1.day
# Completed, cancelled, suspended
- create(:potential_owners=>[you,
other]).delay(30.minutes).modified_by(other).update_attributes(:status=>'suspended')
- create(:owner=>you,
:status=>'active').delay(2.hours).modified_by(you).update_attributes(:status=>'completed')
- create(:owner=>you,
:status=>'active').delay(96.minutes).modified_by(other).update_attributes(:status=>'cancelled')
+ create(:potential_owners=>[you,
other]).delay(30.minutes).modify_by(other).update_attributes(:status=>'suspended')
+ create(:owner=>you,
:status=>'active').delay(2.hours).modify_by(you).update_attributes(:status=>'completed')
+ create(:owner=>you,
:status=>'active').delay(96.minutes).modify_by(other).update_attributes(:status=>'cancelled')
end
end
Added: ode/sandbox/singleshot/lib/tasks/setup.rake
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/setup.rake?rev=662648&view=auto
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/setup.rake (added)
+++ ode/sandbox/singleshot/lib/tasks/setup.rake Mon Jun 2 21:53:13 2008
@@ -0,0 +1,4 @@
+require 'rails_generator/secret_key_generator'
+
+desc 'Run this task first to setup your test/development environment'
+task 'setup'=>['gems:install', 'db:create', 'db:test:clone', 'db:populate']