brighter_planet_layout 0.2.47 → 0.2.48

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.47
1
+ 0.2.48
@@ -22,6 +22,10 @@ module BrighterPlanetHelper
22
22
  end
23
23
 
24
24
  def brighter_planet_layout_cdn_url(path)
25
- [ request.protocol, ::BrighterPlanetLayout::CDN, "/#{::BrighterPlanetLayout::VERSION}", path ].join
25
+ if ::Rails.env.production?
26
+ [ request.protocol, ::BrighterPlanetLayout::CDN, "/#{::BrighterPlanetLayout::VERSION}", path ].join
27
+ else
28
+ path
29
+ end
26
30
  end
27
31
  end
@@ -1,13 +1,15 @@
1
- <script type="text/javascript">
2
- //<![CDATA[
3
- var _gaq = _gaq || [];
4
- _gaq.push(['_setAccount', '<%= ::BrighterPlanetLayout.google_analytics_ua_number %>']);
5
- _gaq.push(['_trackPageview']);
1
+ <% if ::Rails.env.production? %>
2
+ <script type="text/javascript">
3
+ //<![CDATA[
4
+ var _gaq = _gaq || [];
5
+ _gaq.push(['_setAccount', '<%= ::BrighterPlanetLayout.google_analytics_ua_number %>']);
6
+ _gaq.push(['_trackPageview']);
6
7
 
7
- (function() {
8
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
9
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
11
- })();
12
- //]]>
13
- </script>
8
+ (function() {
9
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
10
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
11
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
12
+ })();
13
+ //]]>
14
+ </script>
15
+ <% end %>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{brighter_planet_layout}
8
- s.version = "0.2.47"
8
+ s.version = "0.2.48"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Rossmeissl", "Seamus Abshere"]
12
- s.date = %q{2010-11-19}
12
+ s.date = %q{2010-12-10}
13
13
  s.description = %q{Layouts, partials, stylesheets, and images}
14
14
  s.email = %q{andy@rossmeissl.net}
15
15
  s.extra_rdoc_files = [
@@ -8,8 +8,8 @@ module BrighterPlanetLayout
8
8
  GEM_ROOT = ::File.expand_path ::File.join(::File.dirname(__FILE__), '..')
9
9
  VERSION = ::YAML.load ::File.read(::File.join(GEM_ROOT, 'VERSION'))
10
10
  TWITTER_RSS = 'http://twitter.com/statuses/user_timeline/15042574.rss'
11
- BLOG_ATOM = 'http://numbers.brighterplanet.com/atom.xml'
12
- FEED_TIMEOUT = 5 # seconds
11
+ BLOG_ATOM = 'http://numbers.brighterplanet.com/latest.xml'
12
+ TIMEOUT = 5 # seconds
13
13
  CDN = 'do1ircpq72156.cloudfront.net'
14
14
  S3_BUCKET = 'brighterplanetlayout'
15
15
 
@@ -75,9 +75,7 @@ module BrighterPlanetLayout
75
75
  end
76
76
 
77
77
  def self.latest_tweet
78
- ::Timeout.timeout(FEED_TIMEOUT) do
79
- ::SimpleRSS.parse(get(TWITTER_RSS)).entries.first
80
- end
78
+ ::SimpleRSS.parse(get(TWITTER_RSS)).entries.first
81
79
  rescue ::SocketError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
82
80
  # nil
83
81
  rescue ::NoMethodError
@@ -85,20 +83,24 @@ module BrighterPlanetLayout
85
83
  end
86
84
 
87
85
  def self.latest_blog_post
88
- ::Timeout.timeout(FEED_TIMEOUT) do
89
- ::SimpleRSS.parse(get(BLOG_ATOM)).entries.first
90
- end
86
+ ::SimpleRSS.parse(get(BLOG_ATOM)).entries.first
91
87
  rescue ::SocketError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
92
88
  # nil
93
89
  rescue ::NoMethodError
94
90
  # nil
95
91
  end
96
92
 
93
+ def self.timer
94
+ defined?(::SystemTimer) ? ::SystemTimer : ::Timeout
95
+ end
96
+
97
97
  # sabshere 11/17/10 thanks dkastner
98
98
  def self.get(url)
99
- uri = URI.parse url
100
- response = Net::HTTP.start(uri.host, uri.port) do |http|
101
- http.get [uri.path, uri.query].compact.join('?')
99
+ uri = ::URI.parse url
100
+ response = timer.timeout(TIMEOUT) do
101
+ ::Net::HTTP.start(uri.host, uri.port) do |http|
102
+ http.get [uri.path, uri.query].compact.join('?')
103
+ end
102
104
  end
103
105
  response.body
104
106
  end
@@ -109,7 +111,7 @@ module BrighterPlanetLayout
109
111
  # ENV['AWS_SECRET_ACCESS_KEY'] =
110
112
  # ENV['AWS_ACCESS_KEY_ID'] =
111
113
  # ENV['AWS_SECRET_ACCESS_KEY'] =
112
- ENV['S3SYNC_NATIVE_CHARSET'] = 'UTF-8'
114
+ ::ENV['S3SYNC_NATIVE_CHARSET'] = 'UTF-8'
113
115
  cmd = "ruby #{ENV['S3SYNC_DIR']}/s3sync.rb --exclude=\"\\.ai\" -v -r --ssl --public-read #{public_path}/ #{S3_BUCKET}:#{VERSION}/"
114
116
  `#{cmd}`
115
117
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brighter_planet_layout
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 119
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 47
10
- version: 0.2.47
9
+ - 48
10
+ version: 0.2.48
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Rossmeissl
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-19 00:00:00 -06:00
19
+ date: 2010-12-10 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency