terraspace 0.6.1 → 0.6.2

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: 16315ba36569198d82f525f079e1416e579a53262f36cc50a3ea0ded4128067e
4
- data.tar.gz: 8c3546c371860f3e4f4a6326113fd5c93cd99f0e0c436f771ebe4dcab3a0e523
3
+ metadata.gz: 02ed3895b8039e7424e31139ce9f8e20c5d4a60142e8d3da64b5a68ce9e52004
4
+ data.tar.gz: 14617bab09a51e8229a209536585b5ff460355ac2c13cef26dd067b37a878cc0
5
5
  SHA512:
6
- metadata.gz: 64ef2db1ea751561446fcc8b6863ce13975a594d25dd9829e7d4c7eae9ba11288e899bca27cfb007465f96ac5c81077841300892e2d9fb920cc465425e05c8a2
7
- data.tar.gz: fd1a9d8da45a996513e43fd139d0826bac58564938df4c2668c28e69a2dc2643cda33fb54d0c272a21e0f735f8d5a558a2af26ac993f9fdd2d8272ea6293f27c
6
+ metadata.gz: 742c92857e31d85b66e7e232b14facd1745d9a35347e4634732670bd0b011937e4e46bcc7157e83cd9db10025a325004a6b391d21688b1e86c3bacf1ff8e429b
7
+ data.tar.gz: c3010333589ed88a15541a563cde963ae6d9e500acf519911966636563dadb9c698db9cb933945bf243d838d45b8c1fdf151f0602c887d9cbea09250069c3fa5
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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.2] - 2021-03-05
7
+ - [#90](https://github.com/boltops-tools/terraspace/pull/90) Boot hooks: new and improved boot hooks interface
8
+ - remove old config.hooks.on_boot
9
+
6
10
  ## [0.6.1] - 2021-03-04
7
11
  - [#89](https://github.com/boltops-tools/terraspace/pull/89) rename option to enable_names.expansion
8
12
 
@@ -29,7 +29,6 @@ module Terraspace
29
29
  config.build.clean_cache = nil # defaults to /full/path/to/.terraspace-cache
30
30
  config.bundle = ActiveSupport::OrderedOptions.new
31
31
  config.bundle.logger = ts_logger
32
- config.hooks = Hooks.new
33
32
  config.init = ActiveSupport::OrderedOptions.new
34
33
  config.init.mode = "auto" # auto, never, always
35
34
  config.log = ActiveSupport::OrderedOptions.new
@@ -1,10 +1,9 @@
1
1
  module Terraspace
2
2
  module Booter
3
3
  def boot
4
+ run_hooks
4
5
  Terraspace::Bundle.require # load plugins
5
6
  load_plugin_default_configs
6
- Terraspace.config # load project config
7
- Terraspace::App::Hooks.run_hook(:on_boot)
8
7
  Terraspace::App::Inits.run_all
9
8
  set_plugin_cache!
10
9
  end
@@ -24,6 +23,23 @@ module Terraspace
24
23
  dir
25
24
  end
26
25
 
26
+ # Special boot hooks run super early, even before plugins are loaded.
27
+ # Useful for setting env vars and other early things.
28
+ #
29
+ # config/boot.rb
30
+ # config/boot/dev.rb
31
+ #
32
+ def run_hooks
33
+ run_hook
34
+ run_hook(Terraspace.env)
35
+ end
36
+
37
+ def run_hook(env=nil)
38
+ name = env ? "boot/#{env}" : "boot"
39
+ path = "#{Terraspace.root}/config/#{name}.rb"
40
+ require path if File.exist?(path)
41
+ end
42
+
27
43
  extend self
28
44
  end
29
45
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
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.1
4
+ version: 0.6.2
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-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -461,7 +461,6 @@ files:
461
461
  - lib/terraspace/all/runner.rb
462
462
  - lib/terraspace/all/summary.rb
463
463
  - lib/terraspace/app.rb
464
- - lib/terraspace/app/hooks.rb
465
464
  - lib/terraspace/app/inits.rb
466
465
  - lib/terraspace/autoloader.rb
467
466
  - lib/terraspace/booter.rb
@@ -1,18 +0,0 @@
1
- class Terraspace::App
2
- class Hooks
3
- class_attribute :hooks
4
- self.hooks = {}
5
-
6
- def on_boot(&block)
7
- self.class.hooks[:on_boot] = block
8
- end
9
-
10
- class << self
11
- def run_hook(name)
12
- name = name.to_sym
13
- hook = hooks[name]
14
- hook.call if hook
15
- end
16
- end
17
- end
18
- end