capistrano-hivequeen 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  ## If your rubyforge_project name is different, then edit it and comment out
7
7
  ## the sub! line in the Rakefile
8
8
  s.name = 'capistrano-hivequeen'
9
- s.version = '0.4.0'
10
- s.date = '2011-10-04'
9
+ s.version = '0.4.1'
10
+ s.date = '2011-10-05'
11
11
 
12
12
  ## Make sure your summary is short. The description may be as long
13
13
  ## as you like.
@@ -1,24 +1,26 @@
1
- # Symlink shared config files
2
- after "deploy:update_code", "deploy:symlink_shared_config"
3
- namespace :deploy do
4
- desc "[internal] Symlink shared config files to current release"
5
- task :symlink_shared_config do
6
- run "ln -nfs #{shared_path}/config/* #{latest_release}/config"
1
+ Capistrano::Configuration.instance.load do
2
+ # Symlink shared config files
3
+ after "deploy:update_code", "deploy:symlink_shared_config"
4
+ namespace :deploy do
5
+ desc "[internal] Symlink shared config files to current release"
6
+ task :symlink_shared_config do
7
+ run "ln -nfs #{shared_path}/config/* #{latest_release}/config"
8
+ end
7
9
  end
8
- end
9
10
 
10
- desc "Deploy without migrations"
11
- task(:hotfix) { deploy.default }
11
+ desc "Deploy without migrations"
12
+ task(:hotfix) { deploy.default }
12
13
 
13
- namespace :deploy do
14
- desc "[internal] Original Capistrano task. Don't run this."
15
- task :cold do
16
- # Nothing. Use :cold task below
14
+ namespace :deploy do
15
+ desc "[internal] Original Capistrano task. Don't run this."
16
+ task :cold do
17
+ # Nothing. Use :cold task below
18
+ end
17
19
  end
18
- end
19
20
 
20
- desc "Deploy for the first time. Runs setup and deploy:migrations"
21
- task :cold do
22
- setup
23
- deploy.migrations
21
+ desc "Deploy for the first time. Runs setup and deploy:migrations"
22
+ task :cold do
23
+ setup
24
+ deploy.migrations
25
+ end
24
26
  end
@@ -1,19 +1,35 @@
1
1
  # Capistrano tasks for Chef
2
- namespace :deploy do
3
- desc "[internal] Original Capistrano task. Don't run this."
4
- task(:setup) do
5
- # Nothing, run setup task below
2
+
3
+ Capistrano::Configuration.instance.load do
4
+
5
+ # Resets the user for a block
6
+ # Based on http://www.pgrs.net/2008/08/06/switching-users-during-a-capistrano-deploy/
7
+ def as_user(new_user=nil)
8
+ logger.trace "Using the current user account"
9
+ old_user = user
10
+ set :user, new_user
11
+ close_sessions
12
+ yield
13
+ set :user, old_user
14
+ close_sessions
6
15
  end
7
- end
8
16
 
9
- desc "Run chef-client on all servers"
10
- task :setup do
11
- logger.trace "Using the current user account"
12
- orig_user = user
13
- set :user, nil # Use current user account
14
- sudo "chef-client"
17
+ def close_sessions
18
+ sessions.values.each { |session| session.close }
19
+ sessions.clear
20
+ end
15
21
 
16
- # Reset user
17
- logger.trace "Resetting user to #{orig_user}"
18
- set :user, orig_user
22
+ namespace :deploy do
23
+ desc "[internal] Original Capistrano task. Don't run this."
24
+ task(:setup) do
25
+ # Nothing, run setup task below
26
+ end
27
+ end
28
+
29
+ desc "Run chef-client on all servers"
30
+ task :setup do
31
+ as_user do
32
+ sudo "chef-client"
33
+ end
34
+ end
19
35
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-hivequeen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aaron Suggs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-04 00:00:00 -04:00
18
+ date: 2011-10-05 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency