rails-env 0.3.0 → 1.0.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 +24 -4
- data/lib/rails-env.rb +1 -1
- data/lib/rails-env/version.rb +1 -1
- data/rails-env.gemspec +1 -0
- data/spec/rails-env_spec.rb +24 -8
- data/spec/spec_helper.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88a0628c82307f77ce43292c6944457555217adb
|
4
|
+
data.tar.gz: fd260fbe6229e5fe68fe26b5b82515cfb180146f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 456fae20dd8fac5c4efcfc466b8cad56c3c4fe8383d15d4d81f99b908e0365f6d1d15be65052abf9a2ce3b4472bf5db04c03d1c54d7596630fdd39fd6ade1309
|
7
|
+
data.tar.gz: 728c5ff0e8cf8f2f67f23c0309fc9705e3dca18a0298215cfef7086e8b28287a6cc697a22e9a85958e3e88f7eeea61af984dda3f6fd04c2bba70c4578bdae9f0
|
data/README.md
CHANGED
@@ -29,8 +29,8 @@ end
|
|
29
29
|
You can just use:
|
30
30
|
|
31
31
|
```ruby
|
32
|
-
Rails.env.on(:production) do
|
33
|
-
|
32
|
+
Rails.env.on(:production) do
|
33
|
+
config.assets.version = '1.0'
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
@@ -39,8 +39,28 @@ Looks dumb, but you don't have to use the long `Rails.configuration` or assign i
|
|
39
39
|
To match all environments, use `:any`.
|
40
40
|
|
41
41
|
```ruby
|
42
|
-
Rails.env.on(:any) do
|
43
|
-
|
42
|
+
Rails.env.on(:any) do
|
43
|
+
config.assets.version = '1.0'
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
## Upgrading from previous versions
|
48
|
+
|
49
|
+
Previous versions used to yield the configuration; this is no longer true on 1.0+.
|
50
|
+
|
51
|
+
So, instead of using
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Rails.env.on(:development) do |config|
|
55
|
+
config.assets.version = '1.0'
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
59
|
+
use
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Rails.env.on(:development) do
|
63
|
+
config.assets.version = '1.0'
|
44
64
|
end
|
45
65
|
```
|
46
66
|
|
data/lib/rails-env.rb
CHANGED
data/lib/rails-env/version.rb
CHANGED
data/rails-env.gemspec
CHANGED
data/spec/rails-env_spec.rb
CHANGED
@@ -1,27 +1,43 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
class Callable
|
4
|
+
attr_accessor :configuration
|
5
|
+
|
6
|
+
def to_proc
|
7
|
+
callable = self
|
8
|
+
|
9
|
+
lambda do |app|
|
10
|
+
callable.configuration = config
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
3
15
|
describe RailsEnv do
|
4
16
|
it 'runs block when env matches' do
|
5
|
-
block =
|
6
|
-
expect(block).to receive(:call).with(Rails.configuration)
|
17
|
+
block = Callable.new
|
7
18
|
Rails.env.on(:test, &block)
|
19
|
+
|
20
|
+
expect(block.configuration).to eq(Rails.configuration)
|
8
21
|
end
|
9
22
|
|
10
23
|
it 'matches against multiple envs' do
|
11
|
-
block =
|
12
|
-
expect(block).to receive(:call).with(Rails.configuration)
|
24
|
+
block = Callable.new
|
13
25
|
Rails.env.on(:development, :test, &block)
|
26
|
+
|
27
|
+
expect(block.configuration).to eq(Rails.configuration)
|
14
28
|
end
|
15
29
|
|
16
30
|
it 'skips block when env differs' do
|
17
|
-
block =
|
18
|
-
expect(block).not_to receive(:call)
|
31
|
+
block = Callable.new
|
19
32
|
Rails.env.on(:production, &block)
|
33
|
+
|
34
|
+
expect(block.configuration).to be_nil
|
20
35
|
end
|
21
36
|
|
22
37
|
it 'runs on any environment' do
|
23
|
-
block =
|
24
|
-
expect(block).to receive(:call).with(Rails.configuration)
|
38
|
+
block = Callable.new
|
25
39
|
Rails.env.on(:any, &block)
|
40
|
+
|
41
|
+
expect(block.configuration).to eq(Rails.configuration)
|
26
42
|
end
|
27
43
|
end
|
data/spec/spec_helper.rb
CHANGED
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: 1.0.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: 2015-
|
11
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-meta
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Avoid environment detection on Rails
|
70
84
|
email:
|
71
85
|
- fnando.vieira@gmail.com
|
@@ -104,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
118
|
version: '0'
|
105
119
|
requirements: []
|
106
120
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.4.
|
121
|
+
rubygems_version: 2.4.6
|
108
122
|
signing_key:
|
109
123
|
specification_version: 4
|
110
124
|
summary: Avoid environment detection on Rails
|