appenv 1.0.0 → 1.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 +7 -0
- data/lib/appenv/environment.rb +1 -1
- data/lib/appenv/version.rb +1 -1
- metadata +35 -61
- data/.gitignore +0 -1
- data/README.md +0 -35
- data/Rakefile +0 -10
- data/appenv.gemspec +0 -18
- data/test/data/env +0 -3
- data/test/test_helper.rb +0 -2
- data/test/unit/test_environment.rb +0 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '083eb5dee12cb821929f725c3f56912cf030d80211a7c1ccf9cf67c2fad7d9d1'
|
4
|
+
data.tar.gz: 9f10c7e9fb1d0f5ee285e0999c6e893b29c4844d610055be5036edc48f8731bd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3fbf92b0556ba4f81f1112681506b5771420ec2aeebfdc80907b424719a8b8a64d66715f46ff582554715285c459db76ec9b03906fe8e574479489a7fd8d0f7
|
7
|
+
data.tar.gz: 73ffa02c40985690c24ef753cda8e1ed4e3aec5a2168e5b30f189af99c62d7cad8c7e481c946dd85c56893392130f998a44dd63eac3afff039f34988260e1fac
|
data/lib/appenv/environment.rb
CHANGED
@@ -58,7 +58,7 @@ class AppEnv::Environment < ActiveSupport::OrderedOptions
|
|
58
58
|
|
59
59
|
def _source_env_from_file
|
60
60
|
src = {}
|
61
|
-
return src unless File.
|
61
|
+
return src unless File.exist?(@file)
|
62
62
|
File.open(@file, 'r').each_line { |ln|
|
63
63
|
cln = ln.strip.sub(/^export\s+/, '')
|
64
64
|
next if cln.match(/^#/)
|
data/lib/appenv/version.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,59 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: appenv
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Joseph Pearson
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2024-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: activesupport
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
25
17
|
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
30
20
|
type: :runtime
|
31
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
32
27
|
description: Environment-variable compatible application configuration.
|
33
|
-
email:
|
34
|
-
- joseph@booki.sh
|
28
|
+
email: joseph@users.noreply.github.com
|
35
29
|
executables: []
|
36
|
-
|
37
30
|
extensions: []
|
38
|
-
|
39
31
|
extra_rdoc_files: []
|
40
|
-
|
41
|
-
files:
|
42
|
-
- .gitignore
|
43
|
-
- README.md
|
44
|
-
- Rakefile
|
45
|
-
- appenv.gemspec
|
32
|
+
files:
|
46
33
|
- lib/appenv.rb
|
47
34
|
- lib/appenv/environment.rb
|
48
35
|
- lib/appenv/version.rb
|
49
|
-
|
50
|
-
|
51
|
-
-
|
52
|
-
|
53
|
-
homepage: ""
|
54
|
-
licenses: []
|
55
|
-
|
36
|
+
homepage: https://github.com/joseph/appenv
|
37
|
+
licenses:
|
38
|
+
- MIT
|
39
|
+
metadata: {}
|
56
40
|
post_install_message:
|
57
41
|
rdoc_options: []
|
58
|
-
|
59
|
-
require_paths:
|
42
|
+
require_paths:
|
60
43
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
63
46
|
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
70
51
|
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
- 0
|
74
|
-
version: "0"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
75
54
|
requirements: []
|
76
|
-
|
77
|
-
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.6
|
55
|
+
rubygems_version: 3.0.6
|
79
56
|
signing_key:
|
80
|
-
specification_version:
|
57
|
+
specification_version: 4
|
81
58
|
summary: Application environment configuration
|
82
|
-
test_files:
|
83
|
-
- test/data/env
|
84
|
-
- test/test_helper.rb
|
85
|
-
- test/unit/test_environment.rb
|
59
|
+
test_files: []
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
.screenrc
|
data/README.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# APPENV
|
2
|
-
|
3
|
-
A simple gem that gives you an application environment configuration object.
|
4
|
-
Values are loaded from ENV or from an environment file such as `.env`.
|
5
|
-
|
6
|
-
Similar to the `.env` feature in Foreman, but these values will be available
|
7
|
-
to your application no matter how you launch it (script/rails, Passenger,
|
8
|
-
Unicorn, rake, etc).
|
9
|
-
|
10
|
-
For convenience, there is also compatibility with Bash-style environment
|
11
|
-
declarations in your `.env` file; ie: `export ENV_VAR_NAME="foo"`.
|
12
|
-
|
13
|
-
## Example
|
14
|
-
|
15
|
-
You'd typically create your configuration object in `config/application.rb`.
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
module ExampleProjectName
|
19
|
-
|
20
|
-
Env = AppEnv::Environment.new { |env, src|
|
21
|
-
env.domain = src.my_domain_variable || 'example.com'
|
22
|
-
env.set(:access_codes) {
|
23
|
-
src.access_codes ? src.access_codes.split : nil
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
27
|
-
# class Application < Rails::Application
|
28
|
-
# ... etc ...
|
29
|
-
#
|
30
|
-
# Your config is available globally in ExampleProjectName::Env.
|
31
|
-
#
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
```
|
data/Rakefile
DELETED
data/appenv.gemspec
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/appenv/version', __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ['Joseph Pearson']
|
6
|
-
gem.email = ['joseph@booki.sh']
|
7
|
-
gem.description = 'Environment-variable compatible application configuration.'
|
8
|
-
gem.summary = 'Application environment configuration'
|
9
|
-
gem.homepage = ''
|
10
|
-
|
11
|
-
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
-
gem.name = 'appenv'
|
15
|
-
gem.require_paths = ['lib']
|
16
|
-
gem.version = AppEnv::VERSION
|
17
|
-
gem.add_dependency('activesupport')
|
18
|
-
end
|
data/test/data/env
DELETED
data/test/test_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class AppEnv::TestEnvironment < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_sanity
|
6
|
-
assert_nothing_raised {
|
7
|
-
@env = AppEnv::Environment.new('test/data/env') { |env, src|
|
8
|
-
env.var1 = src.var_one
|
9
|
-
env.set(:var2) { src.var_two }
|
10
|
-
env.var3 = src.var_three || 'grault'
|
11
|
-
}
|
12
|
-
}
|
13
|
-
assert_equal('foo', @env.var1)
|
14
|
-
assert_equal('bar', @env.var2)
|
15
|
-
assert_equal('grault', @env.var3)
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
def test_expand
|
20
|
-
@env = AppEnv::Environment.new('test/data/env') { |env, src|
|
21
|
-
env.var1 = src.var_one
|
22
|
-
}
|
23
|
-
assert_equal('foo', @env.var1)
|
24
|
-
@env.expand { |env, src|
|
25
|
-
env.var2 = src.var_two
|
26
|
-
}
|
27
|
-
assert_equal('bar', @env.var2)
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|