terraspace 0.6.6 → 0.6.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d5645441169b979490b844b27b8a6752b2ddddc05ed058c0b2681e34569a899
4
- data.tar.gz: 2ce13fabc90ca45ba8b7ff89b452d2c210e12420b7ffbbc1c54ee5403d484a81
3
+ metadata.gz: 790cbc55c399a3130eaaaa9e1e3af636a2b182cb28c2ca008e14a48d75883e47
4
+ data.tar.gz: 72d05ffb527f163d2b3be47542b77764ddbc599858e6dde6381058e992bc531c
5
5
  SHA512:
6
- metadata.gz: 7230e3a06fba98b04a487f9005c6ab635560ac912f48489e35b78883908f83194cf83f567a71a6d928aba6a72498d9ebc37e56c0fdeb3b9564b2794b0d0c2e2d
7
- data.tar.gz: 880d907e3366bf7e5af1cd2e2add2646bb44edaf153ee2742cd2f8fc0c3aeb09aed3105d531da0f9aeaa7cbbedf03ae7376e692fca20ca43cebcdf356bc97414
6
+ metadata.gz: a598f6c5e693d42c113a5aac0f4d2e63c41821a2414095ed65415fa6b11ab1636ce48d6a98ada24557c6b685642f1ac420fc9850544bd1cbda80e3de91036d48
7
+ data.tar.gz: f0a0955bbc1f7846e855141514a69b0aaffc81283081a5a90384fb85e4ec7946a65f19fa1dc3ff5df0e7c9f656ac5563fecca2c8a1a1959c83fa29d9daeae4bd
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.6.7] - 2021-05-05
7
+ - [#108](https://github.com/boltops-tools/terraspace/pull/108) provide runner context to terraspace hook
8
+
6
9
  ## [0.6.6] - 2021-04-15
7
10
  - [#101](https://github.com/boltops-tools/terraspace/pull/101) terraspace force-unlock command
8
11
  - [#102](https://github.com/boltops-tools/terraspace/pull/102) fix terraspace all summarized logging
@@ -2,6 +2,17 @@ module Terraspace::Hooks
2
2
  class Runner
3
3
  include Terraspace::Util
4
4
 
5
+ # exposing mod and hook so terraspace hooks have access to them via runner context. IE:
6
+ #
7
+ # class EnvExporter
8
+ # def call(runner)
9
+ # puts "runner.hook #{runner.hook}"
10
+ # end
11
+ # end
12
+ #
13
+ # Docs: http://terraspace.cloud/docs/config/hooks/ruby/#method-argument
14
+ #
15
+ attr_reader :mod, :hook
5
16
  def initialize(mod, hook)
6
17
  @mod, @hook = mod, hook
7
18
  @execute = @hook["execute"]
@@ -12,12 +23,24 @@ module Terraspace::Hooks
12
23
  when String
13
24
  Terraspace::Shell.new(@mod, @execute, exit_on_fail: @hook["exit_on_fail"]).run
14
25
  when -> (e) { e.respond_to?(:public_instance_methods) && e.public_instance_methods.include?(:call) }
15
- @execute.new.call
26
+ executor = @execute.new
16
27
  when -> (e) { e.respond_to?(:call) }
17
- @execute.call
28
+ executor = @execute
18
29
  else
19
30
  logger.warn "WARN: execute option not set for hook: #{@hook.inspect}"
20
31
  end
32
+
33
+ if executor
34
+ meth = executor.method(:call)
35
+ case meth.arity
36
+ when 0
37
+ executor.call # backwards compatibility
38
+ when 1
39
+ executor.call(self)
40
+ else
41
+ raise "The #{executor} call method definition has been more than 1 arguments and is not supported"
42
+ end
43
+ end
21
44
  end
22
45
  end
23
46
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2021-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport