yyuu-capistrano-chef-solo 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,30 +15,44 @@ module Capistrano
15
15
  _cset(:chef_solo_home) {
16
16
  capture('echo $HOME').strip
17
17
  }
18
- _cset(:chef_solo_version, '10.16.2')
18
+ _cset(:chef_solo_version, '10.16.4')
19
19
  _cset(:chef_solo_path) { File.join(chef_solo_home, 'chef') }
20
20
  _cset(:chef_solo_path_children, %w(bundle cache config cookbooks))
21
21
 
22
- desc("Run chef-solo.")
23
- task(:default) {
22
+ def connect_with_settings()
24
23
  # preserve original :user and :ssh_options
25
- set(:chef_solo_original_user, user)
26
- set(:chef_solo_original_ssh_options, ssh_options)
27
-
24
+ set(:_chef_solo_user, user)
25
+ set(:_chef_solo_ssh_options, ssh_options)
26
+ set(:_chef_solo_rbenv_ruby_version, rbenv_ruby_version)
28
27
  begin
29
28
  # login as chef user if specified
30
29
  set(:user, fetch(:chef_solo_user, user))
31
30
  set(:ssh_options, fetch(:chef_solo_ssh_options, ssh_options))
31
+ set(:rbenv_ruby_version, fetch(:chef_solo_ruby_version, rbenv_ruby_version))
32
+ yield
33
+ ensure
34
+ # restore original :user and :ssh_options
35
+ set(:user, _chef_solo_user)
36
+ set(:ssh_options, _chef_solo_ssh_options)
37
+ set(:rbenv_ruby_version, _chef_solo_rbenv_ruby_version)
38
+ end
39
+ end
32
40
 
41
+ desc("Run chef-solo.")
42
+ task(:default) {
43
+ connect_with_settings {
33
44
  transaction {
34
45
  bootstrap
35
46
  update
36
47
  }
37
- ensure
38
- # restore original :user and :ssh_options
39
- set(:user, chef_solo_original_user)
40
- set(:ssh_options, chef_solo_original_ssh_options)
41
- end
48
+ }
49
+ }
50
+
51
+ desc("Show version.")
52
+ task(:version) {
53
+ connect_with_settings {
54
+ run("cd #{chef_solo_path} && #{bundle_cmd} exec chef-solo --version")
55
+ }
42
56
  }
43
57
 
44
58
  task(:bootstrap) {
@@ -46,11 +60,7 @@ module Capistrano
46
60
  install_chef
47
61
  }
48
62
 
49
- _cset(:chef_solo_ruby_version) {
50
- rbenv_ruby_version
51
- }
52
63
  task(:install_ruby) {
53
- set(:rbenv_ruby_version, chef_solo_ruby_version)
54
64
  set(:rbenv_use_bundler, true)
55
65
  find_and_execute_task('rbenv:setup')
56
66
  }
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module ChefSolo
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yyuu-capistrano-chef-solo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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: 2012-12-12 00:00:00.000000000 Z
12
+ date: 2013-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -83,3 +83,4 @@ signing_key:
83
83
  specification_version: 3
84
84
  summary: a capistrano recipe to invoke chef-solo.
85
85
  test_files: []
86
+ has_rdoc: