plek 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/lib/plek.rb +38 -0
- data/lib/plek/version.rb +3 -0
- metadata +65 -0
data/README.md
ADDED
data/lib/plek.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'plek/version'
|
2
|
+
|
3
|
+
class Plek
|
4
|
+
DOMAIN = {
|
5
|
+
"development" => "dev.gov.uk"
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_accessor :environment
|
9
|
+
private :environment=, :environment
|
10
|
+
|
11
|
+
def initialize environment
|
12
|
+
self.environment = environment
|
13
|
+
end
|
14
|
+
|
15
|
+
%W(panopticon sign-on-o-tron imminence publisher need-o-tron frontend).each do |service|
|
16
|
+
define_method service.gsub(/[^a-z]+/, '_') do
|
17
|
+
"#{name_for(service)}.#{domain}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def name_for service
|
22
|
+
case service
|
23
|
+
when 'frontend'
|
24
|
+
'www'
|
25
|
+
else
|
26
|
+
service.gsub(/[^a-z]+/, '')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def domain
|
31
|
+
DOMAIN[environment]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.current
|
35
|
+
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
36
|
+
Plek.new env
|
37
|
+
end
|
38
|
+
end
|
data/lib/plek/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: plek
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Craig R Webster
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-09-19 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Find the right hostname for each service in an environment-dependent manner
|
22
|
+
email:
|
23
|
+
- craig@barkingiguana.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/plek/version.rb
|
32
|
+
- lib/plek.rb
|
33
|
+
- README.md
|
34
|
+
has_rdoc: true
|
35
|
+
homepage:
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.3.6
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Locations for services
|
64
|
+
test_files: []
|
65
|
+
|