crossroads_capistrano 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "crossroads_capistrano"
6
- s.version = "1.4.5"
6
+ s.version = "1.4.6"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Steve Kenworthy", "Ben Tillman", "Nathan Broadbent"]
9
9
  s.email = ["it_dept@crossroads.org.hk"]
@@ -36,6 +36,9 @@ def needs_ssh_key?; repository.include?("github.com"); end
36
36
  before "deploy:symlink", "deploy:symlink_config"
37
37
  after "deploy:restart", "deploy:cleanup"
38
38
 
39
+ # Deployment tasks that need an after hook to notify hoptoad/newrelic/etc.
40
+ NotificationTasks = ["deploy", "deploy:migrations", "deploy:cold", "deploy:rollback"]
41
+
39
42
 
40
43
  # Misc. Tasks
41
44
  # ---------------------------------------------------------
@@ -5,7 +5,7 @@ namespace :deploy do
5
5
  desc "Notify Hoptoad of the deployment"
6
6
  task :notify_hoptoad, :except => { :no_release => true } do
7
7
  if ARGV.include?("-n")
8
- puts "\n ** Dry run, not notifying hoptoad.\n\n"
8
+ puts "\n ** Dry run, not notifying Hoptoad.\n\n"
9
9
  else
10
10
  begin
11
11
  require 'active_support/core_ext/string'
@@ -36,6 +36,5 @@ namespace :deploy do
36
36
  end
37
37
  end
38
38
 
39
- after "deploy", "deploy:notify_hoptoad"
40
- after "deploy:migrations", "deploy:notify_hoptoad"
39
+ after NotificationTasks, "deploy:notify_hoptoad"
41
40
 
@@ -1,5 +1,3 @@
1
- require File.join(File.dirname(__FILE__), 'prompt')
2
-
3
1
  namespace :ldap do
4
2
  desc "Create the LDAP configuration file"
5
3
  task :config do
@@ -1,13 +1,21 @@
1
- namespace :newrelic do
2
- task :default do
3
- newrelic.yml
4
- end
1
+ require 'new_relic/recipes'
5
2
 
6
- desc "Copy newrelic.yml"
7
- task :yml do
8
- run "ln -sf #{shared_path}/config/newrelic.yml #{release_path}/config/newrelic.yml"
3
+ namespace :deploy do
4
+ desc "Notify New Relic of the deployment"
5
+ task :notify_newrelic, :except => { :no_release => true } do
6
+ if stage.to_s == 'live'
7
+ if File.exists?('config/newrelic.yml')
8
+ if ARGV.include?("-n")
9
+ puts "\n ** Dry run, not notifying New Relic.\n\n"
10
+ else
11
+ newrelic.notice_deployment
12
+ end
13
+ else
14
+ puts "\n !! You need to set up 'config/newrelic.yml'.\n You can copy the shared/config files from a server by running 'cap config:pull'.\n\n"
15
+ end
16
+ end
9
17
  end
10
18
  end
11
19
 
12
- before "deploy:symlink", "newrelic:yml"
20
+ after NotificationTasks, "deploy:notify_newrelic"
13
21
 
@@ -34,8 +34,8 @@ namespace :passenger do
34
34
  desc "Install Passenger"
35
35
  task :install, :roles => :web do
36
36
  install_deps
37
- run "if ! (gem list | grep passenger | grep #{passenger_version}); then gem install passenger --no-rdoc --no-ri --version #{passenger_version} && passenger-install-apache2-module --auto; fi"
38
- sudo "rvm wrapper #{rvm_ruby_string} passenger" if respond_to?(:rvm_ruby_string) # sets up wrapper for passenger so it can find bundler etc...
37
+ passenger_install_cmd = (exists?(:rvm_ruby_string) ? "rvmsudo " : "") << "passenger-install-apache2-module --auto" # sets up ruby wrapper correctly
38
+ run "if ! (gem list | grep passenger | grep #{passenger_version}); then gem install passenger --no-rdoc --no-ri --version #{passenger_version} && #{passenger_install_cmd}; fi"
39
39
  end
40
40
 
41
41
  task :install_deps, :roles => :web do
@@ -43,15 +43,11 @@ namespace :passenger do
43
43
  sudo "rm -rf /etc/httpd/conf.d/ssl.conf"
44
44
  end
45
45
 
46
- desc "Apache config files: uses special variables @DEPLOY_TO@ @IP_ADDR@ @SERVER_NAME@ @PASSENGER_ROOT@ @RUBY_ROOT@"
46
+ desc "Set up Apache and Passenger config files"
47
47
  task :config, :roles => :web do
48
48
  # You can set the following paths from your deploy.rb file, if needed.
49
- unless respond_to?(:httpd_site_conf_path)
50
- httpd_site_conf_path = "/etc/httpd/sites-enabled/010-#{application}-#{stage}.conf"
51
- end
52
- unless respond_to?(:passenger_conf_path)
53
- passenger_conf_path = "/etc/httpd/mods-enabled/passenger.conf"
54
- end
49
+ set :httpd_site_conf_path, "/etc/httpd/sites-enabled/010-#{application}-#{stage}.conf" unless exists?(:httpd_site_conf_path)
50
+ set :passenger_conf_path, "/etc/httpd/mods-enabled/passenger.conf" unless exists?(:passenger_conf_path)
55
51
 
56
52
  if respond_to?(:rvm_ruby_string) # Deploying with RVM
57
53
  ruby_root = "/usr/local/rvm/wrappers/#{rvm_ruby_string}/ruby"
@@ -28,5 +28,5 @@ namespace :deploy do
28
28
  end
29
29
  end
30
30
 
31
- after "deploy", "deploy:revisions"
31
+ after NotificationTasks, "deploy:revisions"
32
32
 
@@ -5,8 +5,8 @@ namespace :rvm do
5
5
  desc "Install rvm"
6
6
  task :install, :roles => :web do
7
7
  install_deps
8
- sudo "if ! (which rvm); then bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) ); fi", :shell => 'sh'
9
- sudo "if ! (rvm list | grep #{rvm_ruby_string}); then rvm install #{rvm_ruby_string}; fi", :shell => 'sh'
8
+ run "if ! [ -e #{rvm_bin_path}/rvm ]; then #{sudo} bash -c \"curl -s https://rvm.beginrescueend.com/install/rvm | bash\"; fi", :shell => 'sh'
9
+ run "if ! (#{rvm_bin_path}/rvm list | grep #{rvm_ruby_string}); then #{sudo} #{rvm_bin_path}/rvm install #{rvm_ruby_string}; fi", :shell => 'sh'
10
10
  end
11
11
 
12
12
  task :install_deps, :roles => :web do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crossroads_capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-05-25 00:00:00.000000000 +08:00
14
+ date: 2011-05-26 00:00:00.000000000 +08:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
  description: A Crossroads Foundation collection of generic capistrano recipes.