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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf24d85630158410b50202a7ccae33b7faecdd649a4a259aa3a69e5b4d245d1a
4
- data.tar.gz: 494af1f1ba4e0e75544be49cb0adba5b8178dcb17aaeb9fae878cb67b2ac7b92
3
+ metadata.gz: 296e5dabea491580c6f1673cc4f07ab010a3e914fa949532101afe23f5ef2a90
4
+ data.tar.gz: a14f9e7d5b38a9a752f6682a9558c641448344802a993af32a9aad98122acbc8
5
5
  SHA512:
6
- metadata.gz: 31e68329d30149ce528c43f12a1eca82312dc9032b8a4c55d7321cbac32f093b193f87505bbd56f1d09e08e02b93aa274e3b6c7f880293cae70d33c4289e8e09
7
- data.tar.gz: 3d0c41e1a1dd6f36d53a5d020cfd318abfc50405bea0ae9781e82a264d82bc6c2a3e64a4b9abf952e20485b57e9a45e0a417abaceab14adad9c3ef1ed836196d
6
+ metadata.gz: 6654ec92375f8270ddb85f9a9fbc4dcc114b858ac7672fa86d4bcec92cac5fc163157feb4bdfee6a0a73ad15c673ac8337e336f53dd7fc8a85e943d3c2dbfd75
7
+ data.tar.gz: 8f1266dfdf10a8b1da48ae7fc37a1baa07c7bcc86b420338e8a5ef962a5f9b6033c1bbdea233df36137fc4e2c09cfb3bfb7f61863dceaa5220d5769eaad46e5d
data/bin/ops CHANGED
@@ -28,4 +28,4 @@ end
28
28
  require_relative "../loader"
29
29
  require 'ops'
30
30
 
31
- Ops.new(ARGV, config_file: options[:file]).run
31
+ exit Ops.new(ARGV, config_file: options[:file]).run
@@ -25,6 +25,8 @@ module Builtins
25
25
  timer_task.shutdown if task_complete?
26
26
  end
27
27
  Output.out("\rCountdown complete after #{sleep_seconds}s.")
28
+
29
+ true
28
30
  end
29
31
 
30
32
  private
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(@config["dependencies"])
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
- private
21
+ return true unless fail_on_error?
24
22
 
25
- def dependency_handler
26
- Helpers::DependencyHandler.new(deps_to_meet)
23
+ deps_to_meet.all?(&:success?)
27
24
  end
28
25
 
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?
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
- return @config["dependencies"].select { |dep, names| @args.include?(dep) }
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
@@ -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
- # this dependency is just a custom, idempotent command
14
- execute(name)
24
+ execute(up_command) if up_command
15
25
  end
16
26
 
17
27
  def unmeet
18
- true
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
@@ -9,7 +9,9 @@ require 'environment'
9
9
 
10
10
  class Runner
11
11
  class UnknownActionError < StandardError; end
12
+
12
13
  class ActionConfigError < StandardError; end
14
+
13
15
  class NotAllowedInEnvError < StandardError; end
14
16
 
15
17
  def initialize(action_name, args, config, config_path)
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.8.0'
5
+ s.version = '1.11.0-rc'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
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.8.0
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: '0'
228
+ version: 1.3.1
229
229
  requirements: []
230
- rubygems_version: 3.2.22
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