bun_bun_bundle 0.1.1 → 0.1.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: 0147bb8b129e07166e23ff072f9584d494d0b0e19a23683801eb219c9261a44d
4
- data.tar.gz: 168319c3d11b60be7dbee3cdd25d7a7138278d6ac957497db8c931f8c5e4247e
3
+ metadata.gz: c51a065b214293e85467dfdd10f2c84bf763f65fe27d0b549b175ea7448563bf
4
+ data.tar.gz: f2d86b5d3650797b617fa3ecee6d3dac119d97850749bc830172bfa12cb83dfe
5
5
  SHA512:
6
- metadata.gz: 6738f2d988e2e3cf5b7b0a0ca74c978f9b1859bd0fafa0030327b25b5f5ad186b51df73655a5d5a9bfec8888f265ea646be28a79090dd678fe485acf3d7f5f01
7
- data.tar.gz: b6e160279c5f610cee7fc4c6b5d868b7e320ee648b6810b1dc12c1d999c6e7ae9bc0bb5803e4d288fa6f14ea21bb3247c0f5a6293b58bfb2b537af5df7399afd
6
+ metadata.gz: c87530160b4f6829e32f7fc82c4f0d9180aa13b03089011fdb237d8daa4973453bd9cd074bd0402736f7fcab49e7d40c98f9b7fbb1a094aa07f718cd94ca9ac4
7
+ data.tar.gz: 0cbad61b7eff7af29f38cab146f09941a8f3dbd9354a1c470d36a35f94bbb36484543f7a06ef27e4810f2a1f51becb00026c7206de30e6b0049334cd224127fd
data/README.md CHANGED
@@ -87,21 +87,16 @@ stale asset caching.
87
87
  # config/app.rb
88
88
 
89
89
  require 'bun_bun_bundle/hanami'
90
- ```
91
-
92
- 2. Optionally add the dev cache middleware:
93
-
94
- ```ruby
95
- # config/app.rb
96
90
 
97
91
  module MyApp
98
92
  class App < Hanami::App
93
+ BunBunBundle.setup(root: root)
99
94
  config.middleware.use BunBunBundle::DevCacheMiddleware if Hanami.env?(:development)
100
95
  end
101
96
  end
102
97
  ```
103
98
 
104
- 3. Include the helpers in your views:
99
+ 2. Include the helpers in your views:
105
100
 
106
101
  ```ruby
107
102
  # app/views/helpers.rb
@@ -129,9 +124,7 @@ stale asset caching.
129
124
  ```ruby
130
125
  require 'bun_bun_bundle'
131
126
 
132
- # Configure manually
133
- BunBunBundle.config = BunBunBundle::Config.load(root: __dir__)
134
- BunBunBundle.manifest = BunBunBundle::Manifest.load(root: __dir__)
127
+ BunBunBundle.setup(root: __dir__)
135
128
 
136
129
  # Optionally set a CDN host
137
130
  BunBunBundle.asset_host = 'https://cdn.example.com'
@@ -5,10 +5,11 @@ module BunBunBundle
5
5
  #
6
6
  # Add to your Hanami app's config/app.rb:
7
7
  #
8
- # require "bun_bun_bundle/hanami"
8
+ # require 'bun_bun_bundle/hanami'
9
9
  #
10
10
  # module MyApp
11
11
  # class App < Hanami::App
12
+ # BunBunBundle.setup(root: root)
12
13
  # config.middleware.use BunBunBundle::DevCacheMiddleware if Hanami.env?(:development)
13
14
  # end
14
15
  # end
@@ -25,22 +26,4 @@ module BunBunBundle
25
26
  # end
26
27
  # end
27
28
  #
28
- module HanamiIntegration
29
- def self.setup(root: Dir.pwd)
30
- BunBunBundle.config = Config.load(root: root)
31
-
32
- BunBunBundle.manifest = if BunBunBundle.development?
33
- Manifest.load(root: root)
34
- else
35
- Manifest.load(root: root, retries: 1, delay: 0)
36
- end
37
- end
38
- end
39
- end
40
-
41
- # Auto-setup when loaded in a Hanami app.
42
- if defined?(Hanami)
43
- Hanami::App.after :configure do
44
- BunBunBundle::HanamiIntegration.setup(root: root.to_s)
45
- end
46
29
  end
@@ -13,13 +13,7 @@ module BunBunBundle
13
13
 
14
14
  initializer 'bun_bun_bundle.manifest' do |app|
15
15
  config.after_initialize do
16
- BunBunBundle.config = Config.load(root: app.root.to_s)
17
-
18
- BunBunBundle.manifest = if BunBunBundle.development?
19
- Manifest.load(root: app.root.to_s)
20
- else
21
- Manifest.load(root: app.root.to_s, retries: 1, delay: 0)
22
- end
16
+ BunBunBundle.setup(root: app.root)
23
17
  end
24
18
  end
25
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BunBunBundle
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -36,6 +36,14 @@ module BunBunBundle
36
36
  environment == 'production'
37
37
  end
38
38
 
39
+ # Loads config and manifest. Call this from Hanami's config/app.rb or
40
+ # any Rack app's startup.
41
+ def setup(root: Dir.pwd)
42
+ self.config = Config.load(root: root.to_s)
43
+ options = development? ? {} : { retries: 1, delay: 0 }
44
+ self.manifest = Manifest.load(root: root.to_s, **options)
45
+ end
46
+
39
47
  # Returns the path to the bundled JS files shipped with the gem.
40
48
  def bun_path
41
49
  File.expand_path('bun', __dir__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bun_bun_bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wout Fierens