dee_ee 0.99.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 +7 -0
- data/exe/de +47 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a37a8e32f713b6d8b54db4f785d4a2d6dd2f5d9a4adad3ea5047745c95dc303b
|
4
|
+
data.tar.gz: 01fc548a2086375990b887352e777148e12787828770a3a1b014e0bcea7406a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a81cc05e43008cafc37c994add074497d6deee76122c93240e756e1cce1aa3b6450640c20910835b9f8a9acbc0b2f8c06a3af86e6a46c7f62e5bca0ce2827bc
|
7
|
+
data.tar.gz: 00dc665b7136829d74a6c0fe23434a0272e58f658738bd57ea2626129b28605d0e6e6ee79433c3ad78656ac79cc04f02f87f6cb77ee78e08f375c64f01a2c545
|
data/exe/de
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
puts(<<HELP) || exit(1) if ARGV.empty?
|
4
|
+
|
5
|
+
de is a solution to manageme environment variables on development machines.
|
6
|
+
It transverses the parents of the present working directory, concatenates any
|
7
|
+
.env files found, and runs the given command. Optionally set NAME to also load
|
8
|
+
files of the pattern .env.{NAME}
|
9
|
+
|
10
|
+
Usage: de {command}
|
11
|
+
NAME={env name} de {command}
|
12
|
+
|
13
|
+
Precedence order.
|
14
|
+
1) Inline shell variables. eg: "FOO=1 de env | grep FOO" will return 1.
|
15
|
+
2) shell process variables. eg: "export FOO=1"
|
16
|
+
3) $PWD/.env.{NAME}
|
17
|
+
4) $PWD/.env
|
18
|
+
5) $PWD/../.env.{NAME}
|
19
|
+
6) $PWD/../.env
|
20
|
+
7) and so on until the root directory
|
21
|
+
|
22
|
+
Tip: You may want to consider having ".env.local" files and also setting
|
23
|
+
"export NAME=local" in your shell rc file.
|
24
|
+
|
25
|
+
Valid variable formats (anything else will be ignored):
|
26
|
+
|
27
|
+
KEY=value
|
28
|
+
KEY=value with spaces
|
29
|
+
KEY="double quoted
|
30
|
+
multiline
|
31
|
+
value"
|
32
|
+
KEY='single quoted
|
33
|
+
multiline
|
34
|
+
value'
|
35
|
+
HELP
|
36
|
+
|
37
|
+
require 'pathname'
|
38
|
+
env = Pathname.pwd.ascend
|
39
|
+
.reduce([]) {|a, x| a << x.join(".env.#{ENV['NAME']}") << x.join(".env")}
|
40
|
+
.reverse
|
41
|
+
.select(&:exist?)
|
42
|
+
.map(&:read)
|
43
|
+
.join
|
44
|
+
|
45
|
+
regexp = /^(?<a>\w+)=(?:'(?<b>.+?)'|"\g<b>"|\g<b>)$/m
|
46
|
+
ENV.update env.scan(regexp).to_h.merge(ENV.to_h)
|
47
|
+
exec(ENV, *ARGV)
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dee_ee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.99.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kelly Wolf Stannard
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
12
|
+
description: |
|
13
|
+
dotenv allows you to write a file called '.env' that will provide environment
|
14
|
+
variables within that file's directory and subdirectories. This gem provides a
|
15
|
+
de executable to read and inject those env variables to the command.
|
16
|
+
|
17
|
+
usage: $ de {command}
|
18
|
+
email:
|
19
|
+
- kwstannard@gmail.com
|
20
|
+
executables:
|
21
|
+
- de
|
22
|
+
extensions: []
|
23
|
+
extra_rdoc_files: []
|
24
|
+
files:
|
25
|
+
- exe/de
|
26
|
+
homepage: http://github.com/kwstannard/de
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata:
|
30
|
+
allowed_push_host: https://rubygems.org
|
31
|
+
homepage_uri: http://github.com/kwstannard/de
|
32
|
+
source_code_uri: http://github.com/kwstannard/de
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubygems_version: 3.6.7
|
48
|
+
specification_version: 4
|
49
|
+
summary: minimal, unix-style dotenv
|
50
|
+
test_files: []
|