public
Description: app:bootstrap rake task providing a command line menu to setup a rails app.
Clone URL: git://github.com/technoweenie/app_bootstrap.git
add db:reset with a fallback to db:schema:load.  also run db:test:clone 
right away for autotest weenies
technoweenie (author)
Mon Jun 23 10:55:34 -0700 2008
commit  221baec9754f2936b41c368096831cc650c01bfe
tree    08db556ebae82b1a8e4f33a968e75549bb029f07
parent  69abc3cb465a0db3a0adaf565cd7bbd429036468
...
60
61
62
63
64
65
66
 
67
68
69
...
78
79
80
81
 
 
 
 
 
 
 
 
 
 
 
 
 
82
83
84
...
92
93
94
 
95
96
97
...
60
61
62
 
63
64
 
65
66
67
68
...
77
78
79
 
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
103
104
105
106
107
108
109
0
@@ -60,10 +60,9 @@ namespace :app do
0
         say "Development: '#{options.database}'"
0
         say "Production: '#{options.database}'"
0
         say "Test: '#{options.test_database}'"
0
- say "I don't quite feel comfortable creating your database for you (I hardly know you). So, make sure these databases have been created before proceeding."
0
       else
0
         cp 'config/database.sample.yml', db_config
0
- say "I have copied database.sample.yml over. Now, edit #{db_config} with your correct database settings."
0
+ say "I have copied database.sample.yml over. Now, edit #{db_config} with your correct database settings, and re-run app:bootstrap."
0
         return
0
       end
0
     end
0
@@ -78,7 +77,19 @@ namespace :app do
0
     puts
0
 
0
     mkdir_p File.join(RAILS_ROOT, 'log')
0
- %w(environment db:schema:load tmp:create).each { |t| Rake::Task[t].invoke }
0
+
0
+ Rake::Task['environment'].invoke
0
+ begin
0
+ say "Attempting to reset the database."
0
+ Rake::Task['db:reset'].invoke
0
+ rescue
0
+ say "rake db:reset failed, you should look into that."
0
+ puts $!.inspect
0
+ say "If this doesn't work, create your database manually and re-run this app:bootstrap task."
0
+ say "At any rate, I'm going to attempt to load the schema."
0
+ Rake::Task['db:schema:load'].invoke
0
+ end
0
+ Rake::Task["tmp:create"].invoke
0
     puts
0
   end
0
 
0
@@ -92,6 +103,7 @@ namespace :app do
0
     say "#{@app_name} is ready to roll."
0
     say "Okay, thanks for bootstrapping! I know I felt some chemistry here, did you?"
0
     say "Now, start the application with 'script/server' and get to work!"
0
+ Rake::Task["db:test:clone"].invoke
0
   end
0
 
0
   task :setup do

Comments

    No one has commented yet.