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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30feeb109f0a15d27a92600626a44a6894670d26
4
- data.tar.gz: fcc12bfa6d15de361cd32132dade73c51197f10c
3
+ metadata.gz: 52c51c805e327445733cfb918be0de3d8a8be724
4
+ data.tar.gz: ff8a7b3782ac83c882feba9fe9143bab672d9a1e
5
5
  SHA512:
6
- metadata.gz: cdff44ca79fe4930248b3539574f806f859d6c6b6b4e804450f4a0f9da24aab5cd73e57ffbefd66faf9ab4f78457e44f6400fe96066a72dbcd72f70a68513469
7
- data.tar.gz: 43ce121c040e3fe8ebbd85b0c44388c2b80d937db531c5698f45e8c35f9d415e0d307abcdc0da22a2fc8faa13a58b88c4a9ec83537857bfb1c7982fe51132164
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
- block.call(Rails.configuration) if envs.include?(Rails.env.to_sym)
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
@@ -1,3 +1,3 @@
1
1
  module RailsEnv
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -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.2.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: 2014-12-21 00:00:00.000000000 Z
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.2.2
107
+ rubygems_version: 2.4.5
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Avoid environment detection on Rails