pco-url 1.0.0 → 1.1.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/lib/pco/url.rb +14 -10
- data/lib/pco/url/version.rb +1 -1
- data/spec/pco_url_spec.rb +25 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76f3a85257c51534d6c3c3b7cff02ef4e7ed031c
|
4
|
+
data.tar.gz: ed00adc04d8cf9cee80436b6d1202d8865d395cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18af49899e23166c8725c1e0c74cae5f4b4399b09dc274df17f33198684cf7921382e53766ed743d02e6550e6a975e6a33f0f468dfaad3b76dddf061fe8b83d1
|
7
|
+
data.tar.gz: 52248aba5e80184092128fd36984cf5047a60222d45e311448c3170506a632d5cbd2d4103532ed427d8dd55cc9c80ca1daa94d598d43b156037e89b881f48583
|
data/lib/pco/url.rb
CHANGED
@@ -2,19 +2,23 @@ require "pco/url/version"
|
|
2
2
|
|
3
3
|
module PCO
|
4
4
|
class URL
|
5
|
-
Applications = [
|
6
|
-
:accounts,
|
7
|
-
:avatars,
|
8
|
-
:services,
|
9
|
-
:check_ins,
|
10
|
-
:people,
|
11
|
-
:registrations,
|
12
|
-
:resources
|
13
|
-
]
|
14
5
|
|
15
6
|
class << self
|
7
|
+
def applications
|
8
|
+
@applications ||= [
|
9
|
+
:accounts,
|
10
|
+
:avatars,
|
11
|
+
:services,
|
12
|
+
:check_ins,
|
13
|
+
:people,
|
14
|
+
:registrations,
|
15
|
+
:resources
|
16
|
+
]
|
17
|
+
end
|
18
|
+
attr_writer :applications
|
19
|
+
|
16
20
|
def method_missing(method_name)
|
17
|
-
if
|
21
|
+
if applications.include? method_name
|
18
22
|
app_name = method_name.to_s.gsub("_", "-")
|
19
23
|
env_var = method_name.to_s.upcase + "_URL"
|
20
24
|
|
data/lib/pco/url/version.rb
CHANGED
data/spec/pco_url_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe PCO::URL do
|
|
7
7
|
Rails.env = "development"
|
8
8
|
end
|
9
9
|
|
10
|
-
PCO::URL
|
10
|
+
PCO::URL.applications.map(&:to_s).each do |app|
|
11
11
|
it "has an #{app} URL" do
|
12
12
|
expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.dev")
|
13
13
|
end
|
@@ -19,7 +19,7 @@ describe PCO::URL do
|
|
19
19
|
Rails.env = "staging"
|
20
20
|
end
|
21
21
|
|
22
|
-
PCO::URL
|
22
|
+
PCO::URL.applications.map(&:to_s).each do |app|
|
23
23
|
it "has an #{app} URL" do
|
24
24
|
expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}-staging.planningcenteronline.com")
|
25
25
|
end
|
@@ -31,7 +31,7 @@ describe PCO::URL do
|
|
31
31
|
Rails.env = "production"
|
32
32
|
end
|
33
33
|
|
34
|
-
PCO::URL
|
34
|
+
PCO::URL.applications.map(&:to_s).each do |app|
|
35
35
|
it "has an #{app} URL" do
|
36
36
|
expect(PCO::URL.send(app)).to eq("https://#{app.gsub('_','-')}.planningcenteronline.com")
|
37
37
|
end
|
@@ -43,7 +43,7 @@ describe PCO::URL do
|
|
43
43
|
Rails.env = "test"
|
44
44
|
end
|
45
45
|
|
46
|
-
PCO::URL
|
46
|
+
PCO::URL.applications.map(&:to_s).each do |app|
|
47
47
|
it "has an #{app} URL" do
|
48
48
|
expect(PCO::URL.send(app)).to eq("http://#{app.gsub('_','-')}.pco.test")
|
49
49
|
end
|
@@ -87,4 +87,25 @@ describe PCO::URL do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
describe "custom applications" do
|
92
|
+
before do
|
93
|
+
Rails.env = "development"
|
94
|
+
ENV["DEPLOY_ENV"] = nil
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "adding an app" do
|
98
|
+
it "adds a URL method for bazinga" do
|
99
|
+
PCO::URL.applications += [:bazinga]
|
100
|
+
expect(PCO::URL.bazinga).to eq("http://bazinga.pco.dev")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "removing an app" do
|
105
|
+
it "removes the URL method for accounts" do
|
106
|
+
PCO::URL.applications -= [:accounts]
|
107
|
+
expect{PCO::URL.accounts}.to raise_error(NoMethodError)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
90
111
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pco-url
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|