itamae 1.10.6 → 1.10.7

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: 970a26489acd9ea22bf195f85ab44de09e0dcc9a332903b8b5a604eec57369dc
4
- data.tar.gz: d31dd215ffcc046c7f1f6d3010b304b02797d049ef482c6e16c19d801812fae3
3
+ metadata.gz: 14acdfa4894556d3fcf3b3463f869b2e6d67b36897da33d4104d6e0309724117
4
+ data.tar.gz: cfb6529c9da828e28bc3f9b33563333e87e6764e2570301fc604f1bb58b553df
5
5
  SHA512:
6
- metadata.gz: 879ee326cf3867a88b80d6ea2f4f54e37d62c97834628169e76488439e95a4795e44b80883abe550128452967b633f5bfe772e432aaf7cccaae331a8abc1dd26
7
- data.tar.gz: e127f11a419f00b80ac3e019d48121972f66f65535d8e16ef92d7f1c627ef75c409c977d812cff7a8a1462febc5941ab77a606a5e2b8ba5f2b5c5a6ccdb1b993
6
+ metadata.gz: e72d8fd33859995abfe62bbc74f31af2bce16ea7f410b4c9ddef84b1a142a5c92182cf0845bff4043092e571e546cf7e57171c82f73a0ca6d39200d0908d9829
7
+ data.tar.gz: 2cd158d444b8553131c38e5962c674a0a84b3e7f3a13637d1765042bfd896a80767f6bdc53cb467981bd3510e7e165cf19edb713d14b957fc1b4f8ba26210077
@@ -8,13 +8,13 @@ rvm:
8
8
  - 2.4
9
9
  - 2.5
10
10
  - 2.6
11
+ - 2.7
11
12
  - ruby-head
12
13
  bundler_args: "--jobs=4 --retry=3"
13
14
  cache:
14
15
  bundler: true
15
16
 
16
17
  before_install:
17
- - travis_retry gem update --system || travis_retry gem update --system 2.7.8
18
18
  - travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
19
19
 
20
20
  script:
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
- [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.6...master)
2
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.7...master)
3
+
4
+ ## v1.10.7
5
+ [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.6...v1.10.7)
6
+
7
+ Improvements
8
+
9
+ - [Improve `file` resource performance](https://github.com/itamae-kitchen/itamae/pull/310)
3
10
 
4
11
  ## v1.10.6
5
12
  [full changelog](https://github.com/itamae-kitchen/itamae/compare/v1.10.5...v1.10.6)
data/README.md CHANGED
@@ -77,7 +77,7 @@ $ bundle exec rake spec
77
77
 
78
78
  ## Get Involved
79
79
 
80
- - [Join Slack team](https://join.slack.com/t/itamae/shared_invite/enQtNTExNTI3ODM1NTY5LTM5MWJlZTgwODE0YTUwMThiNzZjN2I1MGNlZjE2NjlmNzg5NTNlOTliMDhkNDNmNTQ2ZTgwMzZjNjI5NDJiZGI)
80
+ - [Join Slack team](https://itamae-slackin.herokuapp.com)
81
81
 
82
82
  ## Presentations / Articles
83
83
 
data/Rakefile CHANGED
@@ -81,3 +81,4 @@ namespace :spec do
81
81
  end
82
82
  end
83
83
 
84
+ task :default => :spec
@@ -9,6 +9,10 @@ module Itamae
9
9
  define_attribute :group, type: String
10
10
  define_attribute :block, type: Proc, default: proc {}
11
11
 
12
+ class << self
13
+ attr_accessor :sha256sum_available
14
+ end
15
+
12
16
  def pre_action
13
17
  current.exist = run_specinfra(:check_file_is_file, attributes.path)
14
18
 
@@ -27,6 +31,11 @@ module Itamae
27
31
  end
28
32
  end
29
33
 
34
+ if exists_and_not_modified?
35
+ attributes.modified = false
36
+ return
37
+ end
38
+
30
39
  send_tempfile
31
40
  compare_file
32
41
  end
@@ -133,6 +142,19 @@ module Itamae
133
142
  end
134
143
  end
135
144
 
145
+ def exists_and_not_modified?
146
+ return false unless current.exist && sha256sum_available?
147
+
148
+ current_digest = run_command(["sha256sum", attributes.path]).stdout.split(/\s/, 2).first
149
+ digest = if content_file
150
+ Digest::SHA256.file(content_file).hexdigest
151
+ else
152
+ Digest::SHA256.hexdigest(attributes.content.to_s)
153
+ end
154
+
155
+ current_digest == digest
156
+ end
157
+
136
158
  def show_content_diff
137
159
  if attributes.modified
138
160
  Itamae.logger.info "diff:"
@@ -194,6 +216,12 @@ module Itamae
194
216
  f.unlink if f
195
217
  end
196
218
  end
219
+
220
+ def sha256sum_available?
221
+ return self.class.sha256sum_available unless self.class.sha256sum_available.nil?
222
+
223
+ self.class.sha256sum_available = run_command(["sha256sum", "--version"], error: false).exit_status == 0
224
+ end
197
225
  end
198
226
  end
199
227
  end
@@ -1,3 +1,3 @@
1
1
  module Itamae
2
- VERSION = "1.10.6"
2
+ VERSION = "1.10.7"
3
3
  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.6
4
+ version: 1.10.7
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-10-09 00:00:00.000000000 Z
13
+ date: 2020-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor