denv 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +7 -0
- data/exe/denv +32 -0
- data/lib/denv.rb +3 -3
- data/lib/denv/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ced7332ac2a27ac268f334af2a886672818f3830
|
4
|
+
data.tar.gz: 1b6ba14c478f1610e173f3a29234a97fe4727bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43b8ddc20ff10804d0f74a4b9b126277191c81e8165caf1517c1a454764959c27fd0953c639e3a9e636cb3cd30550763a8ae6ecf8fefb2ffb0672b3b62164430
|
7
|
+
data.tar.gz: 2f5c62c157b1ca0b0d0a90f5d6dc71ff47d27af32ff863813b79ee5fde20e62684d8445730b357355144b335e9451c676f699910e3ab7df0613f5c35da16b87a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -40,6 +40,13 @@ puts ENV['AWESOME_SERVICE_CREDENTIAL'] #=> "xxxxxx"
|
|
40
40
|
### Rails integration
|
41
41
|
denv automatically sets initializer for your Rails application, so you only have to write gem dependency to your Gemfile.
|
42
42
|
|
43
|
+
### Command line tool
|
44
|
+
```
|
45
|
+
denv --help
|
46
|
+
echo 'XXX=1' > .env
|
47
|
+
denv env |grep XXX #=> XXX=1
|
48
|
+
```
|
49
|
+
|
43
50
|
## Development
|
44
51
|
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.
|
45
52
|
|
data/exe/denv
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
lib = File.expand_path('../lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'denv'
|
5
|
+
|
6
|
+
def puts_version!
|
7
|
+
puts Denv::VERSION
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'optparse'
|
12
|
+
filename = Denv::DEFAULT_ENV_FILENAME
|
13
|
+
opt = OptionParser.new.
|
14
|
+
on('-f', '--filename FILENAME') {|v| filename = v }
|
15
|
+
opt.version = Denv::VERSION
|
16
|
+
opt.banner = "Usage: #{opt.program_name} [options] command [argument ...]"
|
17
|
+
|
18
|
+
begin
|
19
|
+
command = opt.parse(ARGV)
|
20
|
+
rescue OptionParser::InvalidOption
|
21
|
+
puts opt.help
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
|
25
|
+
Denv.load(filename)
|
26
|
+
|
27
|
+
if command.empty?
|
28
|
+
puts opt.help
|
29
|
+
exit 1
|
30
|
+
else
|
31
|
+
exec(*command)
|
32
|
+
end
|
data/lib/denv.rb
CHANGED
@@ -22,9 +22,9 @@ module Denv
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
DEFAULT_ENV_FILENAME = '.env'.freeze
|
25
|
+
DEFAULT_ENV_FILENAME = '.env'.freeze
|
27
26
|
|
27
|
+
class << self
|
28
28
|
attr_accessor :callback
|
29
29
|
|
30
30
|
# Read from .env file and load vars into `ENV`.
|
@@ -34,7 +34,7 @@ module Denv
|
|
34
34
|
def load(filename = DEFAULT_ENV_FILENAME)
|
35
35
|
filename = File.expand_path(filename.to_s)
|
36
36
|
run_callback(filename) do
|
37
|
-
build_env(filename)
|
37
|
+
ENV.update(build_env(filename))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
data/lib/denv/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: denv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taiki Ono
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,7 +70,8 @@ description: Loads environment variables to `ENV` from `.env` file. No special t
|
|
70
70
|
about shell meta characters.
|
71
71
|
email:
|
72
72
|
- taiks.4559@gmail.com
|
73
|
-
executables:
|
73
|
+
executables:
|
74
|
+
- denv
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
76
77
|
files:
|
@@ -85,6 +86,7 @@ files:
|
|
85
86
|
- bin/console
|
86
87
|
- bin/setup
|
87
88
|
- denv.gemspec
|
89
|
+
- exe/denv
|
88
90
|
- lib/denv.rb
|
89
91
|
- lib/denv/rails.rb
|
90
92
|
- lib/denv/version.rb
|
@@ -109,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
111
|
version: '0'
|
110
112
|
requirements: []
|
111
113
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.5
|
114
|
+
rubygems_version: 2.4.5
|
113
115
|
signing_key:
|
114
116
|
specification_version: 4
|
115
117
|
summary: Loads environment variables to `ENV` from `.env` file. No special treatments
|