capistrano-ash 1.2.4 → 1.3.0

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/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.3.0
2
+ * Version bump! - Adds tasks for compiling Sass/compass stylesheets and make it part of the deployment task chain. Although it's part of the task chain, it will only be ran if the `:compass_watched_dirs` is defined
3
+
4
+ == 1.2.4
5
+ * FIXED: Issue #30 - change ownership of directories/files in `deploy:cleanup` to avoid permission denied errors
6
+ * FIXED: Issue #29 - Remove copying of .git files to live site
7
+
1
8
  == 1.2.3
2
9
  * FIXED: Issue #27 - Wordpress symlinking uploads and cache directories to the previous release instead of the newest release
3
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.4
1
+ 1.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "capistrano-ash"
8
- s.version = "1.2.0"
8
+ s.version = "1.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["August Ash"]
12
- s.date = "2012-08-23"
12
+ s.date = "2013-02-15"
13
13
  s.description = "August Ash recipes for Capistrano"
14
14
  s.email = "code@augustash.com"
15
15
  s.extra_rdoc_files = [
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  ]
35
35
  s.homepage = "https://github.com/augustash/capistrano-ash"
36
36
  s.require_paths = ["lib"]
37
- s.rubygems_version = "1.8.23"
37
+ s.rubygems_version = "1.8.24"
38
38
  s.summary = "Useful task libraries for August Ash recipes for Capistrano"
39
39
 
40
40
  if s.respond_to? :specification_version then
data/lib/ash/base.rb CHANGED
@@ -85,6 +85,9 @@ configuration.load do
85
85
  set :db_regex_hash, {
86
86
  }
87
87
 
88
+
89
+
90
+
88
91
  # --------------------------------------------
89
92
  # Overloaded tasks
90
93
  # --------------------------------------------
@@ -427,6 +430,110 @@ configuration.load do
427
430
  end
428
431
  end
429
432
 
433
+ # --------------------------------------------
434
+ # Compass/Sass compiling
435
+ # --------------------------------------------
436
+ namespace :compass do
437
+ desc "Compile SASS stylesheets and upload to remote server"
438
+ task :default do
439
+ compile
440
+ upload_stylesheets
441
+ ash.fixperms
442
+ end
443
+
444
+ desc 'Uploads compiled stylesheets to their matching watched directories'
445
+ task :upload_stylesheets, :roles => :web, :except => { :no_release => true } do
446
+ watched_dirs = fetch(:compass_watched_dirs, nil)
447
+ stylesheets_dir_name = fetch(:stylesheets_dir_name, 'stylesheets')
448
+
449
+ # finds all the web servers that we should upload stylesheets to
450
+ servers = find_servers :roles => :web
451
+
452
+ if !watched_dirs.nil?
453
+ if watched_dirs.is_a? String
454
+ logger.debug "Uploading compiled stylesheets for #{watched_dirs}"
455
+ logger.debug "trying to upload stylesheets from ./#{watched_dirs}/#{stylesheets_dir_name} -> #{latest_release}/#{watched_dirs}/#{stylesheets_dir_name}"
456
+
457
+ servers.each do |web_server|
458
+ upload_command = "scp -r ./#{watched_dirs}/#{stylesheets_dir_name}/*.css #{user}@#{web_server}:#{latest_release}/#{watched_dirs}/#{stylesheets_dir_name}/"
459
+
460
+ logger.info "running SCP command:"
461
+ logger.debug upload_command
462
+ system(upload_command)
463
+ end
464
+ elsif watched_dirs.is_a? Array
465
+ logger.debug "Uploading compiled stylesheets for #{watched_dirs.join(', ')}"
466
+ watched_dirs.each do |dir|
467
+ logger.debug "trying to upload stylesheets from ./#{dir}/#{stylesheets_dir_name}/ -> #{latest_release}/#{dir}/#{stylesheets_dir_name}/"
468
+
469
+ servers.each do |web_server|
470
+ upload_command = "scp -r ./#{dir}/#{stylesheets_dir_name}/*.css #{user}@#{web_server}:#{latest_release}/#{dir}/#{stylesheets_dir_name}/"
471
+
472
+ logger.info "running SCP command:"
473
+ logger.debug upload_command
474
+ system(upload_command)
475
+ end
476
+ end
477
+ else
478
+ logger.debug "Unable to upload compiled stylesheets because :compass_watched_dirs was neither a String nor an Array"
479
+ end
480
+ else
481
+ logger.info "Skipping uploading of compiled stylesheets `compass:upload` because `:compass_watched_dirs` wasn't set"
482
+ end
483
+ end
484
+
485
+ desc 'Compile minified version of CSS assets using Compass gem'
486
+ task :compile, :roles => :web, :except => { :no_release => true } do
487
+ watched_dirs = fetch(:compass_watched_dirs, nil)
488
+
489
+ if !watched_dirs.nil?
490
+ compass_bin_local = find_compass_bin_path
491
+ compass_bin = fetch(:compass_bin, compass_bin_local)
492
+ compass_env = fetch(:compass_env, "production")
493
+ compass_output = fetch(:compass_output, 'compressed') # nested, expanded, compact, compressed
494
+
495
+ if !compass_bin.nil?
496
+ if watched_dirs.is_a? String
497
+ logger.debug "Compiling SASS for #{watched_dirs}"
498
+ system "#{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{watched_dirs}"
499
+ elsif watched_dirs.is_a? Array
500
+ logger.debug "Compiling SASS for #{watched_dirs.join(', ')}"
501
+ watched_dirs.each do |dir|
502
+ system "#{compass_bin} compile --output-style #{compass_output} --environment #{compass_env} ./#{dir}"
503
+ end
504
+ else
505
+ logger.debug "Unable to compile SASS because :compass_watched_dirs was neither a String nor an Array"
506
+ end
507
+ else
508
+ logger.info "Skipping SASS compilation in `compass:compile` because unable to find the bin executable for the compass gem"
509
+ end
510
+ else
511
+ logger.info "Skipping compass Sass compiliation"
512
+ end
513
+ end
514
+
515
+ desc "Finds the bin executable path for the compass gem"
516
+ task :find_compass_bin_path, :except => { :no_release => true } do
517
+ begin
518
+ spec = Gem::Specification.find_by_name("compass")
519
+ gem_root = spec.gem_dir
520
+ gem_bin = gem_root + "/bin/compass"
521
+ rescue Gem::LoadError => e
522
+ logger.debug "Unable to find the gem 'compass'! Check to see if it's installed: `gem list -d compass` or install: `gem install compass`"
523
+ gem_bin = nil
524
+ rescue Exception => e
525
+ logger.debug "Unable to find the compass executable bin path because of this error: #{e.message}"
526
+ gem_bin = nil
527
+ end
528
+
529
+ logger.debug "Path to compass executable: #{gem_bin.inspect}"
530
+
531
+ # return the path the compass executable
532
+ gem_bin
533
+ end
534
+ end
535
+
536
+
430
537
  # --------------------------------------------
431
538
  # Remote File/Directory test tasks
432
539
  # --------------------------------------------
data/lib/ash/drupal.rb CHANGED
@@ -39,6 +39,7 @@ configuration.load do
39
39
  after "deploy", "drupal:symlink"
40
40
  after "drupal:symlink","drupal:protect"
41
41
  after "drupal:symlink", "drupal:clearcache"
42
+ before "drupal:clearcache", "compass"
42
43
  after "deploy", "deploy:cleanup"
43
44
 
44
45
  # --------------------------------------------
@@ -282,4 +283,4 @@ configuration.load do
282
283
  end
283
284
  end
284
285
  end
285
- end
286
+ end
data/lib/ash/magento.rb CHANGED
@@ -21,6 +21,7 @@ configuration.load do
21
21
  # or 'deploy:create_symlink'
22
22
  after "deploy", "magento:symlink"
23
23
  after "magento:symlink", "magento:purge_cache"
24
+ before "magento:purge_cache", "compass"
24
25
 
25
26
  # --------------------------------------------
26
27
  # Overloaded tasks
data/lib/ash/wordpress.rb CHANGED
@@ -23,6 +23,7 @@ configuration.load do
23
23
  # before/after callbacks not firing for 'deploy:symlink'
24
24
  # or 'deploy:create_symlink'
25
25
  after "deploy", "wordpress:symlink"
26
+ after "wordpress:symlink", "compass"
26
27
  after "wordpress:symlink", "ash:fixperms"
27
28
  after "ash:fixperms", "wordpress:protect"
28
29
 
@@ -19,6 +19,7 @@ configuration.load do
19
19
  # before/after callbacks not firing for 'deploy:symlink'
20
20
  # or 'deploy:create_symlink'
21
21
  after "deploy", "zend:symlink"
22
+ after "zend:symlink", "compass"
22
23
  after "deploy", "deploy:cleanup"
23
24
 
24
25
  # --------------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-ash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-01 00:00:00.000000000 Z
12
+ date: 2013-02-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: August Ash recipes for Capistrano
15
15
  email: code@augustash.com