helmsnap 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/helmsnap/check.rb +4 -7
- data/lib/helmsnap/command.rb +5 -5
- data/lib/helmsnap/generate.rb +3 -20
- data/lib/helmsnap/runner.rb +4 -5
- data/lib/helmsnap/service.rb +13 -0
- data/lib/helmsnap/setup_dependencies.rb +26 -0
- data/lib/helmsnap/version.rb +1 -1
- data/lib/helmsnap.rb +5 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16b948e025e8c80533fc75ac8d97dc0ff3e4fc4996df3fdf9f8c65957c4dd8a4
|
4
|
+
data.tar.gz: b551e8a5570cedb694e8d19ae9143d9d100eb29c0d4956ed2d02ab2d9c1a8711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f706419bc87c20f4d29baabb8e64678d5565b8ba3c889aefe68f44eaf91b7798e8802fadffd819260f2fea00c98d483a063a1c903f8b31db227bbf903391067c
|
7
|
+
data.tar.gz: a6e48a1928f2af7ff6da52efd48b7578d80143c6ef7866fbcaaeb37bf47cec5cfdb618c3f91a85a2cea40b93415730248a675c2fa3280125b51c4aa893584f6b
|
data/Gemfile.lock
CHANGED
data/lib/helmsnap/check.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Helmsnap::Check
|
4
|
-
def self.call(...)
|
5
|
-
new(...).call
|
6
|
-
end
|
7
|
-
|
3
|
+
class Helmsnap::Check < Helmsnap::Service
|
8
4
|
def initialize(chart_path:, snapshots_path:, values_path:)
|
5
|
+
super()
|
9
6
|
self.chart_path = chart_path
|
10
7
|
self.snapshots_path = snapshots_path
|
11
8
|
self.values_path = values_path
|
@@ -20,11 +17,11 @@ class Helmsnap::Check
|
|
20
17
|
values_path: values_path,
|
21
18
|
)
|
22
19
|
|
23
|
-
result =
|
20
|
+
result = run_cmd("which", "colordiff", allow_failure: true)
|
24
21
|
util = result.success ? "colordiff" : "diff"
|
25
22
|
|
26
23
|
cmd_parts = [util, "--unified", "--recursive", snapshots_path, temp_dir_path]
|
27
|
-
diff =
|
24
|
+
diff = run_cmd(*cmd_parts, allow_failure: true).output
|
28
25
|
|
29
26
|
diff.strip.empty?
|
30
27
|
ensure
|
data/lib/helmsnap/command.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Helmsnap::Command
|
3
|
+
class Helmsnap::Command < Helmsnap::Service
|
4
4
|
Result = Struct.new(:success, :output)
|
5
5
|
|
6
|
-
def self.call(...)
|
7
|
-
new(...).call
|
8
|
-
end
|
9
|
-
|
10
6
|
def initialize(cmd, stdout: $stdout, stderr: $stderr, allow_failure: false)
|
7
|
+
super()
|
11
8
|
self.cmd = cmd
|
12
9
|
self.output = +""
|
13
10
|
self.stdout = stdout
|
@@ -38,6 +35,9 @@ class Helmsnap::Command
|
|
38
35
|
Helmsnap::Console.print(stdout, "\n")
|
39
36
|
Result.new(success, output)
|
40
37
|
end
|
38
|
+
rescue SystemCallError => error
|
39
|
+
handle_error!(error.errno, error.message)
|
40
|
+
Result.new(false, error.message)
|
41
41
|
end
|
42
42
|
|
43
43
|
def handle_error!(exit_status, err_output)
|
data/lib/helmsnap/generate.rb
CHANGED
@@ -1,28 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Helmsnap::Generate
|
4
|
-
def self.call(...)
|
5
|
-
new(...).call
|
6
|
-
end
|
7
|
-
|
3
|
+
class Helmsnap::Generate < Helmsnap::Service
|
8
4
|
def initialize(chart_path:, snapshots_path:, values_path:)
|
5
|
+
super()
|
9
6
|
self.chart_path = chart_path
|
10
7
|
self.snapshots_path = snapshots_path
|
11
8
|
self.values_path = values_path
|
12
9
|
end
|
13
10
|
|
14
11
|
def call
|
15
|
-
|
16
|
-
|
17
|
-
dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
|
18
|
-
run_cmd("helm", "dependency", "update", "--skip-refresh", chart_path.join(dep_path.first))
|
19
|
-
end
|
20
|
-
|
21
|
-
dep_list.scan(%r{(https?://.+?)\t}) do |dep_path|
|
22
|
-
run_cmd("helm", "repo", "add", Digest::MD5.hexdigest(dep_path.first), dep_path.first)
|
23
|
-
end
|
24
|
-
|
25
|
-
run_cmd("helm", "dependency", "update", "--skip-refresh", chart_path)
|
12
|
+
Helmsnap::SetupDependencies.call(chart_path)
|
26
13
|
|
27
14
|
FileUtils.rmtree(snapshots_path)
|
28
15
|
|
@@ -40,8 +27,4 @@ class Helmsnap::Generate
|
|
40
27
|
private
|
41
28
|
|
42
29
|
attr_accessor :chart_path, :snapshots_path, :values_path
|
43
|
-
|
44
|
-
def run_cmd(...)
|
45
|
-
Helmsnap.run_cmd(...)
|
46
|
-
end
|
47
30
|
end
|
data/lib/helmsnap/runner.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Helmsnap::Runner
|
4
|
-
def self.call(...)
|
5
|
-
new(...).call
|
6
|
-
end
|
7
|
-
|
3
|
+
class Helmsnap::Runner < Helmsnap::Service
|
8
4
|
def initialize(args)
|
5
|
+
super()
|
9
6
|
self.args = args.dup
|
10
7
|
end
|
11
8
|
|
12
9
|
def call
|
10
|
+
super()
|
11
|
+
|
13
12
|
parser = Helmsnap::ArgsParser.new(args)
|
14
13
|
self.options = parser.get_options!
|
15
14
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Helmsnap::SetupDependencies < Helmsnap::Service
|
4
|
+
def initialize(chart_path)
|
5
|
+
super()
|
6
|
+
self.chart_path = Pathname.new(chart_path)
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
dep_list = run_cmd("helm", "dependency", "list", "--max-col-width", 0, chart_path).output
|
11
|
+
|
12
|
+
dep_list.scan(%r{file://(.+?)\t}) do |dep_path|
|
13
|
+
run_cmd("helm", "dependency", "update", "--skip-refresh", chart_path.join(dep_path.first))
|
14
|
+
end
|
15
|
+
|
16
|
+
dep_list.scan(%r{(https?://.+?)\t}) do |dep_path|
|
17
|
+
run_cmd("helm", "repo", "add", Digest::MD5.hexdigest(dep_path.first), dep_path.first)
|
18
|
+
end
|
19
|
+
|
20
|
+
run_cmd("helm", "dependency", "update", "--skip-refresh", chart_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_accessor :chart_path
|
26
|
+
end
|
data/lib/helmsnap/version.rb
CHANGED
data/lib/helmsnap.rb
CHANGED
@@ -11,13 +11,16 @@ require "tmpdir"
|
|
11
11
|
require "colorized_string"
|
12
12
|
|
13
13
|
module Helmsnap
|
14
|
+
require_relative "helmsnap/service"
|
15
|
+
require_relative "helmsnap/version"
|
16
|
+
|
14
17
|
require_relative "helmsnap/args_parser"
|
15
18
|
require_relative "helmsnap/check"
|
16
|
-
require_relative "helmsnap/console"
|
17
19
|
require_relative "helmsnap/command"
|
20
|
+
require_relative "helmsnap/console"
|
18
21
|
require_relative "helmsnap/generate"
|
19
22
|
require_relative "helmsnap/runner"
|
20
|
-
require_relative "helmsnap/
|
23
|
+
require_relative "helmsnap/setup_dependencies"
|
21
24
|
|
22
25
|
class Error < StandardError; end
|
23
26
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helmsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Smirnov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -66,6 +66,8 @@ files:
|
|
66
66
|
- lib/helmsnap/console.rb
|
67
67
|
- lib/helmsnap/generate.rb
|
68
68
|
- lib/helmsnap/runner.rb
|
69
|
+
- lib/helmsnap/service.rb
|
70
|
+
- lib/helmsnap/setup_dependencies.rb
|
69
71
|
- lib/helmsnap/version.rb
|
70
72
|
homepage: https://github.com/tycooon/helmsnap
|
71
73
|
licenses:
|