ops_team 1.9.1 → 1.11.0.pre.rc3
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/common/up_down.rb +68 -0
- data/lib/builtins/countdown.rb +2 -0
- data/lib/builtins/down.rb +4 -42
- data/lib/builtins/env.rb +2 -0
- data/lib/builtins/envdiff.rb +2 -0
- data/lib/builtins/exec.rb +1 -0
- data/lib/builtins/help.rb +2 -0
- data/lib/builtins/init.rb +7 -3
- data/lib/builtins/up.rb +4 -48
- data/lib/builtins/version.rb +2 -0
- data/lib/dependencies/custom.rb +1 -3
- data/lib/runner.rb +2 -0
- data/ops_team.gemspec +3 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 643d86e6366ca29ee4d7368f9e913c0fad16fe3625e0480287936bb82a794f73
|
4
|
+
data.tar.gz: 8718e8d67b671d59f7252f0e59cd0aee15dfc1d458bf505609bd5a659330e6bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b86e7520a99816668db2fa5e57bb1b5a667f5b486f1d58ad01cc8b3612ec40fee7ee7764f2242fc5b24472d132b9a69bc324a09d050890e69905d309c49191
|
7
|
+
data.tar.gz: c20a44ba9ec6fdebf3d951513b17d9c7f2fac5e15ff08dd816894c460aa6520801c3de7e15b23187c400072a9c1e347261c63aea39e645df6d0d4de0c9df2a16
|
data/bin/ops
CHANGED
@@ -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/countdown.rb
CHANGED
data/lib/builtins/down.rb
CHANGED
@@ -3,50 +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(@config["dependencies"])
|
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
|
9
|
+
class Down < Common::UpDown
|
10
|
+
def handle_dependency(dependency)
|
11
|
+
dependency.unmeet
|
50
12
|
end
|
51
13
|
end
|
52
14
|
end
|
data/lib/builtins/env.rb
CHANGED
data/lib/builtins/envdiff.rb
CHANGED
data/lib/builtins/exec.rb
CHANGED
data/lib/builtins/help.rb
CHANGED
data/lib/builtins/init.rb
CHANGED
@@ -21,10 +21,14 @@ module Builtins
|
|
21
21
|
def run
|
22
22
|
if File.exist?(OPS_YML)
|
23
23
|
Output.error("File '#{OPS_YML} exists; not initializing.")
|
24
|
-
|
25
|
-
|
26
|
-
FileUtils.cp(template_path, OPS_YML)
|
24
|
+
|
25
|
+
return false
|
27
26
|
end
|
27
|
+
|
28
|
+
Output.out("Creating '#{OPS_YML} from template...")
|
29
|
+
FileUtils.cp(template_path, OPS_YML)
|
30
|
+
|
31
|
+
true
|
28
32
|
rescue SystemCallError
|
29
33
|
Output.error(template_not_found_message)
|
30
34
|
exit 1
|
data/lib/builtins/up.rb
CHANGED
@@ -3,57 +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
|
-
# TODO: return a success/failure status to the caller
|
20
|
-
meet_dependencies
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def dependency_handler
|
26
|
-
Helpers::DependencyHandler.new(deps_to_meet)
|
27
|
-
end
|
28
|
-
|
29
|
-
def meet_dependencies
|
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?
|
33
|
-
|
34
|
-
Output.status("[#{dependency.type}] #{dependency.name}")
|
35
|
-
|
36
|
-
meet_dependency(dependency)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def meet_dependency(dependency)
|
41
|
-
# TODO: make this simpler, and factor in `should_meet?` above, too
|
42
|
-
dependency.meet if !dependency.met? || dependency.always_act?
|
43
|
-
|
44
|
-
if dependency.success?
|
45
|
-
Output.okay
|
46
|
-
else
|
47
|
-
Output.failed
|
48
|
-
Output.error("Error meeting #{dependency.type} dependency '#{dependency.name}':")
|
49
|
-
Output.out(dependency.output)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def deps_to_meet
|
54
|
-
return @config["dependencies"] if @args.empty?
|
55
|
-
|
56
|
-
return @config["dependencies"].select { |dep, names| @args.include?(dep) }
|
10
|
+
class Up < Common::UpDown
|
11
|
+
def handle_dependency(dependency)
|
12
|
+
dependency.meet
|
57
13
|
end
|
58
14
|
end
|
59
15
|
end
|
data/lib/builtins/version.rb
CHANGED
data/lib/dependencies/custom.rb
CHANGED
@@ -39,11 +39,9 @@ module Dependencies
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def parse_definition
|
42
|
-
return @definition, {} if @definition.is_a?(String)
|
43
42
|
return @definition.first if @definition.is_a?(Hash)
|
44
43
|
|
45
|
-
|
46
|
-
"to be a String or a Hash; received #{@definition.class}."
|
44
|
+
[@definition.to_s, {}]
|
47
45
|
end
|
48
46
|
end
|
49
47
|
end
|
data/lib/runner.rb
CHANGED
data/ops_team.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'ops_team'
|
5
|
-
s.version = '1.
|
5
|
+
s.version = '1.11.0-rc3'
|
6
6
|
s.authors = [
|
7
7
|
'nickthecook@gmail.com'
|
8
8
|
]
|
9
|
-
s.date = '2021-
|
9
|
+
s.date = '2021-10-25'
|
10
10
|
s.summary = 'ops_team handles basic automation for your project, driven by self-documenting YAML config'
|
11
11
|
s.homepage = 'https://github.com/nickthecook/ops'
|
12
12
|
s.files = Dir[
|
@@ -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,14 +1,14 @@
|
|
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.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nickthecook@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bcrypt_pbkdf
|
@@ -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
|
@@ -223,9 +224,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
224
|
version: '2.5'
|
224
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
226
|
requirements:
|
226
|
-
- - "
|
227
|
+
- - ">"
|
227
228
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
229
|
+
version: 1.3.1
|
229
230
|
requirements: []
|
230
231
|
rubygems_version: 3.0.3.1
|
231
232
|
signing_key:
|