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:50 UTC

svn commit: r656188 - in /ode/sandbox/singleshot: Rakefile config/environments/development.rb lib/tasks/database.rake lib/tasks/development.rake lib/tasks/setup.rb

Author: assaf
Date: Wed May 14 02:39:50 2008
New Revision: 656188

URL: http://svn.apache.org/viewvc?rev=656188&view=rev
Log:
Removed custom setup task, no longer using it since gems:install works just fine.
Added db:populate task to create fake data in the database (uses Faker gem).
Added run task to start a Thin server and show development log on the console.

Added:
    ode/sandbox/singleshot/lib/tasks/development.rake
Removed:
    ode/sandbox/singleshot/lib/tasks/setup.rb
Modified:
    ode/sandbox/singleshot/Rakefile
    ode/sandbox/singleshot/config/environments/development.rb
    ode/sandbox/singleshot/lib/tasks/database.rake

Modified: ode/sandbox/singleshot/Rakefile
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/Rakefile?rev=656188&r1=656187&r2=656188&view=diff
==============================================================================
--- ode/sandbox/singleshot/Rakefile (original)
+++ ode/sandbox/singleshot/Rakefile Wed May 14 02:39:50 2008
@@ -8,7 +8,6 @@
 require 'rake/rdoctask'
 
 require 'tasks/rails'
-require 'lib/tasks/setup.rb'
 
 
 task 'setup'=>['gems:install', 'db:populate']

Modified: ode/sandbox/singleshot/config/environments/development.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/config/environments/development.rb?rev=656188&r1=656187&r2=656188&view=diff
==============================================================================
--- ode/sandbox/singleshot/config/environments/development.rb (original)
+++ ode/sandbox/singleshot/config/environments/development.rb Wed May 14 02:39:50 2008
@@ -23,3 +23,4 @@
 config.gem 'annotate-models', :lib=>'annotate_models'
 config.gem 'rspec', :lib=>'spec',                     :version=>'~> 1.1.3'
 config.gem 'sqlite3-ruby', :lib=>'sqlite3',           :version=>'~>1.2'
+config.gem 'faker',                                   :version=>'~>0.3.1'

Modified: ode/sandbox/singleshot/lib/tasks/database.rake
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/database.rake?rev=656188&r1=656187&r2=656188&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/database.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/database.rake Wed May 14 02:39:50 2008
@@ -7,14 +7,20 @@
 
   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')
+    person = Person.find_by_identity(ENV['USER'])
+    unless person
+      person = Person.create(:email=>"#{ENV['USER']}@apache.org", :password=>'secret')
       puts 'Created an account for you:'
       puts "  Username: #{ENV['USER']}"
       puts '  Password: secret'
     end
+
+    puts "Populating database for #{person.identity}"
+    creator = Person.identify('creator') || Person.create(:email=>'creator@apache.org')
+    (1..3).each do |i|
+      Task.create! :title=>Faker::Lorem.sentence, :description=>Faker::Lorem.paragraph,  
+        :frame_url=>'http://localhost:3001/sandwhich', :owner=>person, :creator=>creator
+    end
   end
 
 end

Added: ode/sandbox/singleshot/lib/tasks/development.rake
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/development.rake?rev=656188&view=auto
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/development.rake (added)
+++ ode/sandbox/singleshot/lib/tasks/development.rake Wed May 14 02:39:50 2008
@@ -0,0 +1,10 @@
+desc 'Run development server on port 3000'
+task 'run' do
+  at_exit do
+    puts 'Stopping Thin ...'
+    system 'thin stop'
+  end
+  puts 'Starting Thin ...'
+  system 'thin', 'start', '-d', '-p', ENV['PORT'] || '3000'
+  system 'tail -f log/development.log'
+end