dotenv-beefy 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/run_tests.yml +18 -0
- data/.gitignore +1 -0
- data/README.md +10 -6
- data/dotenv-beefy.gemspec +5 -3
- data/lib/dotenv/beefy/railtie.rb +27 -3
- data/lib/dotenv/beefy/version.rb +1 -1
- metadata +42 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a4c8b463884a8ad3e870e16e30f258433e1c74d798b23b17af69a2c7af3287a
|
4
|
+
data.tar.gz: 1575ec043960938399ef443a2219af3ac40794fb6ed90125cb2f3c2a1c1b967d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b217caf86240a9e053a80483255ff11a74ec54661145a4b055cc6f6d0f6d0519b3e502dc7acdd0d030ee27d3d44c450d5057381b808175801c017087c827d3dc
|
7
|
+
data.tar.gz: 67a3b50aba25540c6bf850a6c9b3de0ca41861e2cc33ece153eb7f34f2ff23703b4a91842d576409738230cdd7cae1843beab835b3c3f20892ede357b3932d7d
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Run RSpec tests
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
env:
|
7
|
+
RAILS_ENV: test
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1.190.0
|
12
|
+
with:
|
13
|
+
# Not needed with a .ruby-version file
|
14
|
+
ruby-version: 3.3.0
|
15
|
+
bundler-cache: true
|
16
|
+
- name: Run tests
|
17
|
+
run: |
|
18
|
+
bundle exec rspec
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -5,12 +5,16 @@
|
|
5
5
|
Similar to dotenv-rails, but better ;)
|
6
6
|
|
7
7
|
## Features
|
8
|
-
Automatically loads dotfiles for environment configuration with the following
|
9
|
-
|
10
|
-
*
|
11
|
-
* .
|
12
|
-
* .
|
13
|
-
* .
|
8
|
+
Automatically loads dotfiles for environment configuration with the following precedence (higher files' values are NOT overwritten by files loaded after).
|
9
|
+
|
10
|
+
* `.env.RAILS_ENV.local` - Local customizations for a given Rails environment (usually not committed to your git repo)
|
11
|
+
* `.env.HOST_FAMILY.local` - Local OS settings for a given OS (usually not committed to your git repo)
|
12
|
+
* `.env.local` - local customizations. NOT loaded when `Rails.env.test?` is true (a [dotenv-rails default](https://github.com/bkeepers/dotenv/blob/master/lib/dotenv/rails.rb#L69))
|
13
|
+
* `.env.RAILS_ENV` - Rails environment settings (ex: development, test, production, etc)
|
14
|
+
* `.env.HOST_FAMILY` - OS settings (ex: darwin, nix, cygwin)
|
15
|
+
* `.env` - Global defaults
|
16
|
+
|
17
|
+
The files listed first will have the final say on what the final values of each ENV variable is set to, so only set the value in `*.local` files if you really want to override it.
|
14
18
|
|
15
19
|
## Installation
|
16
20
|
|
data/dotenv-beefy.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Load all the application environments }
|
13
13
|
spec.description = %q{Load all relevant .env files to boot usable application environment}
|
14
|
-
spec.homepage = ""
|
14
|
+
spec.homepage = "https://github.com/betterup/dotenv-beefy"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'dotenv'
|
23
|
+
spec.add_runtime_dependency 'rails', '>= 5.0'
|
23
24
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1
|
25
|
-
spec.add_development_dependency "rake", "
|
25
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
26
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
27
|
+
spec.add_development_dependency "rspec", ">= 3.4.0"
|
26
28
|
end
|
data/lib/dotenv/beefy/railtie.rb
CHANGED
@@ -3,18 +3,42 @@ require 'rbconfig'
|
|
3
3
|
|
4
4
|
module Dotenv
|
5
5
|
module Beefy
|
6
|
-
class Railtie < Rails::Railtie
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
7
|
config.before_configuration { load_environments }
|
8
8
|
|
9
|
+
# Load environment dotfiles in the following order (e.g. if in "test" environment on "darwin")
|
10
|
+
# 1. .env.test.local
|
11
|
+
# 2. .env.darwin.local
|
12
|
+
# 3. .env.local
|
13
|
+
# 4. .env.test
|
14
|
+
# 5. .env.darwin
|
15
|
+
# 6. .env
|
16
|
+
#
|
17
|
+
# The order matters, because the files loaded first will "lock in" the value for that ENV var.
|
18
|
+
# Dotenv.load memoizes each ENV value, and if the value is set, it cannot be updated later.
|
19
|
+
# If you want to update ENV values as new values come in, you need to use Dotenv.overload(*files)
|
9
20
|
def load_environments
|
10
|
-
files =
|
21
|
+
files = []
|
22
|
+
|
23
|
+
environments.each do |env|
|
24
|
+
files << ".env.#{env}.local"
|
25
|
+
end
|
26
|
+
|
27
|
+
# This is a dotenv-rails convention to ignore `.env.local` in a test environment
|
28
|
+
# @see https://github.com/bkeepers/dotenv/blob/c237d6d6291c898d8affb290b510c7aac49aed71/lib/dotenv/rails.rb#L66-L73
|
29
|
+
files << '.env.local' unless Rails.env.test?
|
30
|
+
|
31
|
+
environments.each do |env|
|
32
|
+
files << ".env.#{env}"
|
33
|
+
end
|
34
|
+
|
11
35
|
files << '.env'
|
36
|
+
|
12
37
|
Dotenv.load(*files)
|
13
38
|
end
|
14
39
|
|
15
40
|
def environments
|
16
41
|
[
|
17
|
-
'local',
|
18
42
|
Rails.env,
|
19
43
|
host_family
|
20
44
|
]
|
data/lib/dotenv/beefy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dotenv-beefy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BetterUp Developers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -24,34 +24,62 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
47
|
+
version: '2.1'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
54
|
+
version: '2.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 12.3.3
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 12.3.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.4.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
82
|
+
version: 3.4.0
|
55
83
|
description: Load all relevant .env files to boot usable application environment
|
56
84
|
email:
|
57
85
|
- developers@betterup.co
|
@@ -59,6 +87,7 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- ".github/workflows/run_tests.yml"
|
62
91
|
- ".gitignore"
|
63
92
|
- ".rspec"
|
64
93
|
- ".travis.yml"
|
@@ -73,11 +102,11 @@ files:
|
|
73
102
|
- lib/dotenv/beefy.rb
|
74
103
|
- lib/dotenv/beefy/railtie.rb
|
75
104
|
- lib/dotenv/beefy/version.rb
|
76
|
-
homepage:
|
105
|
+
homepage: https://github.com/betterup/dotenv-beefy
|
77
106
|
licenses:
|
78
107
|
- MIT
|
79
108
|
metadata: {}
|
80
|
-
post_install_message:
|
109
|
+
post_install_message:
|
81
110
|
rdoc_options: []
|
82
111
|
require_paths:
|
83
112
|
- lib
|
@@ -92,10 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
121
|
- !ruby/object:Gem::Version
|
93
122
|
version: '0'
|
94
123
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
signing_key:
|
124
|
+
rubygems_version: 3.5.1
|
125
|
+
signing_key:
|
98
126
|
specification_version: 4
|
99
127
|
summary: Load all the application environments
|
100
128
|
test_files: []
|
101
|
-
has_rdoc:
|