exvo_helpers 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,10 +8,14 @@ module Exvo
8
8
  %w(cdn cfs desktop themes blog contacts inbox music pics preview).each do |service|
9
9
 
10
10
  # def self.cdn_uri
11
- # "http://#{cdn_host}"
11
+ # protocol = ["cdn", "cfs", "themes"].include?(service) && env.to_sym == :production ? "//" : "http://"
12
+ # protocol + cdn_host
12
13
  # end
13
14
  define_method "#{service}_uri" do
14
- "http://#{ send("#{service}_host") }"
15
+ # special link starting with '//' in production so that the webserver can choose between HTTP and HTTPS
16
+ # but only for those apps/services that have proper SSL support (i.e. valid certificates)
17
+ protocol = ["cdn", "cfs", "themes"].include?(service) && env.to_sym == :production ? "//" : "http://"
18
+ protocol + send("#{service}_host")
15
19
  end
16
20
 
17
21
  # def self.cdn_host
@@ -77,7 +81,7 @@ module Exvo
77
81
  def self.default_opts
78
82
  {
79
83
  :production => {
80
- :cdn_host => 'cdn.exvo.com',
84
+ :cdn_host => 'd33gjlr95u9pgf.cloudfront.net', # cloudfront.net so we can use https (cdn.exvo.com via https does not work properly)
81
85
  :cfs_host => 'cfs.exvo.com',
82
86
  :desktop_host => 'www.exvo.com',
83
87
  :themes_host => 'themes.exvo.com',
@@ -89,7 +93,7 @@ module Exvo
89
93
  :preview_host => 'preview.exvo.com'
90
94
  },
91
95
  :staging => {
92
- :cdn_host => 'staging.cdn.exvo.com',
96
+ :cdn_host => 'd1by559a994699.cloudfront.net',
93
97
  :cfs_host => 'staging.cfs.exvo.com',
94
98
  :desktop_host => 'www.exvo.co',
95
99
  :themes_host => 'staging.themes.exvo.com',
@@ -1,3 +1,3 @@
1
1
  module ExvoHelpers
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -6,13 +6,11 @@ module Exvo
6
6
  def javascript_bundle_include_tag(bundle)
7
7
  case Exvo::Helpers.env.to_sym
8
8
  when :production
9
- # FIXME change back to '//' in production so that the webserver can choose between HTTP and HTTPS
10
- # note, that it requires a proper SSL certificate installed for cdn.exvo.com domain
11
- javascript_include_tag "http://#{ Exvo::Helpers.cdn_host }/javascripts/#{bundle}.js"
9
+ javascript_include_tag "#{Exvo::Helpers.cdn_uri}/javascripts/#{bundle}.js"
12
10
  when :staging
13
- javascript_include_tag "http://#{ Exvo::Helpers.cdn_host }/javascripts/#{bundle}.js"
11
+ javascript_include_tag "#{Exvo::Helpers.cdn_uri}/javascripts/#{bundle}.js"
14
12
  else
15
- javascript_include_tag "http://#{ Exvo::Helpers.cdn_host }/javascripts/bundles/#{bundle}.js"
13
+ javascript_include_tag "#{Exvo::Helpers.cdn_uri}/javascripts/bundles/#{bundle}.js"
16
14
  end
17
15
  end
18
16
 
@@ -21,7 +21,7 @@ describe Exvo::Helpers do
21
21
  Exvo::Helpers.stub(:env).and_return('production')
22
22
  end
23
23
 
24
- specify { Exvo::Helpers.cdn_uri.should match('cdn.exvo.com') }
24
+ specify { Exvo::Helpers.cdn_uri.should match('d33gjlr95u9pgf.cloudfront.net') }
25
25
  specify { Exvo::Helpers.cfs_uri.should match('cfs.exvo.com') }
26
26
  specify { Exvo::Helpers.desktop_uri.should match('www.exvo.com') }
27
27
  specify { Exvo::Helpers.themes_uri.should match('themes.exvo.com') }
@@ -38,7 +38,7 @@ describe Exvo::Helpers do
38
38
  Exvo::Helpers.stub(:env).and_return('production')
39
39
  end
40
40
 
41
- specify { Exvo::Helpers.cdn_host.should eql('cdn.exvo.com') }
41
+ specify { Exvo::Helpers.cdn_host.should eql('d33gjlr95u9pgf.cloudfront.net') }
42
42
  specify { Exvo::Helpers.cfs_host.should eql('cfs.exvo.com') }
43
43
  specify { Exvo::Helpers.desktop_host.should eql('www.exvo.com') }
44
44
  specify { Exvo::Helpers.themes_host.should eql('themes.exvo.com') }
@@ -15,17 +15,17 @@ describe Exvo::ViewHelpers do
15
15
  end
16
16
 
17
17
  it "returns a javascript_include_tag based on env" do
18
- view_helper.should_receive(:javascript_include_tag).with("http://cdn.exvo.com/javascripts/plugins.js")
18
+ view_helper.should_receive(:javascript_include_tag).with("//d33gjlr95u9pgf.cloudfront.net/javascripts/plugins.js")
19
19
  view_helper.javascript_bundle_include_tag("plugins")
20
20
  end
21
21
 
22
22
  it "returns a stylesheet_link_tag based on env" do
23
- view_helper.should_receive(:stylesheet_link_tag).with("http://themes.exvo.com/stylesheets/themes/frost/all.css", { :media => 'all' })
23
+ view_helper.should_receive(:stylesheet_link_tag).with("//themes.exvo.com/stylesheets/themes/frost/all.css", { :media => 'all' })
24
24
  view_helper.themes_stylesheet_link_tag("frost/all", :media => 'all')
25
25
  end
26
26
 
27
27
  it "returns an image_tag based on env" do
28
- view_helper.should_receive(:image_tag).with("http://themes.exvo.com/stylesheets/images/icons/exvo.png", { :alt => 'Exvo' })
28
+ view_helper.should_receive(:image_tag).with("//themes.exvo.com/stylesheets/images/icons/exvo.png", { :alt => 'Exvo' })
29
29
  view_helper.themes_image_tag("icons/exvo.png", :alt => 'Exvo')
30
30
  end
31
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exvo_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-08 00:00:00.000000000Z
12
+ date: 2011-12-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &83106290 !ruby/object:Gem::Requirement
16
+ requirement: &76965090 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.7'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *83106290
24
+ version_requirements: *76965090
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: guard
27
- requirement: &83105480 !ruby/object:Gem::Requirement
27
+ requirement: &76962330 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *83105480
35
+ version_requirements: *76962330
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: guard-rspec
38
- requirement: &83103730 !ruby/object:Gem::Requirement
38
+ requirement: &76961760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.4.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *83103730
46
+ version_requirements: *76961760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rb-fsevent
49
- requirement: &83102830 !ruby/object:Gem::Requirement
49
+ requirement: &76961230 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *83102830
57
+ version_requirements: *76961230
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rb-inotify
60
- requirement: &83101560 !ruby/object:Gem::Requirement
60
+ requirement: &76954540 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *83101560
68
+ version_requirements: *76954540
69
69
  description: Ruby gem providing helper *_uri/*_host methods for Exvo services/apps
70
70
  like DESKTOP/CFS/AUTH/THEMES.
71
71
  email: