figjam 1.6.2 → 2.0.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: e236e7eb38b51e701dca58eac07605257ec0bc3137350900a121ab0b495f1d23
4
- data.tar.gz: 85c6da2948ff153d87ccca54be070d391b2b5058f905745215af433d27ccadd5
3
+ metadata.gz: 553e785849c51c3e893343d8ce74a05039f66b5629c1049a15430f183d7e03b5
4
+ data.tar.gz: 15daa5db7054cfa6a5e63829307c18725926ade03d7843a9f6c8a808d1020d5a
5
5
  SHA512:
6
- metadata.gz: 58447e8d292762a98f9ff4ae0323eb05c8e49e8856e9ce4650856237f13b4824795742a1edf53a76abc14b7aa2af9512a0b0935b519a376e9c8534799ccd2187
7
- data.tar.gz: 16131be1397a1764bf9f339cd5fbb227a39d5db1b9ccb22d2b40ae7296889a6209e3d5007536f23b8ae88b928d96eefd7686a47d888bde563a604ae66802383a
6
+ metadata.gz: 928a8b0694bfd5511aaeeaed69780b7465550ce02f92df06df1db79f39811a76531950be14ba503f8bdc0c9c73871831ed85a1b2af25ab260c1c7d2566e4965e
7
+ data.tar.gz: 22d5358affb2da7fda4e02c080239fffe933aaff10d6c6bea8dc04aeedca9dbec6eeb2ae49892ae7bc1b3ddbc97875d1635a4de521db9e4703836246ee235684
data/README.md CHANGED
@@ -7,7 +7,6 @@ figjam
7
7
  [![specs workflow](https://github.com/hlascelles/figjam/actions/workflows/specs.yml/badge.svg)](https://github.com/hlascelles/figjam/actions)
8
8
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
9
9
 
10
-
11
10
  Figjam makes it easy to configure ruby and Rails apps `ENV` values by just using a single YAML file.
12
11
 
13
12
  PRs to applications often need to come with default configuration values, but hardcoding these into
data/bin/rspec ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
17
+ load(bundle_binstub)
18
+ else
19
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
20
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
21
+ end
22
+ end
23
+
24
+ require "rubygems"
25
+ require "bundler/setup"
26
+
27
+ load Gem.bin_path("rspec-core", "rspec")
@@ -3,6 +3,8 @@ require "yaml"
3
3
  require "figjam/figaro_alias"
4
4
 
5
5
  module Figjam
6
+ class InvalidKeyNameError < StandardError; end
7
+
6
8
  # :reek:TooManyMethods
7
9
  class Application
8
10
  FIGARO_ENV_PREFIX = "_FIGARO_".freeze
@@ -40,12 +42,18 @@ module Figjam
40
42
 
41
43
  def load
42
44
  each do |key, value|
43
- skip?(key) ? key_skipped(key) : set(key, value)
45
+ if !valid_key_name?(key)
46
+ invalid_key_name(key)
47
+ elsif skip?(key)
48
+ key_skipped(key)
49
+ else
50
+ set(key, value)
51
+ end
44
52
  end
45
53
  end
46
54
 
47
- def each(&block)
48
- configuration.each(&block)
55
+ def each(&)
56
+ configuration.each(&)
49
57
  end
50
58
 
51
59
  private def default_path
@@ -110,5 +118,13 @@ module Figjam
110
118
  private def key_skipped(key)
111
119
  puts "INFO: Skipping key #{key.inspect}. Already set in ENV."
112
120
  end
121
+
122
+ private def valid_key_name?(key)
123
+ key.to_s == key.to_s.upcase
124
+ end
125
+
126
+ private def invalid_key_name(key)
127
+ raise InvalidKeyNameError, "Environment variable names must be uppercase: #{key.inspect}"
128
+ end
113
129
  end
114
130
  end
@@ -4,7 +4,7 @@ module Figjam
4
4
  private def default_path
5
5
  rails_not_initialized unless ::Rails.root
6
6
 
7
- ::Rails.root.join("config", "application.yml")
7
+ ::Rails.root.join("config/application.yml")
8
8
  end
9
9
 
10
10
  private def default_environment
@@ -1,3 +1,3 @@
1
1
  module Figjam
2
- VERSION = "1.6.2".freeze
2
+ VERSION = "2.0.1".freeze
3
3
  end
data/lib/figjam.rb CHANGED
@@ -6,6 +6,7 @@ require "figjam/error"
6
6
  require "figjam/env"
7
7
  require "figjam/application"
8
8
 
9
+ # :reek:Attribute
9
10
  module Figjam
10
11
  extend self # rubocop:disable Style/ModuleFunction
11
12
 
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: 1.6.2
4
+ version: 2.0.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: 2024-09-10 00:00:00.000000000 Z
11
+ date: 2025-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: base64
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: bundler
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +114,20 @@ dependencies:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: mutex_m
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
103
131
  - !ruby/object:Gem::Dependency
104
132
  name: pry-byebug
105
133
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +226,20 @@ dependencies:
198
226
  - - ">="
199
227
  - !ruby/object:Gem::Version
200
228
  version: '0'
229
+ - !ruby/object:Gem::Dependency
230
+ name: rubocop-rake
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
236
+ type: :development
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ version: '0'
201
243
  - !ruby/object:Gem::Dependency
202
244
  name: rubocop-rspec
203
245
  requirement: !ruby/object:Gem::Requirement
@@ -237,6 +279,7 @@ files:
237
279
  - README.md
238
280
  - bin/figaro
239
281
  - bin/figjam
282
+ - bin/rspec
240
283
  - lib/figaro.rb
241
284
  - lib/figaro/application.rb
242
285
  - lib/figaro/rails.rb
@@ -271,14 +314,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
314
  requirements:
272
315
  - - ">="
273
316
  - !ruby/object:Gem::Version
274
- version: '3.0'
317
+ version: '3.1'
275
318
  required_rubygems_version: !ruby/object:Gem::Requirement
276
319
  requirements:
277
320
  - - ">="
278
321
  - !ruby/object:Gem::Version
279
322
  version: '0'
280
323
  requirements: []
281
- rubygems_version: 3.5.11
324
+ rubygems_version: 3.5.22
282
325
  signing_key:
283
326
  specification_version: 4
284
327
  summary: ENV configuration for ruby using yaml files