odania 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71c39b77fdbe736a7a7352a05acde79ff6e082e5
4
- data.tar.gz: aec4430b75ad1736b44df6d98400aaf9ad4bf5bf
3
+ metadata.gz: ae87f0f013140efcdf8328a06001147992f74057
4
+ data.tar.gz: 50e7e1e500ad4c62e4d15ebcab5fd6d6394ffcad
5
5
  SHA512:
6
- metadata.gz: 986331b8dcd18a337313e60e04a3547e68a3df4164398a311fd70bfbd661bb9959137b81254c474e01b4ac3a04e95c26b76b1ecd876f18c81d6ce13336d83c54
7
- data.tar.gz: cc82c6eb9fe675f8f9b9bbe300e7ea021565922c9d249848bc302a60346f8b641d8f98c72be2d055614d478830745a791e92d20c8ffb18c9616d2693ac466d7b
6
+ metadata.gz: eb9bbcf5a1b578af277a70b651bf6dadbe7fa199ea31083689e351c7ff4876ea781b44f5f03b36c06f0d6d5900a86967e06484589c8dfbbd99a55368aef90393
7
+ data.tar.gz: 97e32bec1b907584c1dab1d9c4948d5900e9334a5e967eabc7e7e0059f7a1ddb59339053ddb444efe13ccb2296ffe0e5015308fdd357454517f7f0e0adfde2b7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- odania (0.0.35)
4
+ odania (0.0.36)
5
5
  deep_merge
6
6
  diplomat
7
7
  erubis
@@ -9,27 +9,27 @@ Feature: Plugins
9
9
  Scenario: Registering multiple instances of one plugin
10
10
  Given I initialize the gem
11
11
  When I registered the plugin "test-plugin"
12
- And I registered the plugin "test-plugin"
13
- And I registered the plugin "test-plugin"
12
+ And I registered the plugin "test-plugin"
13
+ And I registered the plugin "test-plugin"
14
14
  Then I should see "3" instances of the plugin "test-plugin"
15
15
 
16
16
  Scenario: Registering multiple plugins
17
17
  Given I initialize the gem
18
18
  When I registered the plugin "test-plugin"
19
- And I registered the plugin "test-plugin"
20
- And I registered the plugin "test-plugin-2"
19
+ And I registered the plugin "test-plugin"
20
+ And I registered the plugin "test-plugin-2"
21
21
  Then I should see "2" instances of the plugin "test-plugin"
22
- And I should see "1" instances of the plugin "test-plugin-2"
22
+ And I should see "1" instances of the plugin "test-plugin-2"
23
23
 
24
24
  Scenario: Retrieving plugin instance name
25
25
  Given I initialize the gem
26
26
  When I retrieve plugin instance name for "test-plugin"
27
- And I retrieve plugin instance name for "test-plugin"
27
+ And I retrieve plugin instance name for "test-plugin"
28
28
  Then I should retrieve "test-plugin_1"
29
29
 
30
30
  Scenario: Build new joined plugin config
31
31
  Given I initialize the gem
32
32
  When I registered the plugin "test-plugin"
33
- And I generate the joined plugin config
33
+ And I generate the joined plugin config
34
34
  Then I have a joined plugin config
35
- And The joined plugin config contains the plugin "test-plugin"
35
+ And The joined plugin config contains the plugin "test-plugin"
@@ -20,9 +20,6 @@ Given(/^I registered the plugin "([^"]*)"$/) do |plugin_name|
20
20
  'ip' => '127.0.0.1',
21
21
  'port' => 80,
22
22
  'tags' => ["plugin-#{plugin_name}"],
23
- 'default_subdomains' => {
24
- '_general' => 'default_sub'
25
- },
26
23
  'domains' => {
27
24
  'odania.com' => {
28
25
  'contents' => {
@@ -34,7 +31,6 @@ Given(/^I registered the plugin "([^"]*)"$/) do |plugin_name|
34
31
  'languages' => %w(de en),
35
32
  'layout' => 'simple',
36
33
  'language_selector' => 'prefix',
37
- 'default_subdomain' => 'page_sub',
38
34
  'redirects' => {
39
35
  '^/test' => '/games'
40
36
  }
@@ -7,6 +7,8 @@ module Odania
7
7
 
8
8
  reset
9
9
  @default_backend_groups = config['default_backend_groups'] unless config['default_backend_groups'].nil?
10
+ @valid_domains = config['valid_domains'] unless config['valid_domains'].nil?
11
+ @default_domains = config['default_domains'] unless config['default_domains'].nil?
10
12
 
11
13
  unless config['domains'].nil?
12
14
  config['domains'].each_pair do |name, data|
@@ -80,7 +82,8 @@ module Odania
80
82
  end
81
83
 
82
84
  @plugin_config[group_name] = plugin_cfg['plugin-config']
83
- @default_subdomains.deep_merge(plugin_cfg['default_subdomains']) unless plugin_cfg['default_subdomains'].nil?
85
+ @valid_domains.deep_merge!(plugin_cfg['valid_domains']) unless plugin_cfg['valid_domains'].nil?
86
+ @default_domains.deep_merge!(plugin_cfg['default_domains']) unless plugin_cfg['default_domains'].nil?
84
87
 
85
88
  # Add this service as a default backend if specified
86
89
  @default_backend_groups << group_name if plugin_cfg['plugin-config']['default']
@@ -121,7 +124,8 @@ module Odania
121
124
  @default_backend_groups = []
122
125
  @duplicates = Duplicates.new
123
126
  @backend_groups = Hash.new { |hash, key| hash[key] = BackendGroup.new(key) }
124
- @default_subdomains = {}
127
+ @valid_domains = {}
128
+ @default_domains = {}
125
129
 
126
130
  @domains['_general'].add_subdomain('_general')
127
131
  end
@@ -141,8 +145,12 @@ module Odania
141
145
  @backend_groups[group_name].backends.first
142
146
  end
143
147
 
144
- def default_subdomains
145
- @default_subdomains
148
+ def valid_domains
149
+ @valid_domains
150
+ end
151
+
152
+ def default_domains
153
+ @default_domains
146
154
  end
147
155
 
148
156
  def default_redirects
@@ -154,6 +162,8 @@ module Odania
154
162
  def dump
155
163
  cfg = super
156
164
  cfg['default_backend_groups'] = @default_backend_groups
165
+ cfg['default_domains'] = @default_domains
166
+ cfg['valid_domains'] = @valid_domains
157
167
  cfg
158
168
  end
159
169
  end
@@ -1,7 +1,7 @@
1
1
  module Odania
2
2
  module Config
3
3
  class PluginConfig
4
- attr_accessor :domains, :config, :default_subdomains, :plugin_config
4
+ attr_accessor :domains, :config, :valid_domains, :default_domains, :plugin_config
5
5
 
6
6
  def initialize
7
7
  reset
@@ -12,7 +12,8 @@ module Odania
12
12
  reset
13
13
  @config = data['config'] unless data['config'].nil?
14
14
  @plugin_config = data['plugin-config'] unless data['plugin-config'].nil?
15
- @default_subdomains = data['default_subdomains'] unless data['default_subdomains'].nil?
15
+ @valid_domains = data['valid_domains'] unless data['valid_domains'].nil?
16
+ @default_domains = data['default_domains'] unless data['default_domains'].nil?
16
17
  unless data['domains'].nil?
17
18
  data['domains'].each_pair do |name, domain_data|
18
19
  @domains[name].load(domain_data)
@@ -30,6 +31,8 @@ module Odania
30
31
  def reset
31
32
  @config = {}
32
33
  @plugin_config = {}
34
+ @default_domains = {}
35
+ @valid_domains = {}
33
36
  @domains = Hash.new { |hash, key| hash[key] = Domain.new(key) }
34
37
  end
35
38
 
@@ -42,7 +45,8 @@ module Odania
42
45
  {
43
46
  'plugin-config' => plugin_config,
44
47
  'config' => config,
45
- 'default_subdomains' => @default_subdomains,
48
+ 'default_domains' => @default_domains,
49
+ 'valid_domains' => @valid_domains,
46
50
  'domains' => domain_data
47
51
  }
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module Odania
2
- VERSION = '0.0.35'
2
+ VERSION = '0.0.36'
3
3
  end
@@ -18,8 +18,15 @@
18
18
  ]
19
19
  }
20
20
  },
21
- "default_subdomains": {
22
- "_general": "www"
21
+ "valid_domains": {
22
+ "example.com": [
23
+ "www"
24
+ ]
25
+ },
26
+ "default_domains": {
27
+ "example.com": [
28
+ "www"
29
+ ]
23
30
  },
24
31
  "domains": {
25
32
  "_general": {
@@ -13,8 +13,15 @@
13
13
  "config": {
14
14
  "title": "This is my awesome title"
15
15
  },
16
- "default_subdomains": {
17
- "_general": "www"
16
+ "valid_domains": {
17
+ "example.com": [
18
+ "www"
19
+ ]
20
+ },
21
+ "default_domains": {
22
+ "example.com": [
23
+ "www"
24
+ ]
18
25
  },
19
26
  "domains": {
20
27
  "_general": {
@@ -42,23 +42,23 @@ describe Odania::Config::GlobalConfig do
42
42
  $consul_mock.service.services = {
43
43
  cfg_name => [
44
44
  OpenStruct.new({
45
- 'Node' => 'agent-one',
46
- 'Address' => '172.20.20.1',
47
- 'ServiceID' => "#{cfg_name}_1",
48
- 'ServiceName' => cfg_name,
49
- 'ServiceTags' => [],
50
- 'ServicePort' => 80,
51
- 'ServiceAddress' => '172.20.20.1'
52
- }),
45
+ 'Node' => 'agent-one',
46
+ 'Address' => '172.20.20.1',
47
+ 'ServiceID' => "#{cfg_name}_1",
48
+ 'ServiceName' => cfg_name,
49
+ 'ServiceTags' => [],
50
+ 'ServicePort' => 80,
51
+ 'ServiceAddress' => '172.20.20.1'
52
+ }),
53
53
  OpenStruct.new({
54
- 'Node' => 'agent-two',
55
- 'Address' => '172.20.20.2',
56
- 'ServiceID' => "#{cfg_name}_2",
57
- 'ServiceName' => cfg_name,
58
- 'ServiceTags' => [],
59
- 'ServicePort' => 80,
60
- 'ServiceAddress' => '172.20.20.1'
61
- })
54
+ 'Node' => 'agent-two',
55
+ 'Address' => '172.20.20.2',
56
+ 'ServiceID' => "#{cfg_name}_2",
57
+ 'ServiceName' => cfg_name,
58
+ 'ServiceTags' => [],
59
+ 'ServicePort' => 80,
60
+ 'ServiceAddress' => '172.20.20.1'
61
+ })
62
62
  ]
63
63
  }
64
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odania
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Petersen