Class: Helmsnap::Check
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config) ⇒ Check
constructor
A new instance of Check.
Methods inherited from Service
Constructor Details
#initialize(config) ⇒ Check
Returns a new instance of Check.
4 5 6 7 |
# File 'lib/helmsnap/check.rb', line 4 def initialize(config) super() self.config = config end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/helmsnap/check.rb', line 9 def call temp_dir_path = Pathname.new(Dir.mktmpdir) Helmsnap::Generate.call(config, snapshots_path: temp_dir_path) result = run_cmd("which", "colordiff", allow_failure: true) util = result.success ? "colordiff" : "diff" cmd_parts = [util, "--unified", "--recursive", config.snapshots_path, temp_dir_path] diff = run_cmd(*cmd_parts, allow_failure: true).output diff.strip.empty? ensure FileUtils.rmtree(temp_dir_path) end |