railpack 1.5.0 → 1.6.0

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: 3137ba9f8b5a180b12de2863b51222fecc2b68acd4bbe0d810a5feb8fb57ff0a
4
- data.tar.gz: f353a8bb86d73b30492598a2be5208805a63ef32a819f2fcf5b1540f572c9d07
3
+ metadata.gz: 6d51accf157104ea0b6ab312e0fe50aab958ffabc6d1842eb729bf9427c42372
4
+ data.tar.gz: 97c01c1755ae4b0958419f40ae7d27d4cd81557d6b2bd96fe042e80e00ae50b5
5
5
  SHA512:
6
- metadata.gz: 97c615a83cbed4d7b989dc44e9cb1162923679f7604d661138772cc9b610c95cddbd8d01132a8ea28afe395dfbcfe97da799ed6e48e95952438fdbba4e8c3d3f
7
- data.tar.gz: 4300793b2f4a5739bf2b8f7caeb326be5de647bc831fb9b41544d5e7dc5e4deedb0bfc06453d87319dfb5541d2b57fe234dda1e5a1b9a1d822b1e23c7a952c40
6
+ metadata.gz: 63dbabbba215b0b6b0fe62df1937dd84c94e80ef35527e79dd1c2e1e500a0f4f18df8238183ec3d18d1598f186669af7b9e3b5404e07fb72196edf00ffeac943
7
+ data.tar.gz: d37ff6f15af79b03590604e55ef6a6e3a2ceab65de0f158e06b218c45e168948755e01488994d250ceddce5574e708617e73ad5621a644891eeb13ff05e0dff2
@@ -9,7 +9,6 @@ module Railpack
9
9
  @config = config
10
10
  end
11
11
 
12
- # Common interface all bundlers must implement
13
12
  def build!(args = [])
14
13
  raise NotImplementedError, "#{self.class.name} must implement #build!"
15
14
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Railpack
4
+ # Hook system using Rails-style mattr_accessor patterns
5
+ module Hooks
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ mattr_accessor :error_hooks, default: []
10
+ mattr_accessor :build_start_hooks, default: []
11
+ mattr_accessor :build_complete_hooks, default: []
12
+ end
13
+
14
+ class_methods do
15
+ def on_error(&block)
16
+ error_hooks << block
17
+ end
18
+
19
+ def on_build_start(&block)
20
+ build_start_hooks << block
21
+ end
22
+
23
+ def on_build_complete(&block)
24
+ build_complete_hooks << block
25
+ end
26
+
27
+ def trigger_error(error)
28
+ error_hooks.each { |hook| hook.call(error) }
29
+ end
30
+
31
+ def trigger_build_start(config)
32
+ build_start_hooks.each { |hook| hook.call(config) }
33
+ end
34
+
35
+ def trigger_build_complete(result)
36
+ build_complete_hooks.each { |hook| hook.call(result) }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -128,7 +128,6 @@ module Railpack
128
128
  end
129
129
  end
130
130
 
131
- # Alias for convenience
132
131
  singleton_class.alias_method :enhance, :enhance_assets_precompile
133
132
 
134
133
  private
@@ -1,3 +1,3 @@
1
1
  module Railpack
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
data/test/config_test.rb CHANGED
@@ -173,6 +173,8 @@ class ConfigTest < Minitest::Test
173
173
  Object.const_set(:Rails, Module.new)
174
174
  end
175
175
 
176
+ # Reset any memoized @root and override the method
177
+ rails_module.instance_variable_set(:@root, nil)
176
178
  rails_module.define_singleton_method(:root) { Pathname.new(path) }
177
179
  end
178
180
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 21tycoons LLC
@@ -62,6 +62,7 @@ files:
62
62
  - lib/railpack/bundlers/rollup_bundler.rb
63
63
  - lib/railpack/bundlers/webpack_bundler.rb
64
64
  - lib/railpack/config.rb
65
+ - lib/railpack/hooks.rb
65
66
  - lib/railpack/manager.rb
66
67
  - lib/railpack/manifest.rb
67
68
  - lib/railpack/version.rb