capistrano-didi 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-didi"
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Koen Van Winckel"]
12
- s.date = "2012-01-04"
12
+ s.date = "2012-03-23"
13
13
  s.description = "didi is a collection of recipes for capistrano that allow drupal to be deployed, tested and used in a CI environment"
14
14
  s.email = "koenvw@gmail.com"
15
15
  s.executables = ["didify", "didi"]
@@ -33,6 +33,7 @@ set :domain, 'default'
33
33
  set :db_host, 'localhost'
34
34
  set :drupal_path, 'drupal'
35
35
  set :srv_usr, 'www-data'
36
+ set :enable_robots, false
36
37
 
37
38
  ssh_options[:forward_agent] = true
38
39
  #ssh_options[:verbose] = :debug #FIXME
@@ -46,12 +47,14 @@ _cset :settings, 'settings.php'
46
47
  _cset :files, 'files'
47
48
  _cset :dbbackups, 'db_backups'
48
49
  _cset :shared_children, [domain, File.join(domain, files)]
50
+ _cset :drush_path, ''
49
51
 
50
52
  _cset(:shared_settings) { File.join(shared_path, domain, settings) }
51
53
  _cset(:shared_files) { File.join(shared_path, domain, files) }
52
54
  _cset(:dbbackups_path) { File.join(deploy_to, dbbackups, domain) }
53
55
  _cset(:drush) { "drush -r #{current_path}" + (domain == 'default' ? '' : " -l #{domain}") } # FIXME: not in use?
54
56
 
57
+
55
58
  _cset(:release_settings) { File.join(release_path, drupal_path, 'sites', domain, settings) }
56
59
  _cset(:release_files) { File.join(release_path, drupal_path, 'sites', domain, files) }
57
60
  _cset(:release_domain) { File.join(release_path, drupal_path, 'sites', domain) }
@@ -64,7 +67,7 @@ _cset(:previous_release_domain) { releases.length > 1 ? File.join(previous
64
67
  # Extra dependecy checks
65
68
  # =========================================================================
66
69
  depend :local, :command, "drush"
67
- depend :remote, :command, "drush"
70
+ depend :remote, :command, "#{drush_path}drush"
68
71
 
69
72
 
70
73
  # =========================================================================
@@ -112,6 +115,7 @@ namespace :deploy do
112
115
  configuration = drupal_settings(drupal_version)
113
116
 
114
117
  #Create shared directories
118
+ # FIXME: chown / chmod require user to be member of
115
119
  dirs = [deploy_to, releases_path, shared_path, dbbackups_path, shared_files]
116
120
  dirs += shared_children.map { |d| File.join(shared_path, d) }
117
121
  run <<-CMD
@@ -232,42 +236,63 @@ namespace :drush do
232
236
 
233
237
  desc "Clear the Drupal site cache"
234
238
  task :cc do
235
- run "cd #{current_path}/#{drupal_path} && drush cache-clear all"
239
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush cache-clear all"
236
240
  end
237
241
 
238
242
  desc "Revert all enabled feature modules on your site"
239
243
  task :fra do
240
- run "cd #{current_path}/#{drupal_path} && drush features-revert-all -y"
244
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush features-revert-all -y"
241
245
  end
242
246
 
243
247
  desc "Install Drupal along with modules/themes/configuration using the specified install profile"
244
248
  task :si do
245
249
  dburl = "#{db_type}://#{db_username}:#{db_password}@#{db_host}/#{db_name}"
246
- run "cd #{current_path}/#{drupal_path} && drush site-install #{profile} --db-url=#{dburl} --sites-subdir=default --account-name=admin --account-pass=#{adminpass} --account-mail=#{sitemail} --site-mail='#{sitemail}' --site-name='#{site}' -y"
250
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush site-install #{profile} --db-url=#{dburl} --sites-subdir=default --account-name=admin --account-pass=#{adminpass} --account-mail=#{sitemail} --site-mail='#{sitemail}' --site-name='#{site}' -y"
247
251
  bl
248
252
  end
249
253
 
250
254
  desc "[internal] Enable the baseline feature"
251
255
  task :bl do
252
- run "cd #{current_path}/#{drupal_path} && drush pm-enable #{baseline} -y"
256
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush pm-enable #{baseline} -y"
253
257
  cc
254
258
  end
255
259
  desc "[internal] Enable the simpletest feature"
256
260
  task :enst do
257
- run "cd #{current_path}/#{drupal_path} && drush pm-enable simpletest -y"
261
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush pm-enable simpletest -y"
258
262
  cc
259
263
  end
260
264
 
265
+ desc "Disable maintenance mode, enabling the site"
266
+ task :ensite do
267
+ if drupal_version == 6
268
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush vset --always-set site_offline 0"
269
+ else
270
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush vset --always-set maintenance_mode 0"
271
+ end
272
+ end
273
+
274
+ desc "Enable maintenance mode, disabling the site"
275
+ task :dissite do
276
+ if drupal_version == 6
277
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush vset --always-set site_offline 1"
278
+ else
279
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush vset --always-set maintenance_mode 1"
280
+ end
281
+ end
282
+
261
283
  desc "Apply any database updates required (as with running update.php)"
262
284
  task :updb do
263
- run "cd #{current_path}/#{drupal_path} && drush updatedb -y"
285
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush updatedb -y"
264
286
  end
265
287
 
266
288
  desc "Update via drush, runs fra, updb and cc"
267
289
  task :update do
290
+ dissite
268
291
  updb
269
292
  fra
293
+ ensite
270
294
  cc
295
+ manage.block_robots unless enable_robots
271
296
  end
272
297
 
273
298
  end
@@ -347,7 +372,7 @@ namespace :manage do
347
372
  task :dbdump_previous do
348
373
  #Backup the previous release's database
349
374
  if previous_release
350
- run "cd #{current_path}/#{drupal_path} && drush sql-dump > #{ File.join(dbbackups_path, "#{releases[-2]}.sql") }"
375
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush sql-dump > #{ File.join(dbbackups_path, "#{releases[-2]}.sql") }"
351
376
  end
352
377
  end
353
378
 
@@ -355,13 +380,14 @@ namespace :manage do
355
380
  task :pull_dump do
356
381
  sql_file = File.join(dbbackups_path, "#{releases.last}-pull.sql")
357
382
  # dump & gzip remote file
358
- run "cd #{current_path}/#{drupal_path} && drush sql-dump > #{sql_file} && gzip -f #{sql_file}"
383
+ run "cd #{current_path}/#{drupal_path} && #{drush_path}drush sql-dump > #{sql_file} && gzip -f #{sql_file}"
359
384
  # copy to local
360
385
  system "if [ ! -d build ]; then mkdir build; fi" # create build folder locally if needed
361
386
  download "#{sql_file}.gz", "build/", :once => true, :via => :scp
362
387
  run "rm #{sql_file}.gz"
363
388
  # extract and restore
364
- system "gunzip -f build/#{File.basename(sql_file)}.gz && mysql dotproject_oa_live < build/#{File.basename(sql_file)}"
389
+ # FIXME
390
+ #system "gunzip -f build/#{File.basename(sql_file)}.gz && mysql {local_database} < build/#{File.basename(sql_file)}"
365
391
  end
366
392
 
367
393
  task :push_dump do
@@ -379,24 +405,41 @@ def drupal_settings(version)
379
405
  if version.to_s == '6'
380
406
  settings = <<-STRING
381
407
  <?php
382
- $db_url = "#{db_type}://#{db_username}:#{db_password}@#{db_host}/#{db_name}";
408
+ $db_url = "#{db_type}://#{db_username}:#{db_password}@#{db_host}/#{db_name}";
409
+ ini_set('arg_separator.output', '&amp;');
410
+ ini_set('magic_quotes_runtime', 0);
411
+ ini_set('magic_quotes_sybase', 0);
412
+ ini_set('session.cache_expire', 200000);
413
+ ini_set('session.cache_limiter', 'none');
414
+ ini_set('session.cookie_lifetime', 2000000);
415
+ ini_set('session.gc_probability', 1);
416
+ ini_set('session.gc_maxlifetime', 200000);
417
+ ini_set('session.save_handler', 'user');
418
+ ini_set('session.use_cookies', 1);
419
+ ini_set('session.use_only_cookies', 1);
420
+ ini_set('session.use_trans_sid', 0);
421
+ ini_set('url_rewriter.tags', '');
383
422
  STRING
384
423
  elsif version == '7'
385
424
  settings = <<-STRING
386
425
  <?php
387
- $databases = array ('default' => array ('default' => array (
388
- 'database' => '#{db_name}',
389
- 'username' => '#{db_username}',
390
- 'password' => '#{db_password}',
391
- 'host' => '#{db_host}',
392
- 'port' => '',
393
- 'driver' => '#{db_type}',
394
- 'prefix' => '',
395
- )));
426
+ $databases = array ('default' => array ('default' => array (
427
+ 'database' => '#{db_name}',
428
+ 'username' => '#{db_username}',
429
+ 'password' => '#{db_password}',
430
+ 'host' => '#{db_host}',
431
+ 'port' => '',
432
+ 'driver' => '#{db_type}',
433
+ 'prefix' => '',
434
+ )));
435
+ ini_set('session.gc_probability', 1);
436
+ ini_set('session.gc_divisor', 100);
437
+ ini_set('session.gc_maxlifetime', 200000);
438
+ ini_set('session.cookie_lifetime', 2000000);
396
439
  STRING
397
440
  else
398
441
  abort "Unsupported Drupal version #{version}."
399
442
  end
400
443
  end
401
444
 
402
- end
445
+ end # Capistrano::Configuration.instance.load
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-didi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Koen Van Winckel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-04 00:00:00 Z
18
+ date: 2012-03-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement