itamae 1.10.5 → 1.10.6

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
  SHA256:
3
- metadata.gz: 93fef6667e949b9833a0d5f44b09982bbb0c6415ec44c57baa8e0f27eab322e8
4
- data.tar.gz: b772ed894784fdbb1c739f4b75a6af0bc0adb5a88b009fd87d0dbca8d39e8077
3
+ metadata.gz: 970a26489acd9ea22bf195f85ab44de09e0dcc9a332903b8b5a604eec57369dc
4
+ data.tar.gz: d31dd215ffcc046c7f1f6d3010b304b02797d049ef482c6e16c19d801812fae3
5
5
  SHA512:
6
- metadata.gz: 38cb17e76859562485e7f2520fb6eacafd442b3e73cd30c4b8b1c0bf883f9c838c5d57c9978314a08fde591bfdac6b1ee5d52ad26c40b4374744e8cc22d5d716
7
- data.tar.gz: 16d2e0043cbc92b65882c4d5d3684cd82e60fe09d59f7c30f7e995942475b4bbd74383cde73c4188fc387966a654578d3a540865d65e04e5210d6772c1770a43
6
+ metadata.gz: 879ee326cf3867a88b80d6ea2f4f54e37d62c97834628169e76488439e95a4795e44b80883abe550128452967b633f5bfe772e432aaf7cccaae331a8abc1dd26
7
+ data.tar.gz: e127f11a419f00b80ac3e019d48121972f66f65535d8e16ef92d7f1c627ef75c409c977d812cff7a8a1462febc5941ab77a606a5e2b8ba5f2b5c5a6ccdb1b993
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.5...master)
2
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.6...master)
3
+
4
+ ## v1.10.6
5
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.5...v1.10.6)
6
+
7
+ Improvements
8
+
9
+ - [Don't use `sudo` when `--no-sudo` is passed](https://github.com/itamae-kitchen/itamae/pull/302)
3
10
 
4
11
  ## v1.10.5
5
12
  [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.4...v1.10.5)
@@ -188,7 +188,7 @@ module Itamae
188
188
  end
189
189
 
190
190
  user = options[:user]
191
- if user
191
+ if user && use_sudo?
192
192
  command = "cd ~#{user.shellescape} ; #{command}"
193
193
  command = "sudo -H -u #{user.shellescape} -- #{shell.shellescape} -c #{command.shellescape}"
194
194
  end
@@ -196,6 +196,11 @@ module Itamae
196
196
  command
197
197
  end
198
198
 
199
+ def use_sudo?
200
+ return true unless @options.key?(:sudo)
201
+ !!@options[:sudo]
202
+ end
203
+
199
204
  def shell
200
205
  @options[:shell] || '/bin/sh'
201
206
  end
@@ -1,3 +1,3 @@
1
1
  module Itamae
2
- VERSION = "1.10.5"
2
+ VERSION = "1.10.6"
3
3
  end
@@ -17,38 +17,38 @@ module Itamae
17
17
 
18
18
  describe ".send_file" do
19
19
  context "the source file doesn't exist" do
20
- subject { -> { itamae_backend.send_file("src", "dst") } }
21
- it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "The file 'src' doesn't exist.") }
20
+ subject { itamae_backend.send_file("src", "dst") }
21
+ it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "The file 'src' doesn't exist.") }
22
22
  end
23
23
 
24
24
  context "the source file exist, but it is not a regular file" do
25
25
  before { Dir.mkdir("src") }
26
- subject { -> { itamae_backend.send_file("src", "dst") } }
27
- it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a file.") }
26
+ subject { itamae_backend.send_file("src", "dst") }
27
+ it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a file.") }
28
28
  end
29
29
 
30
30
  context "the source file is a regular file" do
31
31
  before { FileUtils.touch("src") }
32
- subject { -> { itamae_backend.send_file("src", "dst") } }
32
+ subject { itamae_backend.send_file("src", "dst") }
33
33
  it { expect { subject }.not_to raise_error }
34
34
  end
35
35
  end
36
36
 
37
37
  describe ".send_directory" do
38
38
  context "the source directory doesn't exist" do
39
- subject { -> { itamae_backend.send_directory("src", "dst") } }
40
- it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "The directory 'src' doesn't exist.") }
39
+ subject { itamae_backend.send_directory("src", "dst") }
40
+ it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "The directory 'src' doesn't exist.") }
41
41
  end
42
42
 
43
43
  context "the source directory exist, but it is not a directory" do
44
44
  before { FileUtils.touch("src") }
45
- subject { -> { itamae_backend.send_directory("src", "dst") } }
46
- it { expect(subject).to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a directory.") }
45
+ subject { itamae_backend.send_directory("src", "dst") }
46
+ it { expect{ subject }.to raise_error(Itamae::Backend::SourceNotExistError, "'src' is not a directory.") }
47
47
  end
48
48
 
49
49
  context "the source directory is a directory" do
50
50
  before { Dir.mkdir("src") }
51
- subject { -> { itamae_backend.send_directory("src", "dst") } }
51
+ subject { itamae_backend.send_directory("src", "dst") }
52
52
  it { expect { subject }.not_to raise_error }
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.5
4
+ version: 1.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2019-07-27 00:00:00.000000000 Z
13
+ date: 2019-10-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -329,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  - !ruby/object:Gem::Version
330
330
  version: '0'
331
331
  requirements: []
332
- rubygems_version: 3.0.1
332
+ rubygems_version: 3.0.3
333
333
  signing_key:
334
334
  specification_version: 4
335
335
  summary: Simple Configuration Management Tool