rails-env 0.2.0 → 0.3.0
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 +4 -4
- data/README.md +8 -0
- data/lib/rails-env.rb +2 -1
- data/lib/rails-env/version.rb +1 -1
- data/spec/rails-env_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c51c805e327445733cfb918be0de3d8a8be724
|
4
|
+
data.tar.gz: ff8a7b3782ac83c882feba9fe9143bab672d9a1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce6d646b544c4685a36f2ea4cbc110e9b49f4d13ed59e1239f71b272d3c9c4e0022771eda7b3e4e98fd50436af12e9c4eb33d55528cdbbe00254295cffae18e0
|
7
|
+
data.tar.gz: 2af8235c5bd7690536081af44ddf3ce3aab814df736ff5659548c3997b3d98dfcefe0c94b088f44609e62a8a1412b59912b7fe804df8291373de6600bb3443a5
|
data/README.md
CHANGED
@@ -36,6 +36,14 @@ end
|
|
36
36
|
|
37
37
|
Looks dumb, but you don't have to use the long `Rails.configuration` or assign it to a local variable. This is useful when you're extracting out things to initializers.
|
38
38
|
|
39
|
+
To match all environments, use `:any`.
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
Rails.env.on(:any) do |config|
|
43
|
+
# Do something with config
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
39
47
|
## Contributing
|
40
48
|
|
41
49
|
1. Fork it ( https://github.com/fnando/rails-env/fork )
|
data/lib/rails-env.rb
CHANGED
@@ -9,7 +9,8 @@ module RailsEnv
|
|
9
9
|
|
10
10
|
module Extension
|
11
11
|
def on(*envs, &block)
|
12
|
-
|
12
|
+
env_matched = envs.include?(:any) || envs.include?(Rails.env.to_sym)
|
13
|
+
block.call(Rails.configuration) if env_matched
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
data/lib/rails-env/version.rb
CHANGED
data/spec/rails-env_spec.rb
CHANGED
@@ -18,4 +18,10 @@ describe RailsEnv do
|
|
18
18
|
expect(block).not_to receive(:call)
|
19
19
|
Rails.env.on(:production, &block)
|
20
20
|
end
|
21
|
+
|
22
|
+
it 'runs on any environment' do
|
23
|
+
block = proc {}
|
24
|
+
expect(block).to receive(:call).with(Rails.configuration)
|
25
|
+
Rails.env.on(:any, &block)
|
26
|
+
end
|
21
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.4.5
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Avoid environment detection on Rails
|