ops_team 1.11.0.pre.rc → 1.11.0.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/builtins/common/up_down.rb +68 -0
- data/lib/builtins/down.rb +4 -48
- data/lib/builtins/up.rb +4 -55
- data/ops_team.gemspec +2 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35716d2bf91784127a89404ce9bc1a17b3a2998af4d247a96b530e05dac9ef57
|
4
|
+
data.tar.gz: 6621e93166e7a950f6ce0727ce050ef2b9bd3b71a4ea019ca8a0e57060702f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e028c88f7c61166dde9b13bd759989563bbbbbcf6e965a231f9c3d96027699183aaf0f957bf956c8c14af3f6b8008a05cd38b47f1a743766e67b56206d22202e
|
7
|
+
data.tar.gz: '005046085d18c29d476275dbb2bef159872b495c8bfd963130b46d2d38884d26bef2929ff7340b3a948fda2fd7e666c4a4ad635dcd817082da1bb3b2dbe219a8'
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'require_all'
|
4
|
+
require_rel "../../dependencies"
|
5
|
+
|
6
|
+
require 'builtin'
|
7
|
+
require 'builtins/helpers/dependency_handler'
|
8
|
+
require 'output'
|
9
|
+
|
10
|
+
module Builtins
|
11
|
+
module Common
|
12
|
+
class UpDown < Builtin
|
13
|
+
class << self
|
14
|
+
def description
|
15
|
+
"attempts to meet dependencies listed in ops.yml"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
meet_dependencies
|
21
|
+
|
22
|
+
return true unless fail_on_error?
|
23
|
+
|
24
|
+
deps_to_meet.all?(&:success?)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def meet_dependencies
|
30
|
+
deps_to_meet.each do |dependency|
|
31
|
+
Output.status("[#{dependency.type}] #{dependency.name}")
|
32
|
+
|
33
|
+
meet_dependency(dependency)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def meet_dependency(dependency)
|
38
|
+
handle_dependency(dependency) if !dependency.met? || dependency.always_act?
|
39
|
+
|
40
|
+
if dependency.success?
|
41
|
+
Output.okay
|
42
|
+
else
|
43
|
+
Output.failed
|
44
|
+
Output.error("Error meeting #{dependency.type} dependency '#{dependency.name}':")
|
45
|
+
Output.out(dependency.output)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def deps_to_meet
|
50
|
+
@deps_to_meet ||= dependency_handler.dependencies.select(&:should_meet?)
|
51
|
+
end
|
52
|
+
|
53
|
+
def dependency_handler
|
54
|
+
Helpers::DependencyHandler.new(dependencies)
|
55
|
+
end
|
56
|
+
|
57
|
+
def dependencies
|
58
|
+
return @config["dependencies"] if @args.empty?
|
59
|
+
|
60
|
+
@config["dependencies"].select { |dep, _names| @args.include?(dep) }
|
61
|
+
end
|
62
|
+
|
63
|
+
def fail_on_error?
|
64
|
+
Options.get("up.fail_on_error") || false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/builtins/down.rb
CHANGED
@@ -3,56 +3,12 @@
|
|
3
3
|
require 'require_all'
|
4
4
|
require_rel "../dependencies"
|
5
5
|
|
6
|
-
require '
|
7
|
-
require 'builtins/helpers/dependency_handler'
|
6
|
+
require 'builtins/common/up_down'
|
8
7
|
|
9
8
|
module Builtins
|
10
|
-
class Down <
|
11
|
-
|
12
|
-
|
13
|
-
"stops dependent services listed in ops.yml"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def run
|
18
|
-
# TODO: return a success/failure status to the caller
|
19
|
-
unmeet_dependencies
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def dependency_handler
|
25
|
-
Helpers::DependencyHandler.new(deps_to_meet)
|
26
|
-
end
|
27
|
-
|
28
|
-
def unmeet_dependencies
|
29
|
-
dependency_handler.dependencies.each do |dependency|
|
30
|
-
# don't even output anything for dependencies that shouldn't be considered on this machine
|
31
|
-
next unless dependency.should_meet?
|
32
|
-
|
33
|
-
Output.status("[#{dependency.type}] #{dependency.name}")
|
34
|
-
|
35
|
-
unmeet_dependency(dependency)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def unmeet_dependency(dependency)
|
40
|
-
# TODO: make this simpler, and factor in `should_meet?` above, too
|
41
|
-
dependency.unmeet if dependency.met? || dependency.always_act?
|
42
|
-
|
43
|
-
if dependency.success?
|
44
|
-
Output.okay
|
45
|
-
else
|
46
|
-
Output.failed
|
47
|
-
Output.error("Error unmeeting #{dependency.type} dependency '#{dependency.name}':")
|
48
|
-
Output.out(dependency.output)
|
49
|
-
end
|
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) }
|
9
|
+
class Down < Common::UpDown
|
10
|
+
def handle_dependency(dependency)
|
11
|
+
dependency.unmeet
|
56
12
|
end
|
57
13
|
end
|
58
14
|
end
|
data/lib/builtins/up.rb
CHANGED
@@ -3,64 +3,13 @@
|
|
3
3
|
require 'require_all'
|
4
4
|
require_rel "../dependencies"
|
5
5
|
|
6
|
-
require '
|
7
|
-
require 'builtins/helpers/dependency_handler'
|
6
|
+
require 'builtins/common/up_down'
|
8
7
|
require 'output'
|
9
8
|
|
10
9
|
module Builtins
|
11
|
-
class Up <
|
12
|
-
|
13
|
-
|
14
|
-
"attempts to meet dependencies listed in ops.yml"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def run
|
19
|
-
meet_dependencies
|
20
|
-
|
21
|
-
return true unless fail_on_error?
|
22
|
-
|
23
|
-
deps_to_meet.all?(&:success?)
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def meet_dependencies
|
29
|
-
deps_to_meet.each do |dependency|
|
30
|
-
Output.status("[#{dependency.type}] #{dependency.name}")
|
31
|
-
|
32
|
-
meet_dependency(dependency)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def meet_dependency(dependency)
|
37
|
-
dependency.meet if !dependency.met? || dependency.always_act?
|
38
|
-
|
39
|
-
if dependency.success?
|
40
|
-
Output.okay
|
41
|
-
else
|
42
|
-
Output.failed
|
43
|
-
Output.error("Error meeting #{dependency.type} dependency '#{dependency.name}':")
|
44
|
-
Output.out(dependency.output)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
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
|
57
|
-
return @config["dependencies"] if @args.empty?
|
58
|
-
|
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
|
10
|
+
class Up < Common::UpDown
|
11
|
+
def handle_dependency(dependency)
|
12
|
+
dependency.meet
|
64
13
|
end
|
65
14
|
end
|
66
15
|
end
|
data/ops_team.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ops_team'
|
5
|
-
s.version = '1.11.0-
|
5
|
+
s.version = '1.11.0-rc2'
|
6
6
|
s.authors = [
|
7
7
|
'nickthecook@gmail.com'
|
8
8
|
]
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
'etc/*',
|
17
17
|
'lib/builtins/*',
|
18
18
|
'lib/builtins/helpers/*',
|
19
|
+
'lib/builtins/common/*',
|
19
20
|
'lib/dependencies/*',
|
20
21
|
'lib/dependencies/helpers/*',
|
21
22
|
'loader.rb',
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ops_team
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.0.pre.
|
4
|
+
version: 1.11.0.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- lib/builtin.rb
|
173
173
|
- lib/builtins/background.rb
|
174
174
|
- lib/builtins/background_log.rb
|
175
|
+
- lib/builtins/common/up_down.rb
|
175
176
|
- lib/builtins/countdown.rb
|
176
177
|
- lib/builtins/down.rb
|
177
178
|
- lib/builtins/env.rb
|