le1t0-deprec 2.1.6.028 → 2.1.6.029

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG +4 -0
  2. data/lib/deprec/recipes/rails.rb +17 -9
  3. metadata +2 -2
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  # deprec changelog
2
2
 
3
+ = 2.1.6.029 (Jul 19, 2010)
4
+
5
+ * add extra database tasks to rails recipe
6
+
3
7
  = 2.1.6.028 (Jul 19, 2010)
4
8
 
5
9
  * added creation of haproxy user
@@ -33,6 +33,14 @@ Capistrano::Configuration.instance(:must_exist).load do
33
33
  top.deprec.web.reload if web_choice.to_s != 'none'
34
34
  top.deprec.rails.setup_database
35
35
  end
36
+
37
+ before 'deploy:migrate' do
38
+ unless ENV['DO_SEED']
39
+ top.deprec.rails.database.create
40
+ else
41
+ top.deprec.rails.database.seed
42
+ end
43
+ end
36
44
 
37
45
  after 'deploy:symlink', :roles => :app do
38
46
  top.deprec.rails.symlink_shared_dirs
@@ -302,32 +310,32 @@ Capistrano::Configuration.instance(:must_exist).load do
302
310
  namespace :database do
303
311
 
304
312
  desc "Create database"
305
- task :create, :roles => :app do
306
- run "cd #{deploy_to}/current && rake db:create RAILS_ENV=#{rails_env}"
313
+ task :create, :roles => :db, :only => { :primary => true } do
314
+ run "cd #{deploy_to}/current && rake db:schema:dump || rake db:create RAILS_ENV=#{rails_env}"
307
315
  end
308
316
 
309
- desc "Seed database"
310
- task :seed, :roles => :app do
311
- run "cd #{deploy_to}/current && rake db:seed RAILS_ENV=#{rails_env}"
317
+ desc "Create and seed database"
318
+ task :seed, :roles => :db, :only => { :primary => true } do
319
+ run "cd #{deploy_to}/current && rake db:schema:dump || rake db:create db:seed RAILS_ENV=#{rails_env}"
312
320
  end
313
321
 
314
322
  desc "Redo database, only available if defined in your app"
315
- task :redo, :roles => :app do
323
+ task :redo, :roles => :db, :only => { :primary => true } do
316
324
  run "cd #{deploy_to}/current && rake db:redo RAILS_ENV=#{rails_env}"
317
325
  end
318
326
 
319
327
  desc "Run database migrations"
320
- task :migrate, :roles => :app do
328
+ task :migrate, :roles => :db, :only => { :primary => true } do
321
329
  run "cd #{deploy_to}/current && rake db:migrate RAILS_ENV=#{rails_env}"
322
330
  end
323
331
 
324
332
  desc "Run database migrations"
325
- task :schema_load, :roles => :app do
333
+ task :schema_load, :roles => :db, :only => { :primary => true } do
326
334
  run "cd #{deploy_to}/current && rake db:schema:load RAILS_ENV=#{rails_env}"
327
335
  end
328
336
 
329
337
  desc "Roll database back to previous migration"
330
- task :rollback, :roles => :app do
338
+ task :rollback, :roles => :db, :only => { :primary => true } do
331
339
  run "cd #{deploy_to}/current && rake db:rollback RAILS_ENV=#{rails_env}"
332
340
  end
333
341
 
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 1
8
8
  - 6
9
- - 28
10
- version: 2.1.6.028
9
+ - 29
10
+ version: 2.1.6.029
11
11
  platform: ruby
12
12
  authors:
13
13
  - Le1t0