sinatra-env_to_config 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YThkYzk5YTY2NTQ5ODkwMTkyMDI2MGY5MGUyNjI4ODZhYzE1YjQ4Yg==
4
+ YmQwYmIxZGY0NTQ1NjE2YTk1NThlMTdjY2I4YWZmZDFmMmE0NmFjNw==
5
5
  data.tar.gz: !binary |-
6
- MWI1ZDgzY2FjNDc5NjlmMzkyMjdiYWI5M2I4MWFhOTE1NjliYjFmYg==
6
+ NmQ4ZDhkZmM2ZTIyNGNkYWFiYzJjMTU4MzI3YzYxN2RkNDIwMDIzOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTcxNTUzZjk1MWY5MjA3MzNlMTEyYWU0MmE4YzIwZTYwNTBmM2FmODlkYzcy
10
- NmE5N2FjMzYxYjZhYmRjMjZjNWI4NGI2ODUxZjQ2ZWI3NjhmZGU2MmJhZTQx
11
- Y2RlZDBjZGRhY2YyNmZmNDgzOTJjOTBlNDc0MGE3MTk2ZjBhYzM=
9
+ NDAwMjExYzU5NTg0YzdjMTY4MzkyNzZjMWM3OTZiM2FjZDAzNjg5OWQwZWM1
10
+ ZjIzZDc3YmIxYmViODM1NDA5MDBlYjg3NGM4ODMzOTk1YTA5NGI5ZDYxZDZm
11
+ MDUxZmZlN2M1ZTcwN2UyZjEzZTUzNzEzYmY5OGFhNzJjMzNlZTY=
12
12
  data.tar.gz: !binary |-
13
- MjRiOTYzNmMwYjU0ZTQ4NzJkNGU4YWM0ODE1MjQyMTI0NjQzMzY2M2JmNjA2
14
- ODQ1MTMyZDlmM2Y3NjNlZTcxYTg1YmQzOTUzY2NlNGYxNjUxOTIxZGFmNWZj
15
- M2I0MTAzMDM4NmRhOTk0MzRkY2YzMTAwYmQ1ZjkxMmYxMTAwZDM=
13
+ N2U4N2FiZjVhMjQyMzY2OGJmOGFkNzE4Y2JmYWY4ZjkyMGE3ZTEyYjE3N2I5
14
+ YWE2NGYxZmEyNGI0YTExZWU2MDIzYmEyNWFmY2M0YzFkMTMzMTY0ZGUwMzkz
15
+ NjI1ZjAwNGU3NTQyYzRhZmE4ZTVmNGM2MzA5ZmFmZGJlMzViNDc=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.0.0 (2015.07.04)
2
+
3
+ * set all variables in lower case
4
+
1
5
  === 1.0.1 (2015.06.24)
2
6
 
3
7
  * update dockerfiles
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/sinatra-env_to_config.svg)](http://badge.fury.io/rb/sinatra-env_to_config)
4
4
 
5
5
 
6
- Provided methods:
6
+ Provided method:
7
7
  * `env_to_config(key1, key2, ...)`
8
8
 
9
9
  which takes the proper values from ENV and places them in the settings.
@@ -39,8 +39,18 @@ end
39
39
  and then you can use it:
40
40
 
41
41
  ```ruby
42
- puts settings.key1 # -> 'some value' or nil
43
- puts ENV['key1'] # -> 'some value' or nil
42
+ puts settings.key1 # -> 'foo'
43
+ puts ENV['key1'] # -> 'foo'
44
+ ```
45
+
46
+ You should give the same variable as in the ENV, as an argument to
47
+ the `env_to_config` function, but all variables are set in lower case:
48
+
49
+ ```ruby
50
+ ENV['VaR1'] # => 'foo'
51
+ env_to_config 'VaR1'
52
+ settings.var1 # => 'foo'
53
+ settings.VaR1 # => NoMethodError
44
54
  ```
45
55
 
46
56
  ## Versioning
@@ -17,16 +17,20 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- require 'sinatra/base'
20
+ require "sinatra/base"
21
21
 
22
22
  module Sinatra
23
23
  module EnvToConfig
24
24
  def env_to_config(*args)
25
- args.each { |key| set key, find_value_for_key(key) }
25
+ args.each { |key| set standarize_key(key), find_value_for_key(key) }
26
26
  end
27
27
 
28
28
  private
29
29
 
30
+ def standarize_key(key)
31
+ key.to_s.downcase
32
+ end
33
+
30
34
  def find_value_for_key(key)
31
35
  key_string = key.to_s
32
36
  ENV[key_string]
@@ -18,5 +18,5 @@
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module SinatraEnvToConfig
21
- VERSION = '1.0.1'
21
+ VERSION = "2.0.0"
22
22
  end
@@ -17,4 +17,4 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
- require 'sinatra/env_to_config'
20
+ require "sinatra/env_to_config"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-env_to_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Szymon Kopciewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  requirements: []
102
102
  rubyforge_project:
103
- rubygems_version: 2.2.2
103
+ rubygems_version: 2.2.5
104
104
  signing_key:
105
105
  specification_version: 4
106
106
  summary: The Sinatra extension for adding options from the env variables