itamae 1.9.3 → 1.9.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: 154b1597ae0505eec08966ce87e4481cebc99291
4
- data.tar.gz: eaed49c1a0352814e22227999385e0668dc99320
3
+ metadata.gz: d6ca877086876cb9043c2ef01b6400e85ed2f69a
4
+ data.tar.gz: 4d9d0142b4bc23876cff279291080f48bf1c07ed
5
5
  SHA512:
6
- metadata.gz: 749602fb374334e832b70aeadbae91dade0aaa0426747dc11394771c1cb4d4f00d78af4f290907659c15307e773c977e0fd7b4d6eaa72536248a9eca757b005d
7
- data.tar.gz: 97c15caa14ea44d38898a2ec44c629a25a499855b5d16553e04fa431cc72dff470b7f8844e0b0fc31aff9d9abae51a8509a3263ec8c243b36b86c95baded7bc6
6
+ metadata.gz: e12647212d06db1104f299fc2e5579cf1063dc720c3c3f662393c06678987800f484b7254a45c655bffa3ee4422048d573f2cba23e6ddc0f6e74cbd23023ed67
7
+ data.tar.gz: c137de18d95c1ff7ddee2aa5110d1cb70c6b2e4e84fea742978df9bfcade9545686e961081b55279850e2aae2ec9519ece157b51401d44fa70f51ecc7433398d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v1.9.4
2
+
3
+ Bugfixes
4
+
5
+ - [Fix a bug that displays inappropriate diff in file deletion (by @takus)](https://github.com/itamae-kitchen/itamae/pull/200)
6
+ - [Show diff on edit action of file resource in dry-run mode. (by @ryotarai)](https://github.com/itamae-kitchen/itamae/pull/197)
7
+ - [Stop to call `chown --reference` and `chmod --reference` (by @yuichiro-naito)](https://github.com/itamae-kitchen/itamae/pull/193)
8
+
1
9
  ## v1.9.3
2
10
 
3
11
  Improvements
@@ -522,10 +530,10 @@ Features
522
530
  Features
523
531
 
524
532
  - New resource `remote_directory` which transfers a directory from local to remote like `remote_file` resource. (by @k0kubun)
525
- - https://github.com/ryotarai/itamae/pull/66
533
+ - https://github.com/itamae-kitchen/itamae/pull/66
526
534
 
527
535
  ## v1.1.0
528
536
 
529
537
  Incompatible changes
530
538
 
531
- - [`uid` and `gid` attributes of `user` resource accept only Integer. (by @ryotarai)](https://github.com/ryotarai/itamae/pull/65)
539
+ - [`uid` and `gid` attributes of `user` resource accept only Integer. (by @eagletmt)](https://github.com/itamae-kitchen/itamae/pull/65)
@@ -12,6 +12,8 @@ module Itamae
12
12
  define_attribute :block, type: Proc, default: proc {}
13
13
 
14
14
  def pre_action
15
+ current.exist = run_specinfra(:check_file_is_file, attributes.path)
16
+
15
17
  case @current_action
16
18
  when :create
17
19
  attributes.exist = true
@@ -20,7 +22,7 @@ module Itamae
20
22
  when :edit
21
23
  attributes.exist = true
22
24
 
23
- unless runner.dry_run?
25
+ if !runner.dry_run? || current.exist
24
26
  content = backend.receive_file(attributes.path)
25
27
  attributes.block.call(content)
26
28
  attributes.content = content
@@ -31,8 +33,6 @@ module Itamae
31
33
  end
32
34
 
33
35
  def set_current_attributes
34
- current.exist = run_specinfra(:check_file_is_file, attributes.path)
35
-
36
36
  if current.exist
37
37
  current.mode = run_specinfra(:get_file_mode, attributes.path).stdout.chomp
38
38
  current.owner = run_specinfra(:get_file_owner_user, attributes.path).stdout.chomp
@@ -50,7 +50,7 @@ module Itamae
50
50
 
51
51
  super
52
52
 
53
- if @temppath
53
+ if @temppath && @current_action != :delete
54
54
  compare_file
55
55
  end
56
56
  end
@@ -96,13 +96,17 @@ module Itamae
96
96
  if attributes.mode
97
97
  run_specinfra(:change_file_mode, @temppath, attributes.mode)
98
98
  else
99
- run_command(['chmod', '--reference', attributes.path, @temppath])
99
+ mode = run_specinfra(:get_file_mode, attributes.path).stdout.chomp
100
+ run_specinfra(:change_file_mode, @temppath, mode)
100
101
  end
101
102
 
102
103
  if attributes.owner || attributes.group
103
104
  run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group)
104
105
  else
105
- run_command(['chown', '--reference', attributes.path, @temppath])
106
+ owner = run_specinfra(:get_file_owner_user, attributes.path).stdout.chomp
107
+ group = run_specinfra(:get_file_owner_group, attributes.path).stdout.chomp
108
+ run_specinfra(:change_file_owner, @temppath, owner)
109
+ run_specinfra(:change_file_group, @temppath, group)
106
110
  end
107
111
 
108
112
  unless check_command(["diff", "-q", @temppath, attributes.path])
@@ -1 +1 @@
1
- 1.9.3
1
+ 1.9.4
@@ -208,6 +208,14 @@ describe file('/tmp/file_edit_sample') do
208
208
  it { should be_grouped_into "itamae2" }
209
209
  end
210
210
 
211
+ describe file('/tmp/file_edit_keeping_mode_owner') do
212
+ it { should be_file }
213
+ its(:content) { should eq("Hello, Itamae") }
214
+ it { should be_mode 444 }
215
+ it { should be_owned_by "itamae" }
216
+ it { should be_grouped_into "itamae" }
217
+ end
218
+
211
219
  describe file('/home/itamae2') do
212
220
  it { should be_directory }
213
221
  it { should be_owned_by "itamae2" }
@@ -364,6 +364,10 @@ end
364
364
 
365
365
  #####
366
366
 
367
+ execute 'echo -n 1 > /tmp/file_edit_notifies' do
368
+ action :nothing
369
+ end
370
+
367
371
  file '/tmp/file_edit_sample' do
368
372
  content 'Hello, world'
369
373
  owner 'itamae'
@@ -382,8 +386,18 @@ file '/tmp/file_edit_sample' do
382
386
  notifies :run, "execute[echo -n 1 > /tmp/file_edit_notifies]"
383
387
  end
384
388
 
385
- execute 'echo -n 1 > /tmp/file_edit_notifies' do
386
- action :nothing
389
+ file '/tmp/file_edit_keeping_mode_owner' do
390
+ content 'Hello, world'
391
+ owner 'itamae'
392
+ group 'itamae'
393
+ mode '444'
394
+ end
395
+
396
+ file '/tmp/file_edit_keeping_mode_owner' do
397
+ action :edit
398
+ block do |content|
399
+ content.gsub!('world', 'Itamae')
400
+ end
387
401
  end
388
402
 
389
403
  ###
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.9.3
4
+ version: 1.9.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: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor