env-tweaks 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.idea/encodings.xml +6 -0
- data/.idea/env-tweaks.iml +23 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.ruby-version +1 -0
- data/.travis.yml +14 -0
- data/Appraisals +14 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +43 -0
- data/README.md +33 -0
- data/Rakefile +6 -0
- data/env-tweaks.gemspec +21 -0
- data/gemfiles/activesupport_3.x.gemfile +10 -0
- data/gemfiles/activesupport_3.x.gemfile.lock +39 -0
- data/gemfiles/activesupport_4.x.gemfile +10 -0
- data/gemfiles/activesupport_4.x.gemfile.lock +44 -0
- data/gemfiles/activesupport_5.x.gemfile +10 -0
- data/gemfiles/activesupport_5.x.gemfile.lock +44 -0
- data/lib/env-tweaks.rb +18 -0
- data/lib/env-tweaks/version.rb +6 -0
- data/test/test_env_tweaks.rb +47 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 568c82c04ec59cb9a00dc285fad2e581bdf75789b4791212bde6c31b227882ce
|
4
|
+
data.tar.gz: c8a534b8f0982fec225ca3d9805d1e176ffd8527098feb7e7df4bee68d0f3b13
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 881636947f93d7b4edaab7ebb5bb232fbf37e89b1ebdef972c89d1470a3be2ec7f3f9b4286f87711e1d3a9bf762019e8c4506bc3f5588607fe6063cec2519aef
|
7
|
+
data.tar.gz: 1e1c977267574e119ec6854de65a46af749f33b8ed8f5c931f9e5760733df42d5d485900c3c577fe9e9c095db6a564791a246a45ccd702993bc7c86ee15af997
|
data/.gitignore
ADDED
data/.idea/encodings.xml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$" />
|
8
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.5.1" jdkType="RUBY_SDK" />
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v5.2.0, rbenv: 2.5.1) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="appraisal (v2.2.0, rbenv: 2.5.1) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.16.2, rbenv: 2.5.1) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.0.5, rbenv: 2.5.1) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.0.1, rbenv: 2.5.1) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, rbenv: 2.5.1) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="power_assert (v1.1.3, rbenv: 2.5.1) [gem]" level="application" />
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.1, rbenv: 2.5.1) [gem]" level="application" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="test-unit (v3.2.8, rbenv: 2.5.1) [gem]" level="application" />
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v0.20.0, rbenv: 2.5.1) [gem]" level="application" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, rbenv: 2.5.1) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.5, rbenv: 2.5.1) [gem]" level="application" />
|
22
|
+
</component>
|
23
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="JavaScriptSettings">
|
4
|
+
<option name="languageLevel" value="ES6" />
|
5
|
+
</component>
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.3.0" project-jdk-type="RUBY_SDK" />
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/env-tweaks.iml" filepath="$PROJECT_DIR$/.idea/env-tweaks.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
ADDED
data/Appraisals
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
appraise "activesupport 3.x" do
|
5
|
+
gem "activesupport", "~> 3.0"
|
6
|
+
end
|
7
|
+
|
8
|
+
appraise "activesupport 4.x" do
|
9
|
+
gem "activesupport", "~> 4.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
appraise "activesupport 5.x" do
|
13
|
+
gem "activesupport", "~> 5.0"
|
14
|
+
end
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
env-tweaks (1.0.0)
|
5
|
+
activesupport (>= 3.0, < 6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.2.0)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
appraisal (2.2.0)
|
16
|
+
bundler
|
17
|
+
rake
|
18
|
+
thor (>= 0.14.0)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
i18n (1.0.1)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
minitest (5.11.3)
|
23
|
+
power_assert (1.1.3)
|
24
|
+
rake (12.3.1)
|
25
|
+
test-unit (3.2.8)
|
26
|
+
power_assert
|
27
|
+
thor (0.20.0)
|
28
|
+
thread_safe (0.3.6)
|
29
|
+
tzinfo (1.2.5)
|
30
|
+
thread_safe (~> 0.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
appraisal (~> 2.2)
|
37
|
+
bundler (~> 1.7)
|
38
|
+
env-tweaks!
|
39
|
+
rake (~> 12.0)
|
40
|
+
test-unit (~> 3.2)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.16.2
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
## Responsibly extends Ruby's ENV with simple and predictable utilities.
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/env-tweaks.svg)](https://badge.fury.io/rb/env-tweaks)
|
4
|
+
[![Build Status](https://travis-ci.org/yivo/env-tweaks.svg?branch=master)](https://travis-ci.org/yivo/env-tweaks)
|
5
|
+
|
6
|
+
## Current features
|
7
|
+
|
8
|
+
* `ENV.true?("VARIABLE")`
|
9
|
+
* `ENV.false?("VARIABLE")`
|
10
|
+
|
11
|
+
## Installing gem
|
12
|
+
|
13
|
+
Add to your Gemfile:
|
14
|
+
```ruby
|
15
|
+
gem "env-tweaks", "~> 1.0.0"
|
16
|
+
```
|
17
|
+
|
18
|
+
## Running tests
|
19
|
+
|
20
|
+
Install bundler:
|
21
|
+
```bash
|
22
|
+
gem install bundler
|
23
|
+
```
|
24
|
+
|
25
|
+
Install dependencies:
|
26
|
+
```bash
|
27
|
+
cd env-tweaks && bundle
|
28
|
+
```
|
29
|
+
|
30
|
+
Run tests:
|
31
|
+
```bash
|
32
|
+
cd env-tweaks && bundle exec rake test
|
33
|
+
```
|
data/Rakefile
ADDED
data/env-tweaks.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require File.expand_path("../lib/env-tweaks/version", __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "env-tweaks"
|
8
|
+
s.version = ENVTweaks::VERSION
|
9
|
+
s.author = "Yaroslav Konoplov"
|
10
|
+
s.email = "eahome00@gmail.com"
|
11
|
+
s.summary = "Responsibly extends Ruby's ENV with simple and predictable utilities."
|
12
|
+
s.description = "Responsibly extends Ruby's ENV with simple and predictable utilities."
|
13
|
+
s.homepage = "https://github.com/yivo/env-tweaks"
|
14
|
+
s.license = "MIT"
|
15
|
+
s.files = `git ls-files -z`.split("\x0")
|
16
|
+
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_dependency "activesupport", ">= 3.0", "< 6.0"
|
20
|
+
s.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
env-tweaks (1.0.0)
|
5
|
+
activesupport (>= 3.0, < 6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (3.2.22.5)
|
11
|
+
i18n (~> 0.6, >= 0.6.4)
|
12
|
+
multi_json (~> 1.0)
|
13
|
+
appraisal (2.2.0)
|
14
|
+
bundler
|
15
|
+
rake
|
16
|
+
thor (>= 0.14.0)
|
17
|
+
concurrent-ruby (1.0.5)
|
18
|
+
i18n (0.9.5)
|
19
|
+
concurrent-ruby (~> 1.0)
|
20
|
+
multi_json (1.13.1)
|
21
|
+
power_assert (1.1.3)
|
22
|
+
rake (12.3.1)
|
23
|
+
test-unit (3.2.8)
|
24
|
+
power_assert
|
25
|
+
thor (0.20.0)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
activesupport (~> 3.0)
|
32
|
+
appraisal (~> 2.2)
|
33
|
+
bundler (~> 1.7)
|
34
|
+
env-tweaks!
|
35
|
+
rake (~> 12.0)
|
36
|
+
test-unit (~> 3.2)
|
37
|
+
|
38
|
+
BUNDLED WITH
|
39
|
+
1.16.2
|
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
env-tweaks (1.0.0)
|
5
|
+
activesupport (>= 3.0, < 6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (4.2.10)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
appraisal (2.2.0)
|
16
|
+
bundler
|
17
|
+
rake
|
18
|
+
thor (>= 0.14.0)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
i18n (0.9.5)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
minitest (5.11.3)
|
23
|
+
power_assert (1.1.3)
|
24
|
+
rake (12.3.1)
|
25
|
+
test-unit (3.2.8)
|
26
|
+
power_assert
|
27
|
+
thor (0.20.0)
|
28
|
+
thread_safe (0.3.6)
|
29
|
+
tzinfo (1.2.5)
|
30
|
+
thread_safe (~> 0.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
activesupport (~> 4.0)
|
37
|
+
appraisal (~> 2.2)
|
38
|
+
bundler (~> 1.7)
|
39
|
+
env-tweaks!
|
40
|
+
rake (~> 12.0)
|
41
|
+
test-unit (~> 3.2)
|
42
|
+
|
43
|
+
BUNDLED WITH
|
44
|
+
1.16.2
|
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
env-tweaks (1.0.0)
|
5
|
+
activesupport (>= 3.0, < 6.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.2.0)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
appraisal (2.2.0)
|
16
|
+
bundler
|
17
|
+
rake
|
18
|
+
thor (>= 0.14.0)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
i18n (1.0.1)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
minitest (5.11.3)
|
23
|
+
power_assert (1.1.3)
|
24
|
+
rake (12.3.1)
|
25
|
+
test-unit (3.2.8)
|
26
|
+
power_assert
|
27
|
+
thor (0.20.0)
|
28
|
+
thread_safe (0.3.6)
|
29
|
+
tzinfo (1.2.5)
|
30
|
+
thread_safe (~> 0.1)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
activesupport (~> 5.0)
|
37
|
+
appraisal (~> 2.2)
|
38
|
+
bundler (~> 1.7)
|
39
|
+
env-tweaks!
|
40
|
+
rake (~> 12.0)
|
41
|
+
test-unit (~> 3.2)
|
42
|
+
|
43
|
+
BUNDLED WITH
|
44
|
+
1.16.2
|
data/lib/env-tweaks.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "active_support/core_ext/object/blank"
|
5
|
+
|
6
|
+
module ENVTweaks
|
7
|
+
module Extension
|
8
|
+
def true?(var)
|
9
|
+
!false?(var)
|
10
|
+
end
|
11
|
+
|
12
|
+
def false?(var)
|
13
|
+
self[var].blank? || %w[false 0 nil null].include?(self[var])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
ENV.extend ENVTweaks::Extension
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
Bundler.require
|
5
|
+
|
6
|
+
class ENVTweaksTest < Test::Unit::TestCase
|
7
|
+
def test_true
|
8
|
+
ENV["VAR"] = "1"
|
9
|
+
assert_true ENV.true?("VAR")
|
10
|
+
|
11
|
+
ENV["VAR"] = "true"
|
12
|
+
assert_true ENV.true?("VAR")
|
13
|
+
|
14
|
+
ENV["VAR"] = "foobarbaz"
|
15
|
+
assert_true ENV.true?("VAR")
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_false
|
19
|
+
ENV.delete("VAR")
|
20
|
+
assert_true ENV.false?("VAR")
|
21
|
+
|
22
|
+
ENV["VAR"] = ""
|
23
|
+
assert_true ENV.false?("VAR")
|
24
|
+
|
25
|
+
ENV["VAR"] = " "
|
26
|
+
assert_true ENV.false?("VAR")
|
27
|
+
|
28
|
+
ENV["VAR"] = "\n"
|
29
|
+
assert_true ENV.false?("VAR")
|
30
|
+
|
31
|
+
ENV["VAR"] = "\t"
|
32
|
+
assert_true ENV.false?("VAR")
|
33
|
+
|
34
|
+
ENV["VAR"] = "0"
|
35
|
+
assert_true ENV.false?("VAR")
|
36
|
+
|
37
|
+
ENV["VAR"] = "false"
|
38
|
+
assert_true ENV.false?("VAR")
|
39
|
+
|
40
|
+
ENV["VAR"] = "nil"
|
41
|
+
assert_true ENV.false?("VAR")
|
42
|
+
|
43
|
+
ENV["VAR"] = "null"
|
44
|
+
assert_true ENV.false?("VAR")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: env-tweaks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yaroslav Konoplov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '6.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.7'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.7'
|
47
|
+
description: Responsibly extends Ruby's ENV with simple and predictable utilities.
|
48
|
+
email: eahome00@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- ".gitignore"
|
54
|
+
- ".idea/encodings.xml"
|
55
|
+
- ".idea/env-tweaks.iml"
|
56
|
+
- ".idea/misc.xml"
|
57
|
+
- ".idea/modules.xml"
|
58
|
+
- ".idea/vcs.xml"
|
59
|
+
- ".ruby-version"
|
60
|
+
- ".travis.yml"
|
61
|
+
- Appraisals
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- env-tweaks.gemspec
|
67
|
+
- gemfiles/activesupport_3.x.gemfile
|
68
|
+
- gemfiles/activesupport_3.x.gemfile.lock
|
69
|
+
- gemfiles/activesupport_4.x.gemfile
|
70
|
+
- gemfiles/activesupport_4.x.gemfile.lock
|
71
|
+
- gemfiles/activesupport_5.x.gemfile
|
72
|
+
- gemfiles/activesupport_5.x.gemfile.lock
|
73
|
+
- lib/env-tweaks.rb
|
74
|
+
- lib/env-tweaks/version.rb
|
75
|
+
- test/test_env_tweaks.rb
|
76
|
+
homepage: https://github.com/yivo/env-tweaks
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.7.6
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Responsibly extends Ruby's ENV with simple and predictable utilities.
|
100
|
+
test_files:
|
101
|
+
- test/test_env_tweaks.rb
|