figjam 2.1.0 → 2.2.1

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: f2bdd74d285355760c2cc7e9091fb84667ef5d121ccc92b9a918d26e0384b5d2
4
- data.tar.gz: 2b65309cad65436ece834fe9b809c50aa5f08992cf66173ce57ab7759ec27707
3
+ metadata.gz: f21f8363e6489243d1b2699575890fce89c28353f144feac6ab0987aaad0dd8f
4
+ data.tar.gz: 674224b331b65c0c7a778bf5be413b0189a2186a3e29fc10ec84ad147c5a8bb1
5
5
  SHA512:
6
- metadata.gz: 940cf5491a377bab7bd40c75fbac6259f97b90aeca541cc625b88f4e2b763183fe7b87953b28ac2d4d143dce6125719ea3bf3b5c4780a306f318fa3a79169bd9
7
- data.tar.gz: 14e68610f4d3511f2814bea78e8a549f0db93c1e251b1fb205fd112d1e9315aefc4a870e98f9c8a36661c4f6d22256899c8a68a6da7023abbacdaefd691ad18e
6
+ metadata.gz: 5aa4280564d35e30311e765736bff50ea661e08b69b81baedd5f99452c8465fc4498d152feb82be27d9236918bf71b03091c2e85b8d3f249b59b4f2ffc8d162a
7
+ data.tar.gz: f2ed121a67a57f9669a94ac82daa52919f6faffa051261707eee3f53745e896b4b7728faed64ed558ff32b0a5f949d284b7e80ee83deeb1005de376de133e856
data/README.md CHANGED
@@ -59,15 +59,24 @@ overrides.
59
59
 
60
60
  Figjam is perfect for Rails engines. They can have their own configuration file, and
61
61
  they can be loaded independently or in addition of the main application. To do this,
62
- you can create a `config/application.yml` file in your engine, and add this initializer:
62
+ you can create a `config/application.yml` file in your engine, and add this to the `Rails::Engine`:
63
63
 
64
64
  ```ruby
65
- Figjam::Application.new(
66
- environment: ::Rails.env,
67
- path: File.expand_path("../application.yml", __dir__)
68
- ).load
65
+ require "figjam/rails/engine"
66
+
67
+ module MyEngine
68
+ class Engine < ::Rails::Engine
69
+ Figjam::Rails::Engine.configure(self)
70
+
71
+ # Or if you wish to pass in a specific value for the environment:
72
+ Figjam::Rails::Engine.configure(self, "my_engine_environment")
73
+ end
74
+ end
69
75
  ```
70
76
 
77
+ This will ensure that the engine's configuration is loaded when the Rails application starts, and
78
+ before any other initializers run.
79
+
71
80
  ### Usage without Rails
72
81
 
73
82
  If you are not using Rails, you can load Figjam in your gem. Note, you can
@@ -75,6 +84,8 @@ do this as many times as you like. If you have multiple internal gems, they can
75
84
  all use `figjam` to load their own configuration independently.
76
85
 
77
86
  ```ruby
87
+ require "figjam/application"
88
+
78
89
  Figjam::Application.new(
79
90
  environment: "some_environment_key",
80
91
  path: "#{__dir__}/application.yml"
@@ -0,0 +1,18 @@
1
+ require_relative "../application"
2
+
3
+ module Figjam
4
+ module Rails
5
+ module Engine
6
+ class << self
7
+ def configure(engine_context, environment = ::Rails.env)
8
+ engine_context.config.before_configuration do
9
+ Figjam::Application.new(
10
+ environment: environment,
11
+ path: "#{engine_context.root}/config/application.yml"
12
+ ).load
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/figjam/rails.rb CHANGED
@@ -6,6 +6,7 @@ rescue LoadError
6
6
  # Cater for no Rails
7
7
  else
8
8
  require "figjam/rails/application"
9
+ require "figjam/rails/engine"
9
10
 
10
11
  Figjam.adapter = Figjam::Rails::Application
11
12
  require "figjam/rails/railtie"
@@ -1,3 +1,3 @@
1
1
  module Figjam
2
- VERSION = "2.1.0".freeze
2
+ VERSION = "2.2.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figjam
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Lascelles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-15 00:00:00.000000000 Z
11
+ date: 2025-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -336,6 +336,7 @@ files:
336
336
  - lib/figjam/figaro_alias.rb
337
337
  - lib/figjam/rails.rb
338
338
  - lib/figjam/rails/application.rb
339
+ - lib/figjam/rails/engine.rb
339
340
  - lib/figjam/rails/railtie.rb
340
341
  - lib/figjam/version.rb
341
342
  homepage: https://github.com/hlascelles/figjam