plek 1.1.0 → 1.2.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.
- data/lib/plek.rb +13 -5
- data/lib/plek/version.rb +1 -1
- metadata +4 -4
data/lib/plek.rb
CHANGED
|
@@ -9,7 +9,7 @@ class Plek
|
|
|
9
9
|
attr_accessor :parent_domain
|
|
10
10
|
|
|
11
11
|
def initialize(domain_to_use = nil)
|
|
12
|
-
self.parent_domain = domain_to_use ||
|
|
12
|
+
self.parent_domain = domain_to_use || env_var_or_dev_fallback("GOVUK_APP_DOMAIN", "dev.gov.uk")
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Find the URI for a service/application.
|
|
@@ -24,6 +24,10 @@ class Plek
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def website_root
|
|
28
|
+
env_var_or_dev_fallback("GOVUK_WEBSITE_ROOT") { find("www") }
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
def name_for(service)
|
|
28
32
|
name = service.to_s.dup
|
|
29
33
|
name.downcase!
|
|
@@ -42,11 +46,15 @@ class Plek
|
|
|
42
46
|
|
|
43
47
|
private
|
|
44
48
|
|
|
45
|
-
def
|
|
46
|
-
if
|
|
47
|
-
|
|
49
|
+
def env_var_or_dev_fallback(var_name, fallback_str = nil)
|
|
50
|
+
if var = ENV[var_name]
|
|
51
|
+
var
|
|
52
|
+
elsif ENV["RAILS_ENV"] == "production" || ENV["RACK_ENV"] == "production"
|
|
53
|
+
raise(NoConfigurationError, "Expected #{var_name} to be set. Perhaps you should run your task through govuk_setenv <appname>?")
|
|
54
|
+
elsif block_given?
|
|
55
|
+
yield
|
|
48
56
|
else
|
|
49
|
-
|
|
57
|
+
fallback_str
|
|
50
58
|
end
|
|
51
59
|
end
|
|
52
60
|
end
|
data/lib/plek/version.rb
CHANGED
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: plek
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 1.
|
|
5
|
+
version: 1.2.0
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Craig R Webster
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2013-
|
|
13
|
+
date: 2013-02-19 00:00:00 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: builder
|
|
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
71
71
|
requirements:
|
|
72
72
|
- - ">="
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
hash: -
|
|
74
|
+
hash: -1467535628951197527
|
|
75
75
|
segments:
|
|
76
76
|
- 0
|
|
77
77
|
version: "0"
|
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
80
|
requirements:
|
|
81
81
|
- - ">="
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
hash: -
|
|
83
|
+
hash: -1467535628951197527
|
|
84
84
|
segments:
|
|
85
85
|
- 0
|
|
86
86
|
version: "0"
|