pipe_fitter 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -0
- data/exe/pipe_fitter +0 -97
- data/lib/pipe_fitter/cli.rb +97 -0
- data/lib/pipe_fitter/version.rb +1 -1
- data/lib/pipe_fitter/yaml_loader.rb +2 -0
- data/lib/pipe_fitter.rb +1 -0
- data/pipe_fitter.gemspec +0 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 492dbabc48ad29fbd4fd1fa54b33a93ad360e91f7ab9cb6a16f63bd57205398e
|
4
|
+
data.tar.gz: 88dd6dc7e8473be5c7a76a154d09092a452e29079ad015a91886d5edbc394641
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1790c2db829697f8bfa4deb7485636c3951d34ebdc1a0c25514e294438fa4b406a1b61cc4f9276c559cd54f9b1c451de5a95a7483d5179422ff9ce1b8bbb7b80
|
7
|
+
data.tar.gz: 9455862795ee0e5d92c1195135347edfb13de13f2c60c73503d95863135849854bb4a19a7fad88bf23cad5c28e970476e671faafb28dab4ea921037497a4d9f3
|
data/.github/workflows/test.yml
CHANGED
data/exe/pipe_fitter
CHANGED
@@ -1,102 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "pipe_fitter"
|
4
|
-
require "thor"
|
5
|
-
|
6
|
-
module PipeFitter
|
7
|
-
class Cli < Thor
|
8
|
-
class_option :region, type: :string
|
9
|
-
class_option :profile, type: :string
|
10
|
-
|
11
|
-
desc "export", "Export pipeline definition"
|
12
|
-
option :pipeline_id, type: :string, required: true, aliases: "i"
|
13
|
-
def export
|
14
|
-
puts client.definition(options[:pipeline_id]).to_yaml
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "register DEFINITION_FILE", "Register pipeline"
|
18
|
-
def register(definition_file)
|
19
|
-
id, res = client.register(definition_file)
|
20
|
-
puts id, JSON.pretty_generate(res)
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "diff DEFINITION_FILE", "Show pipeline difference"
|
24
|
-
option :pipeline_id, type: :string, required: true, aliases: "i"
|
25
|
-
option :format, type: :string, default: "color", aliases: "f"
|
26
|
-
def diff(definition_file)
|
27
|
-
puts client.diff(options[:pipeline_id], definition_file, options[:format])
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "update DEFINITION_FILE", "Update pipeline definition"
|
31
|
-
option :pipeline_id, type: :string, required: true, aliases: "i"
|
32
|
-
def update(definition_file)
|
33
|
-
res = client.update(options[:pipeline_id], definition_file)
|
34
|
-
puts JSON.pretty_generate(res)
|
35
|
-
end
|
36
|
-
|
37
|
-
desc "activate", "Activate pipeline"
|
38
|
-
option :pipeline_id, type: :string, required: true, aliases: "i"
|
39
|
-
option :parameter_file, type: :string, required: false, aliases: "p"
|
40
|
-
option :start_timestamp, type: :string, required: false, aliases: "t"
|
41
|
-
def activate
|
42
|
-
t = options[:start_timestamp] ? Time.parse(options[:start_timestamp]) : nil
|
43
|
-
puts client.activate(options[:pipeline_id], options[:parameter_file], t)
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "show", "Show pipeline setting in YAML format"
|
47
|
-
option :parameter_file, type: :string, required: false, aliases: "p"
|
48
|
-
def show(definition_file)
|
49
|
-
puts Pipeline.load_yaml(definition_file).to_yaml
|
50
|
-
end
|
51
|
-
|
52
|
-
desc "find", "Find pipeline besed on name and uniqueId"
|
53
|
-
def find(definition_file)
|
54
|
-
puts client.find_registered(definition_file).to_h.to_json
|
55
|
-
end
|
56
|
-
|
57
|
-
desc "find_diff", "Find pipeline besed on name and uniqueId, show diff"
|
58
|
-
option :format, type: :string, default: "color", aliases: "f"
|
59
|
-
def find_diff(definition_file)
|
60
|
-
p = client.find_registered(definition_file)
|
61
|
-
abort("Pipeline is not registered") if p.nil?
|
62
|
-
puts client.diff(p.id, definition_file, options[:format])
|
63
|
-
puts p.to_h.to_json
|
64
|
-
end
|
65
|
-
|
66
|
-
desc "find_update", "Find pipeline besed on name and uniqueId, update pipeline definition"
|
67
|
-
option :force_update, type: :boolean, aliases: "f"
|
68
|
-
def find_update(definition_file)
|
69
|
-
p = client.find_registered(definition_file)
|
70
|
-
abort("Pipeline is not registered") if p.nil?
|
71
|
-
unless options[:force_update]
|
72
|
-
puts client.diff(p.id, definition_file)
|
73
|
-
print "\nReally update pipeline definition? [y/N] : "
|
74
|
-
abort("Update was canceled") if $stdin.gets.chomp !~ /^y$/i
|
75
|
-
end
|
76
|
-
res = client.update(p.id, definition_file)
|
77
|
-
puts JSON.pretty_generate(res)
|
78
|
-
puts p.to_h.to_json
|
79
|
-
end
|
80
|
-
|
81
|
-
desc "diff_deploy_files DEFINITION_FILE", "Show deploy files differences"
|
82
|
-
option :format, type: :string, default: "color", aliases: "f"
|
83
|
-
def diff_deploy_files(definition_file)
|
84
|
-
client.diff_deploy_files(definition_file, options[:format]).each do |d|
|
85
|
-
puts d
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
desc "upload_deploy_files DEFINITION_FILE", "Upload deploy files"
|
90
|
-
def upload_deploy_files(definition_file)
|
91
|
-
client.upload_deploy_files(definition_file)
|
92
|
-
end
|
93
|
-
|
94
|
-
private
|
95
|
-
|
96
|
-
def client
|
97
|
-
@client ||= DataPipelineClient.new(options)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
4
|
|
102
5
|
PipeFitter::Cli.start
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require "thor"
|
2
|
+
|
3
|
+
module PipeFitter
|
4
|
+
class Cli < Thor
|
5
|
+
class_option :region, type: :string
|
6
|
+
class_option :profile, type: :string
|
7
|
+
|
8
|
+
desc "export", "Export pipeline definition"
|
9
|
+
option :pipeline_id, type: :string, required: true, aliases: "i"
|
10
|
+
def export
|
11
|
+
puts client.definition(options[:pipeline_id]).to_yaml
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "register DEFINITION_FILE", "Register pipeline"
|
15
|
+
def register(definition_file)
|
16
|
+
id, res = client.register(definition_file)
|
17
|
+
puts id, JSON.pretty_generate(res)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "diff DEFINITION_FILE", "Show pipeline difference"
|
21
|
+
option :pipeline_id, type: :string, required: true, aliases: "i"
|
22
|
+
option :format, type: :string, default: "color", aliases: "f"
|
23
|
+
def diff(definition_file)
|
24
|
+
puts client.diff(options[:pipeline_id], definition_file, options[:format])
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "update DEFINITION_FILE", "Update pipeline definition"
|
28
|
+
option :pipeline_id, type: :string, required: true, aliases: "i"
|
29
|
+
def update(definition_file)
|
30
|
+
res = client.update(options[:pipeline_id], definition_file)
|
31
|
+
puts JSON.pretty_generate(res)
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "activate", "Activate pipeline"
|
35
|
+
option :pipeline_id, type: :string, required: true, aliases: "i"
|
36
|
+
option :parameter_file, type: :string, required: false, aliases: "p"
|
37
|
+
option :start_timestamp, type: :string, required: false, aliases: "t"
|
38
|
+
def activate
|
39
|
+
t = options[:start_timestamp] ? Time.parse(options[:start_timestamp]) : nil
|
40
|
+
puts client.activate(options[:pipeline_id], options[:parameter_file], t)
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "show", "Show pipeline setting in YAML format"
|
44
|
+
option :parameter_file, type: :string, required: false, aliases: "p"
|
45
|
+
def show(definition_file)
|
46
|
+
puts Pipeline.load_yaml(definition_file).to_yaml
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "find", "Find pipeline besed on name and uniqueId"
|
50
|
+
def find(definition_file)
|
51
|
+
puts client.find_registered(definition_file).to_h.to_json
|
52
|
+
end
|
53
|
+
|
54
|
+
desc "find_diff", "Find pipeline besed on name and uniqueId, show diff"
|
55
|
+
option :format, type: :string, default: "color", aliases: "f"
|
56
|
+
def find_diff(definition_file)
|
57
|
+
p = client.find_registered(definition_file)
|
58
|
+
abort("Pipeline is not registered") if p.nil?
|
59
|
+
puts client.diff(p.id, definition_file, options[:format])
|
60
|
+
puts p.to_h.to_json
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "find_update", "Find pipeline besed on name and uniqueId, update pipeline definition"
|
64
|
+
option :force_update, type: :boolean, aliases: "f"
|
65
|
+
def find_update(definition_file)
|
66
|
+
p = client.find_registered(definition_file)
|
67
|
+
abort("Pipeline is not registered") if p.nil?
|
68
|
+
unless options[:force_update]
|
69
|
+
puts client.diff(p.id, definition_file)
|
70
|
+
print "\nReally update pipeline definition? [y/N] : "
|
71
|
+
abort("Update was canceled") if $stdin.gets.chomp !~ /^y$/i
|
72
|
+
end
|
73
|
+
res = client.update(p.id, definition_file)
|
74
|
+
puts JSON.pretty_generate(res)
|
75
|
+
puts p.to_h.to_json
|
76
|
+
end
|
77
|
+
|
78
|
+
desc "diff_deploy_files DEFINITION_FILE", "Show deploy files differences"
|
79
|
+
option :format, type: :string, default: "color", aliases: "f"
|
80
|
+
def diff_deploy_files(definition_file)
|
81
|
+
client.diff_deploy_files(definition_file, options[:format]).each do |d|
|
82
|
+
puts d
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
desc "upload_deploy_files DEFINITION_FILE", "Upload deploy files"
|
87
|
+
def upload_deploy_files(definition_file)
|
88
|
+
client.upload_deploy_files(definition_file)
|
89
|
+
end
|
90
|
+
|
91
|
+
private
|
92
|
+
|
93
|
+
def client
|
94
|
+
@client ||= DataPipelineClient.new(options)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/lib/pipe_fitter/version.rb
CHANGED
@@ -12,6 +12,8 @@ module PipeFitter
|
|
12
12
|
def load(filename)
|
13
13
|
@search_path.unshift(Pathname.new(filename).dirname)
|
14
14
|
text = eval_erb(grep_v(filename, /^\s*#/))
|
15
|
+
YAML.load(text, aliases: true) || {}
|
16
|
+
rescue ArgumentError
|
15
17
|
YAML.load(text) || {}
|
16
18
|
rescue Psych::SyntaxError => e
|
17
19
|
text.split("\n").each_with_index do |l, i|
|
data/lib/pipe_fitter.rb
CHANGED
data/pipe_fitter.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipe_fitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masa21kik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -178,20 +178,6 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: pry-byebug
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
181
|
description: PipeFitter is a tool for AWS Data Pipeline.
|
196
182
|
email:
|
197
183
|
- masa21kik@gmail.com
|
@@ -211,6 +197,7 @@ files:
|
|
211
197
|
- bin/setup
|
212
198
|
- exe/pipe_fitter
|
213
199
|
- lib/pipe_fitter.rb
|
200
|
+
- lib/pipe_fitter/cli.rb
|
214
201
|
- lib/pipe_fitter/data_pipeline_client.rb
|
215
202
|
- lib/pipe_fitter/pipeline.rb
|
216
203
|
- lib/pipe_fitter/version.rb
|