plek 0.3.0 → 0.4.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.
Files changed (3) hide show
  1. data/lib/plek.rb +2 -87
  2. data/lib/plek/version.rb +1 -1
  3. metadata +4 -4
data/lib/plek.rb CHANGED
@@ -6,10 +6,6 @@ class Plek
6
6
 
7
7
  SERVICES = {
8
8
  "production.www" => "www.gov.uk",
9
- "production.authentication" => "signon.production.alphagov.co.uk",
10
- "production.needs" => "needotron.production.alphagov.co.uk",
11
- "production.data" => "imminence.production.alphagov.co.uk",
12
- "production.arbiter" => "panopticon.production.alphagov.co.uk",
13
9
  "production.assets" => "static.production.alphagov.co.uk",
14
10
  "production.cdn" => "d17tffe05zdvwj.cloudfront.net",
15
11
  "production.publication-preview" => "private-frontend.production.alphagov.co.uk",
@@ -18,10 +14,6 @@ class Plek
18
14
  "production.#{DEFAULT_PATTERN}" => "%s.production.alphagov.co.uk",
19
15
 
20
16
  "preview.www" => "www.preview.alphagov.co.uk",
21
- "preview.authentication" => "signon.preview.alphagov.co.uk",
22
- "preview.needs" => "needotron.preview.alphagov.co.uk",
23
- "preview.data" => "imminence.preview.alphagov.co.uk",
24
- "preview.arbiter" => "panopticon.preview.alphagov.co.uk",
25
17
  "preview.assets" => "static.preview.alphagov.co.uk",
26
18
  "preview.cdn" => "djb1962t8apu5.cloudfront.net",
27
19
  "preview.publication-preview" => "private-frontend.preview.alphagov.co.uk",
@@ -31,20 +23,12 @@ class Plek
31
23
  "preview.#{DEFAULT_PATTERN}" => "%s.preview.alphagov.co.uk",
32
24
 
33
25
  "staging.frontend" => "demo.alphagov.co.uk",
34
- "staging.authentication" => "signon.alpha.gov.uk",
35
- "staging.needs" => "needotron.alpha.gov.uk",
36
26
  "staging.publisher" => "guides.staging.alphagov.co.uk",
37
- "staging.data" => "imminence.staging.alphagov.co.uk",
38
- "staging.arbiter" => "panopticon.staging.alphagov.co.uk",
39
27
  "staging.assets" => "static.staging.alphagov.co.uk",
40
28
  "staging.assets" => "static.staging.alphagov.co.uk",
41
29
  "staging.publication-preview" => "private-frontend.staging.alphagov.co.uk",
42
30
  "staging.#{DEFAULT_PATTERN}" => "%s.staging.alphagov.co.uk",
43
31
 
44
- "development.authentication" => "signon.dev.gov.uk",
45
- "development.needs" => "needotron.dev.gov.uk",
46
- "development.data" => "imminence.dev.gov.uk",
47
- "development.arbiter" => "panopticon.dev.gov.uk",
48
32
  "development.assets" => "static.dev.gov.uk",
49
33
  "development.cdn" => "static.dev.gov.uk",
50
34
  "development.whitehall" => "whitehall.dev.gov.uk",
@@ -52,10 +36,6 @@ class Plek
52
36
  "development.publication-preview"=> "www.dev.gov.uk",
53
37
  "development.#{DEFAULT_PATTERN}" => "%s.dev.gov.uk",
54
38
 
55
- "test.authentication" => "signon.test.gov.uk",
56
- "test.needs" => "needotron.test.gov.uk",
57
- "test.data" => "imminence.test.gov.uk",
58
- "test.arbiter" => "panopticon.test.gov.uk",
59
39
  "test.publication-preview" => "www.test.gov.uk",
60
40
  "test.cdn" => "static.test.gov.uk",
61
41
  "test.whitehall" => "whitehall.test.alphagov.co.uk",
@@ -63,45 +43,6 @@ class Plek
63
43
  "test.#{DEFAULT_PATTERN}" => "%s.test.gov.uk",
64
44
  }.freeze
65
45
 
66
- SERVICE_TOKENS = %w(
67
- frontend
68
- authentication
69
- needs
70
- publisher
71
- data
72
- arbiter
73
- search
74
- ).sort.freeze
75
-
76
- PURPOSE_FOR_SERVICE = {
77
- "need-o-tron" => "needs",
78
- "signon" => "authentication",
79
- "imminence" => "data",
80
- "panopticon" => "arbiter"
81
- }.freeze
82
-
83
- SERVICE_NAMES = %w(
84
- panopticon
85
- signon
86
- imminence
87
- publisher
88
- need-o-tron
89
- frontend
90
- search
91
- tariff
92
- ).sort.freeze
93
-
94
- SERVICE_NAMES.each do |service_name|
95
- # Backward compatibility
96
- method_name = service_name.gsub(/[^a-z]+/, '_')
97
- define_method method_name do
98
- name = PURPOSE_FOR_SERVICE[service_name] || service_name
99
- puts "Plek##{method_name} is deprecated and will be removed in an " +
100
- "upcoming release.\nUse `Plek#find('#{name}')` instead."
101
- find name
102
- end
103
- end
104
-
105
46
  attr_accessor :environment
106
47
  private :environment=
107
48
 
@@ -109,34 +50,8 @@ class Plek
109
50
  self.environment = environment
110
51
  end
111
52
 
112
- def to_xml
113
- io = StringIO.new
114
- builder = Builder::XmlMarkup.new :target => io, :spacing => 2
115
- builder.services :environment => environment do |services|
116
- SERVICE_TOKENS.each do |token|
117
- uri = find token
118
- services.service :token => token, :uri => uri
119
- end
120
- end
121
- io.rewind
122
- io.string
123
- end
124
-
125
- # Find the URI for a service.
126
- #
127
- # Services don't map directly to applications since we may replace an
128
- # application but retain the service.
129
- #
130
- # Currently we have these services:
131
- #
132
- # frontend: Where the public can see our output.
133
- # authentication: Where we send staff so they can log in.
134
- # publisher: Where we write content.
135
- # needs: Where we record the needs that we're going to fulfill.
136
- # data: Where our datasets live.
137
- # arbiter: organises data shared between the applications
138
- #
139
- def find service
53
+ # Find the URI for a service/application.
54
+ def find(service)
140
55
  name = name_for service
141
56
  host = SERVICES[service_key_for(name)]
142
57
  host ||= SERVICES["#{environment}.#{DEFAULT_PATTERN}"].to_s % name
data/lib/plek/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Plek
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: plek
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.4.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: 2012-08-02 00:00:00 Z
13
+ date: 2012-09-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: -2873474734768778572
74
+ hash: 3393726885730147352
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: -2873474734768778572
83
+ hash: 3393726885730147352
84
84
  segments:
85
85
  - 0
86
86
  version: "0"