itamae 1.4.3 → 1.4.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 227dbcf60bef27ebe4fe8ac784778ba216db0ef9
4
- data.tar.gz: a197449bc2efd001cffc643948adce729bee01ae
3
+ metadata.gz: 8bab606a429b8dcf5fcaa424ffc3a9a62c778ef0
4
+ data.tar.gz: 8ee54b6444e9932e3018dbfbd2a0c6cea1781219
5
5
  SHA512:
6
- metadata.gz: 85e3000f94d22b93dc3f1841c9c2c32f02a7e582f547637fcaff3623c8194e07a02211df19b72a7f7c3c7d0548fa692dfdc00bd92fe8253db749ec86e7f2dc4b
7
- data.tar.gz: 34edd65f815cbdb4d5159c9a452c469d1d4b57a035c5db10cae747d9c721e52efc8cc099f4cb337987a25dec86464e6acbf7bea11a2d74acebcde666ac70b605
6
+ metadata.gz: 54c65502fc518537dd3cb0b3c5efcb38373a7489cef722c05cd52ac4ad8e61b7a9b9c768fa900c519be10dc3b2f6abf626617c4937e96365518c3983c8709fed
7
+ data.tar.gz: d1b0d44adbd650e2e8f014d979047bffddfc4062efff750910f5cd7b92c0ae15309112cd39a5846889346695353ce5691ef34eb03de2b6679e2b2e2f917f7526
@@ -1,3 +1,9 @@
1
+ ## v1.4.4
2
+
3
+ Features
4
+
5
+ - `--shell` option for `local`, `ssh` and `docker` subcommands. If it is set, it will be used instead of /bin/sh
6
+
1
7
  ## v1.4.3
2
8
 
3
9
  Bugfixes
@@ -177,18 +177,23 @@ module Itamae
177
177
  user = options[:user]
178
178
  if user
179
179
  command = "cd ~#{user.shellescape} ; #{command}"
180
- command = "sudo -H -u #{user.shellescape} -- /bin/sh -c #{command.shellescape}"
180
+ command = "sudo -H -u #{user.shellescape} -- #{shell.shellescape} -c #{command.shellescape}"
181
181
  end
182
182
 
183
183
  command
184
184
  end
185
+
186
+ def shell
187
+ @options[:shell]
188
+ end
185
189
  end
186
190
 
187
- # TODO: Make Specinfra's backends instanciatable
188
191
  class Local < Base
189
192
  private
190
193
  def create_specinfra_backend
191
- Specinfra::Backend::Exec.new()
194
+ Specinfra::Backend::Exec.new(
195
+ shell: @options[:shell],
196
+ )
192
197
  end
193
198
  end
194
199
 
@@ -200,6 +205,7 @@ module Itamae
200
205
  host: ssh_options[:host_name],
201
206
  disable_sudo: disable_sudo?,
202
207
  ssh_options: ssh_options,
208
+ shell: @options[:shell],
203
209
  )
204
210
  end
205
211
 
@@ -257,6 +263,7 @@ module Itamae
257
263
  Specinfra::Backend::Docker.new(
258
264
  docker_image: @options[:image],
259
265
  docker_container: @options[:container],
266
+ shell: @options[:shell],
260
267
  )
261
268
  end
262
269
  end
@@ -14,12 +14,17 @@ module Itamae
14
14
  Itamae::Logger.formatter.colored = options[:color]
15
15
  end
16
16
 
17
+ def self.define_exec_options
18
+ option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
19
+ option :node_json, type: :string, aliases: ['-j']
20
+ option :node_yaml, type: :string, aliases: ['-y']
21
+ option :dry_run, type: :boolean, aliases: ['-n']
22
+ option :shell, type: :string, default: "/bin/sh"
23
+ option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
24
+ end
25
+
17
26
  desc "local RECIPE [RECIPE...]", "Run Itamae locally"
18
- option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
19
- option :node_json, type: :string, aliases: ['-j']
20
- option :node_yaml, type: :string, aliases: ['-y']
21
- option :dry_run, type: :boolean, aliases: ['-n']
22
- option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
27
+ define_exec_options
23
28
  def local(*recipe_files)
24
29
  if recipe_files.empty?
25
30
  raise "Please specify recipe files."
@@ -29,15 +34,11 @@ module Itamae
29
34
  end
30
35
 
31
36
  desc "ssh RECIPE [RECIPE...]", "Run Itamae via ssh"
32
- option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
33
- option :node_json, type: :string, aliases: ['-j']
34
- option :node_yaml, type: :string, aliases: ['-y']
35
- option :dry_run, type: :boolean, aliases: ['-n']
37
+ define_exec_options
36
38
  option :host, type: :string, aliases: ['-h']
37
39
  option :user, type: :string, aliases: ['-u']
38
40
  option :key, type: :string, aliases: ['-i']
39
41
  option :port, type: :numeric, aliases: ['-p']
40
- option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
41
42
  option :vagrant, type: :boolean, default: false
42
43
  option :ask_password, type: :boolean, default: false
43
44
  option :sudo, type: :boolean, default: true
@@ -54,11 +55,7 @@ module Itamae
54
55
  end
55
56
 
56
57
  desc "docker RECIPE [RECIPE...]", "Create Docker image"
57
- option :dot, type: :string, default: nil, desc: "Only write dependency graph in DOT", banner: "PATH"
58
- option :node_json, type: :string, aliases: ['-j']
59
- option :node_yaml, type: :string, aliases: ['-y']
60
- option :dry_run, type: :boolean, aliases: ['-n']
61
- option :ohai, type: :boolean, default: false, desc: "This option is DEPRECATED and will be inavailable."
58
+ define_exec_options
62
59
  option :image, type: :string, desc: "This option or 'container' option is required."
63
60
  option :container, type: :string, desc: "This option or 'image' option is required."
64
61
  option :tls_verify_peer, type: :boolean, default: true
@@ -133,9 +133,7 @@ module Itamae
133
133
  end
134
134
 
135
135
  [specific_action || attributes.action].flatten.each do |action|
136
- original_attributes = @attributes
137
136
  run_action(action, options)
138
- @attributes = original_attributes
139
137
  end
140
138
 
141
139
  verify unless options[:dry_run]
@@ -169,6 +167,7 @@ module Itamae
169
167
  alias_method :current, :current_attributes
170
168
 
171
169
  def run_action(action, options)
170
+ original_attributes = @attributes # preserve and restore later
172
171
  @current_action = action
173
172
 
174
173
  clear_current_attributes
@@ -200,6 +199,7 @@ module Itamae
200
199
  end
201
200
 
202
201
  @current_action = nil
202
+ @attributes = original_attributes
203
203
  end
204
204
 
205
205
  def clear_current_attributes
@@ -1 +1 @@
1
- 1.4.3
1
+ 1.4.4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor