plek 0.1.0 → 0.1.1
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 +28 -5
- data/lib/plek/version.rb +1 -1
- metadata +2 -2
data/lib/plek.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'builder'
|
1
2
|
require 'plek/version'
|
2
3
|
|
3
4
|
class Plek
|
@@ -7,10 +8,10 @@ class Plek
|
|
7
8
|
"staging.frontend" => "demo.alphagov.co.uk",
|
8
9
|
"staging.authentication" => "signonotron.alpha.gov.uk",
|
9
10
|
"staging.needs" => "needotron.alpha.gov.uk",
|
10
|
-
"staging.publisher" => "guides.staging.alphagov.co.uk
|
11
|
-
"staging.data" => "imminence.staging.alphagov.co.uk
|
12
|
-
"staging.arbiter" => "panopticon.staging.alphagov.co.uk
|
13
|
-
"staging.#{DEFAULT_PATTERN}" => "%s.staging.alphagov.co.uk
|
11
|
+
"staging.publisher" => "guides.staging.alphagov.co.uk",
|
12
|
+
"staging.data" => "imminence.staging.alphagov.co.uk",
|
13
|
+
"staging.arbiter" => "panopticon.staging.alphagov.co.uk",
|
14
|
+
"staging.#{DEFAULT_PATTERN}" => "%s.staging.alphagov.co.uk",
|
14
15
|
|
15
16
|
"development.authentication" => "signonotron.dev.gov.uk",
|
16
17
|
"development.needs" => "needotron.dev.gov.uk",
|
@@ -25,6 +26,15 @@ class Plek
|
|
25
26
|
"test.#{DEFAULT_PATTERN}" => "%s.test.gov.uk",
|
26
27
|
}.freeze
|
27
28
|
|
29
|
+
SERVICE_TOKENS = %w(
|
30
|
+
frontend
|
31
|
+
authentication
|
32
|
+
needs
|
33
|
+
publisher
|
34
|
+
data
|
35
|
+
arbiter
|
36
|
+
).sort.freeze
|
37
|
+
|
28
38
|
PURPOSE_FOR_SERVICE = {
|
29
39
|
"need-o-tron" => "needs",
|
30
40
|
"sign-on-o-tron" => "authentication",
|
@@ -39,7 +49,7 @@ class Plek
|
|
39
49
|
publisher
|
40
50
|
need-o-tron
|
41
51
|
frontend
|
42
|
-
).freeze
|
52
|
+
).sort.freeze
|
43
53
|
|
44
54
|
SERVICE_NAMES.each do |service_name|
|
45
55
|
# Backward compatibility
|
@@ -59,6 +69,19 @@ class Plek
|
|
59
69
|
self.environment = environment
|
60
70
|
end
|
61
71
|
|
72
|
+
def to_xml
|
73
|
+
io = StringIO.new
|
74
|
+
builder = Builder::XmlMarkup.new :target => io, :spacing => 2
|
75
|
+
builder.services :environment => environment do |services|
|
76
|
+
SERVICE_TOKENS.each do |token|
|
77
|
+
uri = find token
|
78
|
+
services.service :token => token, :uri => uri
|
79
|
+
end
|
80
|
+
end
|
81
|
+
io.rewind
|
82
|
+
io.string
|
83
|
+
end
|
84
|
+
|
62
85
|
# Find the URI for a service.
|
63
86
|
#
|
64
87
|
# Services don't map directly to applications since we may replace an
|
data/lib/plek/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-03 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Find the right hostname for each service in an environment-dependent
|
15
15
|
manner
|