ops_team 1.8.0 → 1.11.0.pre.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ops +1 -1
- data/lib/builtins/countdown.rb +2 -0
- data/lib/builtins/down.rb +7 -1
- data/lib/builtins/up.rb +18 -11
- data/lib/dependencies/custom.rb +30 -4
- data/lib/runner.rb +2 -0
- data/ops_team.gemspec +1 -1
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296e5dabea491580c6f1673cc4f07ab010a3e914fa949532101afe23f5ef2a90
|
4
|
+
data.tar.gz: a14f9e7d5b38a9a752f6682a9558c641448344802a993af32a9aad98122acbc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6654ec92375f8270ddb85f9a9fbc4dcc114b858ac7672fa86d4bcec92cac5fc163157feb4bdfee6a0a73ad15c673ac8337e336f53dd7fc8a85e943d3c2dbfd75
|
7
|
+
data.tar.gz: 8f1266dfdf10a8b1da48ae7fc37a1baa07c7bcc86b420338e8a5ef962a5f9b6033c1bbdea233df36137fc4e2c09cfb3bfb7f61863dceaa5220d5769eaad46e5d
|
data/bin/ops
CHANGED
data/lib/builtins/countdown.rb
CHANGED
data/lib/builtins/down.rb
CHANGED
@@ -22,7 +22,7 @@ module Builtins
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def dependency_handler
|
25
|
-
Helpers::DependencyHandler.new(
|
25
|
+
Helpers::DependencyHandler.new(deps_to_meet)
|
26
26
|
end
|
27
27
|
|
28
28
|
def unmeet_dependencies
|
@@ -48,5 +48,11 @@ module Builtins
|
|
48
48
|
Output.out(dependency.output)
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
def deps_to_meet
|
53
|
+
return @config["dependencies"] if @args.empty?
|
54
|
+
|
55
|
+
return @config["dependencies"].select { |dep, names| @args.include?(dep) }
|
56
|
+
end
|
51
57
|
end
|
52
58
|
end
|
data/lib/builtins/up.rb
CHANGED
@@ -16,21 +16,17 @@ module Builtins
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
|
-
# TODO: return a success/failure status to the caller
|
20
19
|
meet_dependencies
|
21
|
-
end
|
22
20
|
|
23
|
-
|
21
|
+
return true unless fail_on_error?
|
24
22
|
|
25
|
-
|
26
|
-
Helpers::DependencyHandler.new(deps_to_meet)
|
23
|
+
deps_to_meet.all?(&:success?)
|
27
24
|
end
|
28
25
|
|
29
|
-
|
30
|
-
dependency_handler.dependencies.each do |dependency|
|
31
|
-
# don't even output anything for dependencies that shouldn't be considered on this machine
|
32
|
-
next unless dependency&.should_meet?
|
26
|
+
private
|
33
27
|
|
28
|
+
def meet_dependencies
|
29
|
+
deps_to_meet.each do |dependency|
|
34
30
|
Output.status("[#{dependency.type}] #{dependency.name}")
|
35
31
|
|
36
32
|
meet_dependency(dependency)
|
@@ -38,7 +34,6 @@ module Builtins
|
|
38
34
|
end
|
39
35
|
|
40
36
|
def meet_dependency(dependency)
|
41
|
-
# TODO: make this simpler, and factor in `should_meet?` above, too
|
42
37
|
dependency.meet if !dependency.met? || dependency.always_act?
|
43
38
|
|
44
39
|
if dependency.success?
|
@@ -51,9 +46,21 @@ module Builtins
|
|
51
46
|
end
|
52
47
|
|
53
48
|
def deps_to_meet
|
49
|
+
@deps_to_meet ||= dependency_handler.dependencies.select(&:should_meet?)
|
50
|
+
end
|
51
|
+
|
52
|
+
def dependency_handler
|
53
|
+
Helpers::DependencyHandler.new(dependencies)
|
54
|
+
end
|
55
|
+
|
56
|
+
def dependencies
|
54
57
|
return @config["dependencies"] if @args.empty?
|
55
58
|
|
56
|
-
|
59
|
+
@config["dependencies"].select { |dep, _names| @args.include?(dep) }
|
60
|
+
end
|
61
|
+
|
62
|
+
def fail_on_error?
|
63
|
+
Options.get("up.fail_on_error") || false
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
data/lib/dependencies/custom.rb
CHANGED
@@ -4,18 +4,44 @@ require 'dependency'
|
|
4
4
|
|
5
5
|
module Dependencies
|
6
6
|
class Custom < Dependency
|
7
|
+
class CustomConfigError < StandardError; end
|
8
|
+
|
9
|
+
def initialize(definition)
|
10
|
+
super
|
11
|
+
@definition = definition
|
12
|
+
@name, @config = parse_definition
|
13
|
+
end
|
14
|
+
|
7
15
|
def met?
|
8
|
-
# we always want to try to meet this dependency
|
9
16
|
false
|
10
17
|
end
|
11
18
|
|
19
|
+
def always_act?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
12
23
|
def meet
|
13
|
-
|
14
|
-
execute(name)
|
24
|
+
execute(up_command) if up_command
|
15
25
|
end
|
16
26
|
|
17
27
|
def unmeet
|
18
|
-
|
28
|
+
execute(down_command) if down_command
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def up_command
|
34
|
+
@up_command ||= @definition.is_a?(Hash) ? @config&.dig("up") : name
|
35
|
+
end
|
36
|
+
|
37
|
+
def down_command
|
38
|
+
@down_command ||= @config && @config&.dig("down") || nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def parse_definition
|
42
|
+
return @definition.first if @definition.is_a?(Hash)
|
43
|
+
|
44
|
+
[@definition.to_s, {}]
|
19
45
|
end
|
20
46
|
end
|
21
47
|
end
|
data/lib/runner.rb
CHANGED
data/ops_team.gemspec
CHANGED
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_team
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0.pre.rc
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-05-05 00:00:00.000000000 Z
|
@@ -114,22 +114,22 @@ dependencies:
|
|
114
114
|
name: net-ssh
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '6.1'
|
120
117
|
- - ">="
|
121
118
|
- !ruby/object:Gem::Version
|
122
119
|
version: 6.1.0
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '6.1'
|
123
123
|
type: :runtime
|
124
124
|
prerelease: false
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - "~>"
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: '6.1'
|
130
127
|
- - ">="
|
131
128
|
- !ruby/object:Gem::Version
|
132
129
|
version: 6.1.0
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '6.1'
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: require_all
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,8 +150,8 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.1.6
|
153
|
-
description:
|
154
|
-
email:
|
153
|
+
description:
|
154
|
+
email:
|
155
155
|
executables:
|
156
156
|
- ops
|
157
157
|
extensions: []
|
@@ -212,7 +212,7 @@ homepage: https://github.com/nickthecook/ops
|
|
212
212
|
licenses:
|
213
213
|
- GPL-3.0-only
|
214
214
|
metadata: {}
|
215
|
-
post_install_message:
|
215
|
+
post_install_message:
|
216
216
|
rdoc_options: []
|
217
217
|
require_paths:
|
218
218
|
- lib
|
@@ -223,12 +223,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '2.5'
|
224
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
|
-
- - "
|
226
|
+
- - ">"
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
228
|
+
version: 1.3.1
|
229
229
|
requirements: []
|
230
|
-
rubygems_version: 3.
|
231
|
-
signing_key:
|
230
|
+
rubygems_version: 3.0.3.1
|
231
|
+
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: ops_team handles basic automation for your project, driven by self-documenting
|
234
234
|
YAML config
|