ops_team 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/action.rb +14 -0
  3. data/lib/ops.rb +7 -0
  4. data/ops_team.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b9ea41a7031a3b0433fa1dce7a5d6e3acff2a0845df7e614d7348c42decfb17
4
- data.tar.gz: b1914623e6e5990aa695112abdcf094b130fc10235fa4aaa1c03ac8d2ca70d14
3
+ metadata.gz: 39b95630f778d48b40cb40418de7283acb5b5f47aeabe0d01f0580d6b1c93e22
4
+ data.tar.gz: 11c608a31bece6e3785bc94c48277c8b2aa6b9227a80517cd7fc46e18b3d5643
5
5
  SHA512:
6
- metadata.gz: bfb2ac0c3c7da9ea5cfb8113b9557e015739eb7ef7972ecf19c59924171274f28babacd9bba222a852dd0e141ac8b8a8d0bb83bb685c82bb644753b2f7c5c2fa
7
- data.tar.gz: c885476119307be822abbb6a2762ab610094a4373ba701cc07359d17f6209d964fc8a83828b4c5a7a066ca4a6115072d9f94f267a50f0a4e5020d648afcaeac2
6
+ metadata.gz: 2d891bdf8088dfc4d5c709e6cfe57e4d807aa6993630c6dd1d96335749a475266ecee061b93584e086e5f8f7047e9928f448be1b43237d9ef3bae5f1b2af331c
7
+ data.tar.gz: 9c974c476d915087da8752dd0a60236401cc1c058418e42835e196d679ed879c97fb73d82e248be2c625fa6619fca6b9a3915e13fd81cfc56ab521b74938ba33
@@ -36,6 +36,20 @@ class Action
36
36
  @config["skip_#{name}_hooks"]
37
37
  end
38
38
 
39
+ def config_valid?
40
+ config_errors.empty?
41
+ end
42
+
43
+ def config_errors
44
+ @config_errors ||= begin
45
+ errors = []
46
+
47
+ errors << "No 'command' specified in 'action'." unless @config['command']
48
+
49
+ errors
50
+ end
51
+ end
52
+
39
53
  private
40
54
 
41
55
  def load_secrets?
data/lib/ops.rb CHANGED
@@ -19,6 +19,7 @@ require_rel "builtins"
19
19
  # executes commands based on local `ops.yml`
20
20
  class Ops
21
21
  class UnknownActionError < StandardError; end
22
+ class ActionConfigError < StandardError; end
22
23
 
23
24
  CONFIG_FILE = "ops.yml"
24
25
 
@@ -26,6 +27,7 @@ class Ops
26
27
  UNKNOWN_ACTION_EXIT_CODE = 65
27
28
  ERROR_LOADING_APP_CONFIG_EXIT_CODE = 66
28
29
  MIN_VERSION_NOT_MET_EXIT_CODE = 67
30
+ ACTION_CONFIG_ERROR_EXIT_CODE = 68
29
31
 
30
32
  RECOMMEND_HELP_TEXT = "Run 'ops help' for a list of builtins and actions."
31
33
 
@@ -52,6 +54,9 @@ class Ops
52
54
  Output.error(e.to_s)
53
55
  Output.out(RECOMMEND_HELP_TEXT) unless print_did_you_mean
54
56
  exit(UNKNOWN_ACTION_EXIT_CODE)
57
+ rescue ActionConfigError => e
58
+ Output.error("Error(s) running action '#{@action_name}': #{e}")
59
+ exit(ACTION_CONFIG_ERROR_EXIT_CODE)
55
60
  end
56
61
 
57
62
  private
@@ -98,6 +103,8 @@ class Ops
98
103
 
99
104
  return builtin.run if builtin
100
105
 
106
+ raise ActionConfigError, action.config_errors.join("; ") unless action.config_valid?
107
+
101
108
  do_before_action
102
109
  Output.notice("Running '#{action}' from #{CONFIG_FILE} in environment '#{ENV['environment']}'...")
103
110
  action.run
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '0.14.2'
5
+ s.version = '0.14.3'
6
6
  s.authors = [
7
7
  'nickthecook@gmail.com'
8
8
  ]
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: 0.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com