itamae 1.0.0.beta35 → 1.0.0.beta36

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: 604c4ca5d5f163d3da6cb818dee4c5978ce5c3e8
4
- data.tar.gz: a819f6d02d1229fc3cf7c072d080843daaabe348
3
+ metadata.gz: 960d455a8ef4164798f47d7729c12bd9c4dc83c8
4
+ data.tar.gz: 40891f58e09014321c39a2aa4d71ab8110c1ddf4
5
5
  SHA512:
6
- metadata.gz: 6d0c852666278903d4303dab36296cb04247a02aa400f550c842010280ee97fde27d84d0c1b1413e83b16617215728f25fa411a10c8aff2b815611ac3bfcabb7
7
- data.tar.gz: 25b9655e55512fce6d744787d2fd23bc4df68dc40fe5aad22523d4e3347a5a6d9e052900a171b3745c9080694c35ed3def32efec0f8d1a5c0ee897b91b368f6e
6
+ metadata.gz: 3e18a5e27dda2f409432f56b107a655e696ee3b8f5d64d1eca101c683e6ae8cc3d0877dd166c35c341eee167e3d3b6f2442c616a04205b281fdf57d24ab15683
7
+ data.tar.gz: 79eadd9cae38c612f1dcd179aaf0096c3522d6ac6709bdf439c7450f9c943efe3b258845f9091c231acd05ca8e484d2c30a5bb64faaafbbd2f4466e2a371a22e
@@ -60,11 +60,13 @@ module Itamae
60
60
  return
61
61
  end
62
62
 
63
- [action].flatten.each do |action|
63
+ [specific_action || action].flatten.each do |action|
64
64
  @current_action = action
65
65
 
66
66
  Logger.info "action: #{action}"
67
67
 
68
+ next if action == :nothing
69
+
68
70
  unless options[:dry_run]
69
71
  Logger.formatter.indent do
70
72
  Logger.debug "(in pre_action)"
@@ -229,6 +231,16 @@ module Itamae
229
231
  backend.run_command(*args)
230
232
  end
231
233
 
234
+ def check_command(*args)
235
+ unless args.last.is_a?(Hash)
236
+ args << {}
237
+ end
238
+
239
+ args.last[:error] = false
240
+
241
+ run_command(*args).exit_status == 0
242
+ end
243
+
232
244
  def run_specinfra(*args)
233
245
  backend.run_specinfra(*args)
234
246
  end
@@ -76,6 +76,14 @@ module Itamae
76
76
 
77
77
  if run_specinfra(:check_file_is_file, path)
78
78
  run_specinfra(:copy_file, path, "#{path}.bak")
79
+
80
+ unless check_command(["diff", "-q", @temppath, path])
81
+ # the file is modified
82
+ updated!
83
+ end
84
+ else
85
+ # new file
86
+ updated!
79
87
  end
80
88
 
81
89
  run_specinfra(:move_file, @temppath, path)
@@ -1 +1 @@
1
- 1.0.0.beta35
1
+ 1.0.0.beta36
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.0.0.beta35
4
+ version: 1.0.0.beta36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai