asset_host_selection 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e444805678d86ed814a27649ad1eb2630e4094c4
4
+ data.tar.gz: c7be0cfe934d0bd2b63803164d5aaea42844253a
5
+ SHA512:
6
+ metadata.gz: 45f233decf3651453c08c04358cb0d5ebc3132ee96811ce3fc631131fdc0fc1f02dde050aa756e70d06d439cf19a1a9d303aea60ac9c7e29996bfacfa45c6a8c
7
+ data.tar.gz: f4fe9db08a4fe2f0dec2155ab1193a345ebd3dfee49f9862283b1d5ee70530bb667a184c94ffd4400e76441629ad22b5ed14b8e7ec4ed9f1648a283a4ff4204c
@@ -6,8 +6,12 @@ module AssetHostSelection
6
6
 
7
7
  def self.build_all(attributes = {})
8
8
  providers = {}
9
+ settings_to_provider = {}
10
+ settings_to_provider.compare_by_identity
9
11
  attributes.each do |key, settings|
10
- providers[key.to_sym] = new(settings)
12
+ providers[key.to_sym] = settings_to_provider.fetch(settings) do
13
+ settings_to_provider[settings] = new(settings)
14
+ end
11
15
  end
12
16
 
13
17
  providers
@@ -19,6 +19,18 @@ describe AssetHostSelection do
19
19
  assert_equal "local.example.com", @local.host
20
20
  end
21
21
 
22
+ it "creates only one provider object per settings" do
23
+ provider_settings = {
24
+ :cdn => { :domain => 'example.com', :subdomain => 'cdn', :enabled => true, :cdn => true },
25
+ :local => { :domain => 'example.com', :subdomain => 'local', :enabled => true, :cdn => false }
26
+ }
27
+ provider_settings[:default] = provider_settings[:cdn]
28
+ provider_settings[:disabled] = provider_settings[:local]
29
+ providers = AssetHostSelection::AssetProvider.build_all(provider_settings)
30
+ assert_equal providers[:cdn], providers[:default]
31
+ assert_equal providers[:local], providers[:disabled]
32
+ end
33
+
22
34
  describe "#enabled?" do
23
35
  after do
24
36
  ENV.delete("DISABLE_CDN")
metadata CHANGED
@@ -1,68 +1,62 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_host_selection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Chapweske
9
8
  - Morten Primdahl
9
+ - Gary Grossman
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-17 00:00:00.000000000 Z
13
+ date: 2014-07-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
17
17
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
18
  requirements:
20
- - - ! '>='
19
+ - - ">="
21
20
  - !ruby/object:Gem::Version
22
21
  version: '0'
23
22
  type: :development
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
25
  requirements:
28
- - - ! '>='
26
+ - - ">="
29
27
  - !ruby/object:Gem::Version
30
28
  version: '0'
31
29
  - !ruby/object:Gem::Dependency
32
30
  name: bundler
33
31
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
32
  requirements:
36
- - - ! '>='
33
+ - - ">="
37
34
  - !ruby/object:Gem::Version
38
35
  version: '0'
39
36
  type: :development
40
37
  prerelease: false
41
38
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
39
  requirements:
44
- - - ! '>='
40
+ - - ">="
45
41
  - !ruby/object:Gem::Version
46
42
  version: '0'
47
43
  - !ruby/object:Gem::Dependency
48
44
  name: rack
49
45
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
46
  requirements:
52
- - - ! '>='
47
+ - - ">="
53
48
  - !ruby/object:Gem::Version
54
49
  version: '0'
55
50
  type: :development
56
51
  prerelease: false
57
52
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
53
  requirements:
60
- - - ! '>='
54
+ - - ">="
61
55
  - !ruby/object:Gem::Version
62
56
  version: '0'
63
57
  description: Adds support for serving assets from multiple providers.
64
58
  email:
65
- - eac@zendesk.com
59
+ - ggrossman@zendesk.com
66
60
  executables: []
67
61
  extensions: []
68
62
  extra_rdoc_files: []
@@ -73,27 +67,26 @@ files:
73
67
  homepage: http://github.com/zendesk/asset_host_selection
74
68
  licenses:
75
69
  - Apache License Version 2.0
70
+ metadata: {}
76
71
  post_install_message:
77
72
  rdoc_options: []
78
73
  require_paths:
79
74
  - lib
80
75
  required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
76
  requirements:
83
- - - ! '>='
77
+ - - ">="
84
78
  - !ruby/object:Gem::Version
85
79
  version: '0'
86
80
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
81
  requirements:
89
- - - ! '>='
82
+ - - ">="
90
83
  - !ruby/object:Gem::Version
91
84
  version: 1.3.6
92
85
  requirements: []
93
86
  rubyforge_project:
94
- rubygems_version: 1.8.25
87
+ rubygems_version: 2.2.2
95
88
  signing_key:
96
- specification_version: 3
89
+ specification_version: 4
97
90
  summary: Multiple asset host selection for ActionController
98
91
  test_files:
99
92
  - test/asset_host_selection_test.rb