eventhub-command 0.8.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +21 -0
- data/README.md +1 -2
- data/lib/deployer.rb +9 -9
- data/lib/deployer/base_deployer.rb +19 -25
- data/lib/deployer/config_deployer.rb +2 -2
- data/lib/deployer/console_deployer.rb +1 -2
- data/lib/deployer/executor.rb +10 -14
- data/lib/deployer/go_deployer.rb +22 -24
- data/lib/deployer/mule_deployer.rb +10 -11
- data/lib/deployer/net_ssh_extension.rb +3 -4
- data/lib/deployer/ruby_deployer.rb +20 -22
- data/lib/deployer/stage.rb +2 -2
- data/lib/eh-commands.rb +10 -10
- data/lib/eh.rb +8 -8
- data/lib/eh/commands/database.rb +11 -13
- data/lib/eh/commands/deploy.rb +25 -38
- data/lib/eh/commands/dump.rb +10 -14
- data/lib/eh/commands/generate.rb +9 -10
- data/lib/eh/commands/package.rb +26 -29
- data/lib/eh/commands/proxy.rb +12 -13
- data/lib/eh/commands/repository.rb +25 -28
- data/lib/eh/commands/stage.rb +8 -8
- data/lib/eh/proxy/proxy.rb +13 -13
- data/lib/eh/proxy/settings/git.rb +0 -1
- data/lib/eh/proxy/settings/shell.rb +1 -3
- data/lib/eh/proxy/settings/svn.rb +11 -16
- data/lib/eh/settings.rb +39 -43
- data/lib/eh/version.rb +1 -1
- data/lib/helper.rb +3 -3
- data/lib/packager.rb +3 -3
- data/lib/packager/go.rb +9 -11
- data/lib/packager/rails.rb +4 -5
- data/lib/packager/ruby.rb +6 -7
- metadata +45 -18
data/lib/eh/settings.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class Eh::Settings
|
2
|
-
|
3
2
|
attr_reader :data, :file
|
4
3
|
|
5
4
|
class Repository
|
@@ -8,31 +7,31 @@ class Eh::Settings
|
|
8
7
|
end
|
9
8
|
|
10
9
|
def url
|
11
|
-
@json[
|
10
|
+
@json["url"]
|
12
11
|
end
|
13
12
|
|
14
13
|
def deploy_username
|
15
|
-
@json[
|
14
|
+
@json["deploy_username"]
|
16
15
|
end
|
17
16
|
|
18
17
|
def deploy_password
|
19
|
-
@json[
|
18
|
+
@json["deploy_password"]
|
20
19
|
end
|
21
20
|
|
22
21
|
def dir
|
23
|
-
@json[
|
22
|
+
@json["dir"]
|
24
23
|
end
|
25
24
|
|
26
25
|
def current?
|
27
|
-
@json[
|
26
|
+
@json["current"]
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
30
|
class Proxy
|
32
31
|
def initialize(json)
|
33
|
-
@name = json[
|
34
|
-
@default = json[
|
35
|
-
@url = json[
|
32
|
+
@name = json["name"]
|
33
|
+
@default = json["default"]
|
34
|
+
@url = json["url"]
|
36
35
|
end
|
37
36
|
attr_reader :name, :url, :default
|
38
37
|
|
@@ -48,13 +47,13 @@ class Eh::Settings
|
|
48
47
|
end
|
49
48
|
|
50
49
|
def default_stage
|
51
|
-
@data[
|
50
|
+
@data["default_stage"] || "development"
|
52
51
|
end
|
53
52
|
|
54
53
|
def initialize(file)
|
55
54
|
@file = file
|
56
55
|
@data = JSON.parse(File.read(file))
|
57
|
-
@data[
|
56
|
+
@data["proxies"] ||= []
|
58
57
|
end
|
59
58
|
|
60
59
|
def self.load(file)
|
@@ -62,7 +61,7 @@ class Eh::Settings
|
|
62
61
|
end
|
63
62
|
|
64
63
|
def write
|
65
|
-
File.open(file,"w") do |f|
|
64
|
+
File.open(file, "w") do |f|
|
66
65
|
f.write(data.to_json)
|
67
66
|
end
|
68
67
|
end
|
@@ -76,94 +75,91 @@ class Eh::Settings
|
|
76
75
|
end
|
77
76
|
|
78
77
|
def repository
|
79
|
-
repositories
|
78
|
+
repositories&.find do |repository|
|
80
79
|
repository.current?
|
81
|
-
end
|
80
|
+
end
|
82
81
|
end
|
83
82
|
|
84
83
|
def repositories
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
if data["repositories"]
|
85
|
+
repos = data["repositories"].map do |json|
|
86
|
+
Eh::Settings::Repository.new(json)
|
87
|
+
end
|
88
|
+
end
|
88
89
|
repos || []
|
89
90
|
end
|
90
91
|
|
91
|
-
|
92
92
|
def proxies
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
if data["proxies"]
|
94
|
+
proxies = data["proxies"].map do |json|
|
95
|
+
Eh::Settings::Proxy.new(json)
|
96
|
+
end
|
97
|
+
end
|
96
98
|
proxies || []
|
97
99
|
end
|
98
100
|
|
99
101
|
def releases_dir(*extra_paths)
|
100
|
-
File.join(repository.dir,
|
102
|
+
File.join(repository.dir, "releases", *extra_paths)
|
101
103
|
end
|
102
104
|
|
103
|
-
|
104
105
|
def rails_release_dir
|
105
|
-
releases_dir(
|
106
|
+
releases_dir("rails")
|
106
107
|
end
|
107
108
|
|
108
109
|
def ruby_release_dir
|
109
|
-
releases_dir(
|
110
|
+
releases_dir("ruby")
|
110
111
|
end
|
111
112
|
|
112
113
|
def go_release_dir
|
113
|
-
releases_dir(
|
114
|
+
releases_dir("go")
|
114
115
|
end
|
115
116
|
|
116
117
|
def ruby_processors_src_dir
|
117
|
-
File.join(repository.dir,
|
118
|
+
File.join(repository.dir, "src", "ruby")
|
118
119
|
end
|
119
120
|
|
120
121
|
def go_processors_src_dir
|
121
|
-
File.join(repository.dir,
|
122
|
-
end
|
123
|
-
|
124
|
-
def rails_src_dir
|
125
|
-
# appears 2 times. What is correct?
|
126
|
-
File.join(repository.dir, 'src', 'rails')
|
122
|
+
File.join(repository.dir, "src", "go", "src", "github.com", "cme-eventhub")
|
127
123
|
end
|
128
124
|
|
129
125
|
def console_source_dir
|
130
|
-
File.join(repository.dir,
|
126
|
+
File.join(repository.dir, "src", "rails", "console")
|
131
127
|
end
|
132
128
|
|
133
129
|
def deployment_dir
|
134
|
-
File.join(repository.dir,
|
130
|
+
File.join(repository.dir, "src", "deployment")
|
135
131
|
end
|
136
132
|
|
137
133
|
def rails_src_dir
|
138
134
|
# appears 2 times. What is correct?
|
139
|
-
File.join(repository.dir,
|
135
|
+
File.join(repository.dir, "src", "rails", "console")
|
140
136
|
end
|
141
137
|
|
142
138
|
def source_config_dir
|
143
|
-
File.join(repository.dir,
|
139
|
+
File.join(repository.dir, "config")
|
144
140
|
end
|
145
141
|
|
146
142
|
def processor_template_repository_url
|
147
|
-
|
143
|
+
"https://github.com/thomis/eventhub-processor-template.git"
|
148
144
|
end
|
149
145
|
|
150
146
|
def package_tmp_dir
|
151
|
-
|
147
|
+
"./tmp"
|
152
148
|
end
|
153
149
|
|
154
150
|
def template_tmp_dir
|
155
|
-
|
151
|
+
"/tmp/eventhub-processor-template/"
|
156
152
|
end
|
157
153
|
|
158
154
|
def deployment_management_files
|
159
|
-
[File.join(deployment_dir,
|
155
|
+
[File.join(deployment_dir, "management", "launcher.rb")]
|
160
156
|
end
|
161
157
|
|
162
158
|
def stages_dir
|
163
|
-
File.join(repository.dir,
|
159
|
+
File.join(repository.dir, "config", "stages")
|
164
160
|
end
|
165
161
|
|
166
162
|
def db_backups_dir
|
167
|
-
File.expand_path(
|
163
|
+
File.expand_path("~/backups")
|
168
164
|
end
|
169
165
|
end
|
data/lib/eh/version.rb
CHANGED
data/lib/helper.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# have a custom error handling
|
2
2
|
# have no "error:"-prefix and all text is red
|
3
|
-
if
|
3
|
+
if respond_to?(:on_error) # to exclude it in rspecs
|
4
4
|
on_error do |exception|
|
5
|
-
|
5
|
+
warn exception.to_s.red
|
6
6
|
false # skip GLI's error handling
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
10
|
# helper method to trim url
|
11
11
|
def trim_url(str)
|
12
|
-
str.sub(%r{^https?:(//|\\\\)}i,
|
12
|
+
str.sub(%r{^https?:(//|\\\\)}i, "")
|
13
13
|
end
|
data/lib/packager.rb
CHANGED
data/lib/packager/go.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Packager::Go
|
2
|
-
|
3
|
-
PLATFORMS = ['linux','windows','darwin']
|
2
|
+
PLATFORMS = ["linux", "windows", "darwin"]
|
4
3
|
|
5
4
|
def initialize(source_dir, destination_dir, include_pattern_string, exclude_pattern_string, platform)
|
6
5
|
@source_dir = Pathname.new(source_dir)
|
@@ -57,11 +56,10 @@ class Packager::Go
|
|
57
56
|
puts " done".green
|
58
57
|
end
|
59
58
|
|
60
|
-
|
61
59
|
def files_to_zip(processor_name)
|
62
60
|
# currently take only the binary and the config folder
|
63
|
-
files = Dir.glob(File.join(processor_source_dir(processor_name),
|
64
|
-
files << File.join(processor_source_dir(processor_name),processor_name)
|
61
|
+
files = Dir.glob(File.join(processor_source_dir(processor_name), "config", "**", "*"))
|
62
|
+
files << File.join(processor_source_dir(processor_name), processor_name)
|
65
63
|
|
66
64
|
files.map do |file|
|
67
65
|
Pathname.new(file)
|
@@ -92,14 +90,14 @@ class Packager::Go
|
|
92
90
|
|
93
91
|
def validate_platforms!
|
94
92
|
unless PLATFORMS.include?(@platform)
|
95
|
-
raise "Given platform [#{@platform}] is not allowed out of [#{PLATFORMS.join(
|
93
|
+
raise "Given platform [#{@platform}] is not allowed out of [#{PLATFORMS.join(", ")}]"
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
99
97
|
def processor_names
|
100
98
|
included_names = existing_processor_names
|
101
99
|
included_names = included_processor_names(included_names)
|
102
|
-
excluded_names
|
100
|
+
excluded_names = excluded_processor_names(included_names)
|
103
101
|
included_names - excluded_names
|
104
102
|
end
|
105
103
|
|
@@ -131,19 +129,19 @@ class Packager::Go
|
|
131
129
|
end
|
132
130
|
|
133
131
|
def include_patterns
|
134
|
-
(include_pattern_string ||
|
132
|
+
(include_pattern_string || "").split(",").map { |part| part.strip }
|
135
133
|
end
|
136
134
|
|
137
135
|
def exclude_patterns
|
138
|
-
(exclude_pattern_string ||
|
136
|
+
(exclude_pattern_string || "").split(",").map { |part| part.strip }
|
139
137
|
end
|
140
138
|
|
141
139
|
def wildcard_pattern?(pattern)
|
142
|
-
pattern.end_with?(
|
140
|
+
pattern.end_with?("*")
|
143
141
|
end
|
144
142
|
|
145
143
|
def wildcard_pattern_match?(pattern, name)
|
146
|
-
wildcard_pattern?(pattern) && name.start_with?(pattern.
|
144
|
+
wildcard_pattern?(pattern) && name.start_with?(pattern.delete("*"))
|
147
145
|
end
|
148
146
|
|
149
147
|
def pattern_match?(pattern, name)
|
data/lib/packager/rails.rb
CHANGED
@@ -5,15 +5,14 @@ class Packager::Rails
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def package
|
8
|
-
|
9
8
|
app_directories.each do |dir|
|
10
9
|
included = files_and_dirs.map do |s|
|
11
10
|
File.join(app_name(dir), s)
|
12
|
-
end.join(
|
11
|
+
end.join(" ")
|
13
12
|
remove_destination_file(dir)
|
14
|
-
cmd = "cd #{File.join(dir,
|
13
|
+
cmd = "cd #{File.join(dir, "..")} && zip -r #{destination_file_name(dir)} #{included} >> /dev/null"
|
15
14
|
ret = system cmd
|
16
|
-
puts "Packaged: #{app_name(dir).blue} to #{destination_file_name(dir)}: #{ret ?
|
15
|
+
puts "Packaged: #{app_name(dir).blue} to #{destination_file_name(dir)}: #{ret ? "OK".green : "ERROR".red}"
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -35,7 +34,7 @@ class Packager::Rails
|
|
35
34
|
end
|
36
35
|
|
37
36
|
def files_and_dirs
|
38
|
-
%w
|
37
|
+
%w[Capfile Gemfile Gemfile.lock README.rdoc Rakefile app bin db lib public spec vendor]
|
39
38
|
end
|
40
39
|
|
41
40
|
def remove_destination_file(dir)
|
data/lib/packager/ruby.rb
CHANGED
@@ -39,10 +39,9 @@ class Packager::Ruby
|
|
39
39
|
puts " done".green
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
42
|
def files_to_zip(processor_name)
|
44
|
-
exclude_directories = %w
|
45
|
-
files = Dir.glob(File.join(processor_source_dir(processor_name),
|
43
|
+
exclude_directories = %w[logs/ log/ exceptions/ pids/ tmp/]
|
44
|
+
files = Dir.glob(File.join(processor_source_dir(processor_name), "**", "{*,.ruby-version}")).select do |name|
|
46
45
|
exclude_directories.none? do |exclude|
|
47
46
|
prefix = File.join(processor_source_dir(processor_name), exclude)
|
48
47
|
name.start_with?(prefix)
|
@@ -116,19 +115,19 @@ class Packager::Ruby
|
|
116
115
|
end
|
117
116
|
|
118
117
|
def include_patterns
|
119
|
-
(include_pattern_string ||
|
118
|
+
(include_pattern_string || "").split(",").map { |part| part.strip }
|
120
119
|
end
|
121
120
|
|
122
121
|
def exclude_patterns
|
123
|
-
(exclude_pattern_string ||
|
122
|
+
(exclude_pattern_string || "").split(",").map { |part| part.strip }
|
124
123
|
end
|
125
124
|
|
126
125
|
def wildcard_pattern?(pattern)
|
127
|
-
pattern.end_with?(
|
126
|
+
pattern.end_with?("*")
|
128
127
|
end
|
129
128
|
|
130
129
|
def wildcard_pattern_match?(pattern, name)
|
131
|
-
wildcard_pattern?(pattern) && name.start_with?(pattern.
|
130
|
+
wildcard_pattern?(pattern) && name.start_with?(pattern.delete("*"))
|
132
131
|
end
|
133
132
|
|
134
133
|
def pattern_match?(pattern, name)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventhub-command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pascal Betz
|
8
8
|
- Thomas Steiner
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -31,28 +31,56 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '13.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '13.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '3.
|
48
|
+
version: '3.10'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
55
|
+
version: '3.10'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: standard
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.1.5
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.1.5
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.21.2
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.21.2
|
56
84
|
- !ruby/object:Gem::Dependency
|
57
85
|
name: gli
|
58
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,28 +101,28 @@ dependencies:
|
|
73
101
|
requirements:
|
74
102
|
- - "~>"
|
75
103
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
104
|
+
version: '2.3'
|
77
105
|
type: :runtime
|
78
106
|
prerelease: false
|
79
107
|
version_requirements: !ruby/object:Gem::Requirement
|
80
108
|
requirements:
|
81
109
|
- - "~>"
|
82
110
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
111
|
+
version: '2.3'
|
84
112
|
- !ruby/object:Gem::Dependency
|
85
113
|
name: net-ssh
|
86
114
|
requirement: !ruby/object:Gem::Requirement
|
87
115
|
requirements:
|
88
116
|
- - "~>"
|
89
117
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
118
|
+
version: '6.1'
|
91
119
|
type: :runtime
|
92
120
|
prerelease: false
|
93
121
|
version_requirements: !ruby/object:Gem::Requirement
|
94
122
|
requirements:
|
95
123
|
- - "~>"
|
96
124
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
125
|
+
version: '6.1'
|
98
126
|
- !ruby/object:Gem::Dependency
|
99
127
|
name: colorize
|
100
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,14 +143,14 @@ dependencies:
|
|
115
143
|
requirements:
|
116
144
|
- - "~>"
|
117
145
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
146
|
+
version: '2.0'
|
119
147
|
type: :runtime
|
120
148
|
prerelease: false
|
121
149
|
version_requirements: !ruby/object:Gem::Requirement
|
122
150
|
requirements:
|
123
151
|
- - "~>"
|
124
152
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
153
|
+
version: '2.0'
|
126
154
|
- !ruby/object:Gem::Dependency
|
127
155
|
name: parseconfig
|
128
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,7 +213,7 @@ homepage: http://github.com/thomis/eventhub-command
|
|
185
213
|
licenses:
|
186
214
|
- MIT
|
187
215
|
metadata: {}
|
188
|
-
post_install_message:
|
216
|
+
post_install_message:
|
189
217
|
rdoc_options: []
|
190
218
|
require_paths:
|
191
219
|
- lib
|
@@ -193,16 +221,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
221
|
requirements:
|
194
222
|
- - ">="
|
195
223
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
224
|
+
version: '2.6'
|
197
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
226
|
requirements:
|
199
227
|
- - ">="
|
200
228
|
- !ruby/object:Gem::Version
|
201
229
|
version: '0'
|
202
230
|
requirements: []
|
203
|
-
|
204
|
-
|
205
|
-
signing_key:
|
231
|
+
rubygems_version: 3.2.17
|
232
|
+
signing_key:
|
206
233
|
specification_version: 4
|
207
234
|
summary: Event Hub Command Line Tool
|
208
235
|
test_files: []
|