zenv 1.0.1 → 1.1.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +17 -1
- data/lib/zenv.rb +12 -4
- data/zenv.gemspec +3 -3
- metadata +3 -5
- data/.zenv +0 -8
- data/lib/zenv/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b6d5e7fa1011f7a47d6bfaed16dc6e7b674e425
|
4
|
+
data.tar.gz: 32a72c3c526d584d19bd339100302a2af023a8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d4342c8eaaa362c666988efecfd1f8696a7faa3e3453ebdcd5685a3aa70929c7ba23f7dd98fa3e5c15fed1d0dc22c3ac394057255fd517fc3de4861dd0b93e3
|
7
|
+
data.tar.gz: b45e549d41d2afb61b77a4bbb48d95fbda8c89b49fd52c7100a430afdaba45a8d2f4f9d1c2a0b96892f1d38de615182c8cf73278bdfb5c3d2ad1a7ce3b0322d1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
Simple and flexible approach to loading environment variables.
|
4
4
|
|
5
|
+
**How is this different than Dotenv?**
|
6
|
+
|
7
|
+
* ZEN ENV loads earlier, so there's no special handling needed for Rails apps.
|
8
|
+
* The `.zenv` file is Ruby, which allows for more flexibility.
|
9
|
+
* Env vars should specify the Rails env, not the other way around.
|
10
|
+
* Does not support overrides via multiple `.zenv` files. If you want to share env vars across multiple namespaces, it's Ruby, DRY it up.
|
11
|
+
|
5
12
|
## Status
|
6
13
|
|
7
14
|
[](https://travis-ci.org/austinthecoder/zenv)
|
@@ -24,7 +31,7 @@ Or install it yourself as:
|
|
24
31
|
|
25
32
|
## Usage
|
26
33
|
|
27
|
-
Create a `.zenv` file at the root of your project:
|
34
|
+
Create a `.zenv` or `.zenv.rb` file at the root of your project:
|
28
35
|
|
29
36
|
```ruby
|
30
37
|
{
|
@@ -60,6 +67,15 @@ Specify the namespace in `ZENV`. E.g. `ZENV=other rails console`.
|
|
60
67
|
|
61
68
|
If environment variables need to be loaded _before_ your application is loaded, run the command with `zenv`. For example, if you're running the puma web server and it depends on `PORT`, run `zenv puma`.
|
62
69
|
|
70
|
+
### Test environment
|
71
|
+
|
72
|
+
You probably don't want the default namespace loaded for tests. Create a "test" namespace and put this at the top of your tests (if using RSpec, put it at the top of `spec_helper.rb`):
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
ENV['ZENV'] = 'test'
|
76
|
+
require 'zenv'
|
77
|
+
```
|
78
|
+
|
63
79
|
## Development
|
64
80
|
|
65
81
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/zenv.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
require 'pathname'
|
2
|
-
require "zenv/version"
|
3
2
|
|
4
3
|
module Zenv
|
5
|
-
@
|
4
|
+
@available_pathnames = [
|
5
|
+
Pathname.new('.zenv'),
|
6
|
+
Pathname.new('.zenv.rb'),
|
7
|
+
].freeze
|
6
8
|
|
7
9
|
class << self
|
10
|
+
def version
|
11
|
+
'1.1.0'
|
12
|
+
end
|
13
|
+
|
8
14
|
private
|
9
15
|
|
10
|
-
attr_reader :
|
16
|
+
attr_reader :available_pathnames, :namespace_loaded
|
11
17
|
|
12
18
|
def load
|
13
19
|
namespace = ENV['ZENV']&.to_sym || :default
|
@@ -16,7 +22,9 @@ module Zenv
|
|
16
22
|
warn "[Zenv] skipping #{namespace.inspect}, already loaded #{namespace_loaded.inspect}"
|
17
23
|
end
|
18
24
|
|
19
|
-
|
25
|
+
pathname = available_pathnames.find(&:exist?)
|
26
|
+
|
27
|
+
unless pathname
|
20
28
|
warn "[Zenv] .zenv file not found"
|
21
29
|
return
|
22
30
|
end
|
data/zenv.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'zenv
|
4
|
+
require 'zenv'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "zenv"
|
8
|
-
spec.version = Zenv
|
8
|
+
spec.version = Zenv.version
|
9
9
|
spec.authors = ["Austin Schneider"]
|
10
10
|
spec.email = ["me@austinschneider.com"]
|
11
11
|
|
12
|
-
spec.summary = '
|
12
|
+
spec.summary = 'ZEN ENV'
|
13
13
|
spec.description = 'Simple and flexible approach to loading environment variables.'
|
14
14
|
spec.homepage = 'https://github.com/austinthecoder/zenv'
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zenv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,7 +63,6 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".rspec"
|
65
65
|
- ".travis.yml"
|
66
|
-
- ".zenv"
|
67
66
|
- CHANGELOG.md
|
68
67
|
- Gemfile
|
69
68
|
- README.md
|
@@ -72,7 +71,6 @@ files:
|
|
72
71
|
- bin/setup
|
73
72
|
- exe/zenv
|
74
73
|
- lib/zenv.rb
|
75
|
-
- lib/zenv/version.rb
|
76
74
|
- zenv.gemspec
|
77
75
|
homepage: https://github.com/austinthecoder/zenv
|
78
76
|
licenses: []
|
@@ -96,5 +94,5 @@ rubyforge_project:
|
|
96
94
|
rubygems_version: 2.5.1
|
97
95
|
signing_key:
|
98
96
|
specification_version: 4
|
99
|
-
summary:
|
97
|
+
summary: ZEN ENV
|
100
98
|
test_files: []
|
data/.zenv
DELETED
data/lib/zenv/version.rb
DELETED