ops_team 0.12.0 → 0.12.2

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: f4fd4661f8ea9e234bed8f61e205e625a232d301786557ce3c645519885c068a
4
- data.tar.gz: af58d1ede9274d7a1aa884f036bc2dc6b93f7deff66307484bbcaae30806eea9
3
+ metadata.gz: 684c6b13e7c5440f067ed372f28f592fc24616aaeb42284ec30465166bd1ce79
4
+ data.tar.gz: 67ba1850a8f28e7025bc3d179bdb33d6506dffa0c5a94b2aa50fce20e0c20dce
5
5
  SHA512:
6
- metadata.gz: bc505145b87e405a8a714196966ed2652bfd341fa8deec285c12ad6aa5fb07e01eb4797b888bc7ea5b253d90987b335e4fb6d45a5650af09b23fc74bac3086ed
7
- data.tar.gz: 1227db2ce9be14ba4ee5bb1be55750fa6acbe92678a847b9d88a4e19bae6e465909bfa268b1700a73142946f4e0b751a69834630f8e6571860a6b8900403a8da
6
+ metadata.gz: 747a3dfac949e43f25f3ee19b31bb60d9824b25265b5c8d09c0af9f298a514b2fec0fd48cace35c4ebc553847ebd9bf9b6ea246433a5efb51b7c4918bbc39628
7
+ data.tar.gz: 32d665f336d2d31d7189b5bc9569155c00c4d27ba8b2260d282295c3e2664d0ead0729454996275a2d189f446a2afebc9ae6f9f66303d38245e511978ee58b88
@@ -32,6 +32,10 @@ class Action
32
32
  @config["description"]
33
33
  end
34
34
 
35
+ def skip_hooks?(name)
36
+ @config["skip_#{name}_hooks"]
37
+ end
38
+
35
39
  private
36
40
 
37
41
  def load_secrets?
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'output'
4
+
3
5
  class HookHandler
4
6
  class HookConfigError < StandardError; end
5
7
  class HookExecError < StandardError; end
@@ -22,6 +24,7 @@ class HookHandler
22
24
 
23
25
  def execute_hooks(name)
24
26
  hooks(name).each do |hook|
27
+ Output.notice("Running #{name} hook: #{hook}")
25
28
  output, exit_code = Executor.execute(hook)
26
29
 
27
30
  next if exit_code.zero?
data/lib/ops.rb CHANGED
@@ -75,10 +75,12 @@ class Ops
75
75
  end
76
76
 
77
77
  def run_action
78
- do_before_run_action
78
+ do_before_all
79
79
 
80
80
  return builtin.run if builtin
81
81
 
82
+ do_before_action
83
+
82
84
  Output.notice("Running '#{action}' from #{CONFIG_FILE} in environment '#{ENV['environment']}'...")
83
85
  action.run
84
86
  rescue AppConfig::ParsingError => e
@@ -86,10 +88,16 @@ class Ops
86
88
  exit(ERROR_LOADING_APP_CONFIG_EXIT_CODE)
87
89
  end
88
90
 
89
- def do_before_run_action
91
+ def do_before_all
90
92
  environment.set_variables
91
93
  AppConfig.load
92
- hook_handler.do_hooks("before")
94
+ end
95
+
96
+ def do_before_action
97
+ hook_handler.do_hooks("before") unless ENV["OPS_RUNNING"] || action.skip_hooks?("before")
98
+
99
+ # this prevents before hooks from running in ops executed by ops
100
+ ENV["OPS_RUNNING"] = "1"
93
101
  end
94
102
 
95
103
  def hook_handler
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ops_team'
5
- s.version = '0.12.0'
5
+ s.version = '0.12.2'
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.12.0
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - nickthecook@gmail.com