smart_env 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/smart_env/uri_proxy.rb +3 -3
- data/lib/smart_env/version.rb +1 -1
- data/spec/uri_spec.rb +8 -3
- metadata +63 -43
data/lib/smart_env/uri_proxy.rb
CHANGED
@@ -21,15 +21,15 @@ module SmartEnv
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
#for SmartEnv
|
24
25
|
def self.when(key, value)
|
25
26
|
value.match(/^\w+:\/\//)
|
26
27
|
end
|
27
28
|
|
28
|
-
def base_uri
|
29
|
+
def base_uri(port = true)
|
29
30
|
base = "#{@uri.scheme}://#{@uri.host}"
|
30
|
-
|
31
|
+
port ? "#{base}:#{@uri.port}" : base
|
31
32
|
end
|
32
|
-
alias url base_uri
|
33
33
|
|
34
34
|
def method_missing(method, *args, &block)
|
35
35
|
@original.send(method, *args, &block)
|
data/lib/smart_env/version.rb
CHANGED
data/spec/uri_spec.rb
CHANGED
@@ -25,9 +25,14 @@ describe SmartEnv, 'uri support' do
|
|
25
25
|
ENV['FOO'].should == @url
|
26
26
|
end
|
27
27
|
|
28
|
-
it "should return scheme://host for #base_uri
|
29
|
-
ENV['FOO'].base_uri.should == 'http://this.domain.example.com:3000
|
30
|
-
ENV['FOO']
|
28
|
+
it "should return scheme://host:port for #base_uri" do
|
29
|
+
ENV['FOO'].base_uri.should == 'http://this.domain.example.com:3000'
|
30
|
+
ENV['FOO'] = @url.gsub(':3000','')
|
31
|
+
ENV['FOO'].base_uri.should == 'http://this.domain.example.com:80'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return scheme://host for #base_uri(false)" do
|
35
|
+
ENV['FOO'].base_uri(false).should == 'http://this.domain.example.com'
|
31
36
|
end
|
32
37
|
|
33
38
|
it "should respond to #scheme with the scheme" do
|
metadata
CHANGED
@@ -1,46 +1,62 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_env
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Chris Continanza
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2011-10-11 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: rspec
|
16
|
-
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
25
|
+
requirements:
|
19
26
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
22
|
-
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 0
|
32
|
+
version: "2.0"
|
23
33
|
prerelease: false
|
24
|
-
|
25
|
-
|
34
|
+
type: :development
|
35
|
+
requirement: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
26
37
|
name: rcov
|
27
|
-
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
|
-
requirements:
|
30
|
-
- -
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
|
33
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
34
47
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
email:
|
48
|
+
type: :development
|
49
|
+
requirement: *id002
|
50
|
+
description: Allows you to register Proxy classes for ENV vars by using blocks to match keys and values
|
51
|
+
email:
|
39
52
|
- christopher.continanza@gmail.com
|
40
53
|
executables: []
|
54
|
+
|
41
55
|
extensions: []
|
56
|
+
|
42
57
|
extra_rdoc_files: []
|
43
|
-
|
58
|
+
|
59
|
+
files:
|
44
60
|
- .gitignore
|
45
61
|
- Gemfile
|
46
62
|
- LICENSE
|
@@ -55,37 +71,41 @@ files:
|
|
55
71
|
- spec/registry_spec.rb
|
56
72
|
- spec/spec_helper.rb
|
57
73
|
- spec/uri_spec.rb
|
58
|
-
|
74
|
+
has_rdoc: true
|
75
|
+
homepage: ""
|
59
76
|
licenses: []
|
77
|
+
|
60
78
|
post_install_message:
|
61
79
|
rdoc_options: []
|
62
|
-
|
80
|
+
|
81
|
+
require_paths:
|
63
82
|
- lib
|
64
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
84
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
segments:
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
71
90
|
- 0
|
72
|
-
|
73
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
version: "0"
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
93
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
segments:
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
80
99
|
- 0
|
81
|
-
|
100
|
+
version: "0"
|
82
101
|
requirements: []
|
102
|
+
|
83
103
|
rubyforge_project: smart_env
|
84
|
-
rubygems_version: 1.
|
104
|
+
rubygems_version: 1.6.2
|
85
105
|
signing_key:
|
86
106
|
specification_version: 3
|
87
107
|
summary: Lazily proxy ENV values
|
88
|
-
test_files:
|
108
|
+
test_files:
|
89
109
|
- spec/decoration_spec.rb
|
90
110
|
- spec/load_unload_spec.rb
|
91
111
|
- spec/registry_spec.rb
|