env_vars 0.6.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41c6b90fcfd8b5c85a223b3f8e55405ac95f0b35c086f71215f220bb128177d2
4
- data.tar.gz: 4c1eda047bd3fee74ddb814ca4e4f699b13bc67eab4c4fb1fbbedadf3bba55b7
3
+ metadata.gz: 98c2331515d4258aaedc545a8ad0b0a07066cdde4a25acca769c63bf363f100b
4
+ data.tar.gz: 9f20421613e79218f8b9893573a6274bf7a0092465a6bed48c08508e368acfd7
5
5
  SHA512:
6
- metadata.gz: bcf4772a021653e00637b406e497445e3c1c05920a989db4e2af25c8bef45b3343d68c13e48054ce18fbc3e5058d304906d1c384d7369936e3e7f5c8e17364ca
7
- data.tar.gz: 60ae05344958e4d5c8ba682e42fdea538b62774a26ba1fb8ca9d95e1113c6b41a3d4cfd16fb17af4206d525802e3fd5293bd638e6f69f1456c9692d3a6d75a56
6
+ metadata.gz: 4c1a8f444de98588e0557fb6e75f9cd1db98a710f003531009ead659c2258bb433527b9d509b20f0e42ba5993ca801a3cbcd124c88ee1e16c07d37af847e26f7
7
+ data.tar.gz: a731552d861def65acf523f384afefcf828c17d83e321123b8f1b143214436ba89329ac9533959892011001d4b71bc30c97834c3b26bc6b1022e4839fb4224aa
@@ -4,16 +4,16 @@ sudo: false
4
4
  notifications:
5
5
  email: false
6
6
  rvm:
7
+ - 2.5.2
7
8
  - 2.4.2
8
- - 2.3.5
9
- - 2.2.8
9
+ - 2.3.8
10
10
  before_install: gem install bundler
11
11
  before_script:
12
- - "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter"
13
- - "chmod +x ./cc-test-reporter"
12
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
13
+ - chmod +x ./cc-test-reporter
14
14
  - "./cc-test-reporter before-build"
15
15
  after_script:
16
- - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
16
+ - "./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $TRAVIS_TEST_RESULT"
17
17
  env:
18
18
  global:
19
- secure: hRsybxCL3vUEhYtEdUIJ6pPyFaeVH/Tc1crVXJ0JCmem/rSv/PHS0jUzb8R4EiQKdwFFDgEciASW71XwpesIoY+KbUPfjvG9M8NnKscSuTpX/9CAVvoEoLzUtHYV5VNx6St2YTb1nStXhvGqBN0y5VNil9t5q9NIEM65eSgZuO7lvzAGgvUHYOkmljHqHb2rXejdAJ5k3NVbKPU3fByGGxvO9SiJ4RLWWpNhCwCWjVlds5+wffiHO2ojWdfLYikaIIcuqZzcyYuKUch16guPfz8+AsYpqHTsf+s81UnNKLk3Ut9zl5JoxCkkTSt1ZzAHNEceR4KXgRYxFZh3uHg8fXrYqdc4A4tgHqsndXeZnEFFnmAlOvjbGldtYoSjzJGBaSxKei9mZbeFy6ytlwZeMp22hBwflFUlbxF/O8IpvSRAq1M4QG1nfEfKCXhyFCmOaeS1BcgcFLzXiDYibCnAfLmK/EMa5V+zo4USjiRmzSBmQFdNk91x+zOGRQOz6lt3s6OEm98FHh/J9Y4tQ9DkkhwS6x9MuSfdjEQkyhvB2xsl9SOfdlU5Ork+FBkRFGlYtiAcHwVa6e0ikJCAGFW2xVqKwq9dT/Wvg4VNtkCmJORdsuxZf/Jtgh2k5gjFi7ZO4mViIxMjIAQqUA/+XR9dFxuAfSZC6FJG4l4ixqvmNoM=
19
+ secure: cdMMHvDQelzd4Z/7EMaC02s3Ef8TnEO3L6d4C/zfkJt7GjTJqptnqja+F2EcTmdSFs8zM0QHWgB3umfzBtiR2swXJ81c19owqdoxpmo2sOTJNQeRpfkRqngw7VW0RpoUQBWmrbPjK1xV6EJAM38U0TqhO5WR5uhKKNDJgnmWrIITaSkuo0r/b6Hia5iIIRCDqgXzuEYbx3wYKwn/7aYjpoXq3mPpS8L4AuzG2qjTTyLNBqhFPrhENuu4Hu9Bjj6ziyPUCM2cvrxP43smy7UvCmnr21hT9mDQnsaw6WvW4qReHgLtbckoK1Fky5YuU74R8JnYBqIi9sTjs19z10xdhxwJmCI1p4RaKsEoYWTV2geHK3rD0gXgtZqc8hWMfMmpz0U+TmVTuMmLatdaYglCUuSfgL7KPyCji9k1yMP4jEmjxYTukY9nwhAEvbSMBCiHadW1nEhffgYH2alZr1CxxRi/UKUTE10kxHni8OILuWP7VgFOs0qeS0HEmo+PYXQSOXMEBb76YtahmD+c4iPYJMA3wD6TR71MEvu+MIn3PLQcte2OWhoBsd+9knbus693Bb7MESCk857+vm3fwdbApC945ABGUTSfv2IR74nlNRY2I4fAcJCXhhsKyNh95QPa/sDoKnL2XgNlYsWYxBTa8h7ZxI0YVnlc13U4A1SaRLo=
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # Env::Vars
1
+ ![env_vars: Access environment variables. Also includes presence validation, type coercion and default values.](https://raw.githubusercontent.com/fnando/env_vars/master/env_vars.png)
2
2
 
3
- [![Travis-CI](https://travis-ci.org/fnando/env_vars.png)](https://travis-ci.org/fnando/env_vars)
4
- [![Code Climate](https://codeclimate.com/github/fnando/env_vars/badges/gpa.svg)](https://codeclimate.com/github/fnando/env_vars)
5
- [![Test Coverage](https://codeclimate.com/github/fnando/env_vars/badges/coverage.svg)](https://codeclimate.com/github/fnando/env_vars/coverage)
6
- [![Gem](https://img.shields.io/gem/v/env_vars.svg)](https://rubygems.org/gems/env_vars)
7
- [![Gem](https://img.shields.io/gem/dt/env_vars.svg)](https://rubygems.org/gems/env_vars)
8
-
9
- Access environment variables. Also includes presence validation, type coercion and default values.
3
+ <p align="center">
4
+ <a href="https://travis-ci.org/fnando/env_vars"><img src="https://travis-ci.org/fnando/env_vars.svg" alt="Travis-CI"></a>
5
+ <a href="https://codeclimate.com/github/fnando/env_vars"><img src="https://codeclimate.com/github/fnando/env_vars/badges/gpa.svg" alt="Code Climate"></a>
6
+ <a href="https://codeclimate.com/github/fnando/env_vars/coverage"><img src="https://codeclimate.com/github/fnando/env_vars/badges/coverage.svg" alt="Test Coverage"></a>
7
+ <a href="https://rubygems.org/gems/env_vars"><img src="https://img.shields.io/gem/v/env_vars.svg" alt="Gem"></a>
8
+ <a href="https://rubygems.org/gems/env_vars"><img src="https://img.shields.io/gem/dt/env_vars.svg" alt="Gem"></a>
9
+ </p>
10
10
 
11
11
  ## Installation
12
12
 
@@ -106,7 +106,10 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
106
106
 
107
107
  Bug reports and pull requests are welcome on GitHub at https://github.com/fnando/env_vars. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
108
108
 
109
-
110
109
  ## License
111
110
 
112
111
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
112
+
113
+ ## Icon
114
+
115
+ Icon made by [eucalyp](https://www.flaticon.com/authors/eucalyp) from [Flaticon](https://www.flaticon.com/) is licensed by Creative Commons BY 3.0.
Binary file
@@ -0,0 +1,22 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="0 0 300 300">
2
+ <g fill="none" fill-rule="evenodd">
3
+ <rect width="155" height="63" x="73" y="92" fill="#9013FE"/>
4
+ <path fill="#9013FE" d="M163.908393,300 L137.091607,300 L134.078214,287.931964 C130.211429,286.789286 126.479643,285.236786 122.92625,283.303393 L112.251607,289.70625 L93.29375,270.748393 L99.6966071,260.07375 C97.7632143,256.520357 96.2107143,252.78375 95.0680357,248.921786 L83,245.908393 L83,219.091607 L95.0680357,216.078214 C96.2107143,212.211429 97.7632143,208.479643 99.6966071,204.92625 L93.29375,194.251607 L112.251607,175.29375 L122.92625,181.696607 C126.479643,179.763214 130.21625,178.210714 134.078214,177.068036 L137.091607,165 L163.908393,165 L166.921786,177.068036 C170.788571,178.210714 174.520357,179.763214 178.07375,181.696607 L188.748393,175.29375 L207.70625,194.251607 L201.303393,204.92625 C203.236786,208.479643 204.789286,212.21625 205.931964,216.078214 L218,219.091607 L218,245.908393 L205.931964,248.921786 C204.789286,252.788571 203.236786,256.520357 201.303393,260.07375 L207.70625,270.748393 L188.748393,289.70625 L178.07375,283.303393 C174.520357,285.236786 170.78375,286.789286 166.921786,287.931964 L163.908393,300 Z"/>
5
+ <g fill="#000">
6
+ <rect width="154.839" height="9.714" x="72.581" y="126.286"/>
7
+ <rect width="62.903" height="9.714" x="164.516" y="145.714"/>
8
+ <rect width="62.903" height="9.714" x="72.581" y="145.714"/>
9
+ <rect width="62.903" height="9.714" x="164.516" y="106.857"/>
10
+ <rect width="62.903" height="9.714" x="72.581" y="106.857"/>
11
+ <rect width="154.839" height="9.714" x="72.581" y="87.429"/>
12
+ <path fill-rule="nonzero" d="M150,213.714286 C139.325806,213.714286 130.645161,222.428 130.645161,233.142857 C130.645161,243.857714 139.325806,252.571429 150,252.571429 C160.674194,252.571429 169.354839,243.857714 169.354839,233.142857 C169.354839,222.428 160.674194,213.714286 150,213.714286 Z M150,242.857143 C144.662903,242.857143 140.322581,238.500286 140.322581,233.142857 C140.322581,227.785429 144.662903,223.428571 150,223.428571 C155.337097,223.428571 159.677419,227.785429 159.677419,233.142857 C159.677419,238.500286 155.337097,242.857143 150,242.857143 Z"/>
13
+ <path d="M150 194.285714C143.574194 194.285714 137.201613 195.903143 131.579032 198.958286L136.190323 207.502C140.404839 205.214286 145.175806 204 150 204 166.01129 204 179.032258 217.070571 179.032258 233.142857 179.032258 237.985429 177.822581 242.774571 175.543548 247.005143L184.054839 251.634C187.098387 245.99 188.709677 239.593143 188.709677 233.142857 188.709677 211.718 171.343548 194.285714 150 194.285714zM150 262.285714C133.98871 262.285714 120.967742 249.215143 120.967742 233.142857 120.967742 228.300286 122.177419 223.511143 124.456452 219.280571L115.945161 214.651714C112.901613 220.295714 111.290323 226.692571 111.290323 233.142857 111.290323 254.567714 128.656452 272 150 272 156.425806 272 162.798387 270.382571 168.420968 267.327429L163.809677 258.783714C159.595161 261.071429 154.824194 262.285714 150 262.285714z"/>
14
+ <path fill-rule="nonzero" d="M285.483871,0 L14.516129,0 C6.51290323,0 0,6.53771429 0,14.5714286 L0,238 L82.2580645,238 L82.2580645,228.285714 L9.67741935,228.285714 L9.67741935,48.5714286 L290.322581,48.5714286 L290.322581,228.285714 L217.741935,228.285714 L217.741935,238 L300,238 L300,14.5714286 C300,6.53771429 293.487097,0 285.483871,0 Z M9.67741935,38.8571429 L9.67741935,14.5714286 C9.67741935,11.8951429 11.85,9.71428571 14.516129,9.71428571 L285.483871,9.71428571 C288.15,9.71428571 290.322581,11.8951429 290.322581,14.5714286 L290.322581,38.8571429 L9.67741935,38.8571429 Z"/>
15
+ <rect width="9.677" height="9.714" x="19.355" y="19.429"/>
16
+ <rect width="9.677" height="9.714" x="38.71" y="19.429"/>
17
+ <rect width="9.677" height="9.714" x="58.065" y="19.429"/>
18
+ <polygon points="45 187.289 45 60 68.99 60 68.99 73.227 58.504 73.694 58.504 173.439 68.99 174.062 68.99 187.289"/>
19
+ <polygon points="255.99 187.412 232 187.412 232 174.277 242.486 173.658 242.486 74.599 232 74.136 232 61 255.99 61"/>
20
+ </g>
21
+ </g>
22
+ </svg>
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bigdecimal"
4
-
5
3
  module Env
6
4
  class Vars
7
- VERSION = "0.6.0"
5
+ VERSION = "0.7.1"
8
6
  BOOL_TRUE = ["yes", "true", "1", true]
9
7
  BOOL_FALSE = ["no", "false"]
10
8
 
@@ -13,9 +11,15 @@ module Env
13
11
 
14
12
  def initialize(env = ENV, &block)
15
13
  @env = env
14
+ @__cache__ = {}
16
15
  instance_eval(&block)
17
16
  end
18
17
 
18
+ def to_s
19
+ "#<Env::Vars>"
20
+ end
21
+ alias_method :inspect, :to_s
22
+
19
23
  def set(name, type, default = nil, required: false, aliases: [])
20
24
  name = name.to_s
21
25
  env_var = name.upcase
@@ -51,8 +55,9 @@ module Env
51
55
  raise MissingCallable, "arg[1] must respond to #call or pass a block" unless callable
52
56
 
53
57
  if cache
54
- value = callable.call
55
- define_singleton_method(name) { value }
58
+ define_singleton_method(name) do
59
+ @__cache__[name.to_sym] ||= callable.call
60
+ end
56
61
  else
57
62
  define_singleton_method(name) { callable.call }
58
63
  end
@@ -79,6 +84,7 @@ module Env
79
84
  end
80
85
 
81
86
  def bigdecimal
87
+ require "bigdecimal"
82
88
  :bigdecimal
83
89
  end
84
90
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_vars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-30 00:00:00.000000000 Z
11
+ date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,6 +96,8 @@ files:
96
96
  - README.md
97
97
  - Rakefile
98
98
  - env_vars.gemspec
99
+ - env_vars.png
100
+ - env_vars.svg
99
101
  - lib/env_vars.rb
100
102
  - lib/env_vars/dotenv.rb
101
103
  homepage: https://github.com/fnando/env_vars