brighter_planet_layout 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+ Gemfile.lock
23
+ secret.sh
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in brighter_planet_layout.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,27 +1,7 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "brighter_planet_layout"
8
- gem.summary = %Q{Layout assets for Brighter Planet sites}
9
- gem.description = %Q{Layouts, partials, stylesheets, and images}
10
- gem.email = "andy@rossmeissl.net"
11
- gem.homepage = "http://github.com/brighterplanet/brighter_planet_layout"
12
- gem.authors = ["Andy Rossmeissl", "Seamus Abshere"]
13
- # doesn't work in ruby 1.9; use spox-ultraviolet
14
- # each app is going to have to require this separately
15
- # gem.add_dependency 'ultraviolet', '>=0.10.2'
16
- gem.add_dependency 'simple-rss', '>=1.2.3'
17
- gem.files.reject! { |fn| fn.downcase =~ /\.ai$/ }
18
- gem.files.reject! { |fn| fn.downcase =~ /\.psd$/ }
19
- end
20
- Jeweler::GemcutterTasks.new
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
24
3
 
4
+ require 'rake'
25
5
  require 'rake/testtask'
26
6
  Rake::TestTask.new(:test) do |test|
27
7
  test.libs << 'lib' << 'test'
@@ -30,28 +10,63 @@ Rake::TestTask.new(:test) do |test|
30
10
  end
31
11
 
32
12
  begin
33
- require 'rcov/rcovtask'
34
- Rcov::RcovTask.new do |test|
35
- test.libs << 'test'
36
- test.pattern = 'test/**/test_*.rb'
37
- test.verbose = true
13
+ require 'rake/rdoctask'
14
+ Rake::RDocTask.new do |rdoc|
15
+ rdoc.rdoc_dir = 'rdoc'
16
+ rdoc.title = 'remote_table'
17
+ rdoc.options << '--line-numbers' << '--inline-source'
18
+ rdoc.rdoc_files.include('README*')
19
+ rdoc.rdoc_files.include('lib/**/*.rb')
38
20
  end
39
21
  rescue LoadError
40
- task :rcov do
41
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
- end
22
+ puts "Rdoc is not available"
43
23
  end
44
24
 
45
- task :test => :check_dependencies
46
-
47
- task :default => :test
48
-
49
- require 'rake/rdoctask'
50
- Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
-
53
- rdoc.rdoc_dir = 'rdoc'
54
- rdoc.title = "brighter_planet_layout #{version}"
55
- rdoc.rdoc_files.include('README*')
56
- rdoc.rdoc_files.include('lib/**/*.rb')
25
+ # sabshere 11/17/10 not worth it --cache-control=\"public, max-age=7776000\"
26
+ task :update_s3 do
27
+ missing = %w{ AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY SSL_CERT_DIR S3SYNC_DIR }.select { |i| ENV[i].to_s.empty? }
28
+ raise "get #{missing.join(', ')} from Seamus" unless missing.empty?
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
30
+ require 'brighter_planet_layout'
31
+ ENV['S3SYNC_NATIVE_CHARSET'] = 'UTF-8'
32
+ cmd = "ruby #{ENV['S3SYNC_DIR']}/s3sync.rb #{'--dryrun ' unless ENV['REAL'] == 'true'}--exclude=\"\\.ai\" --exclude=\"\\.psd\" -v -r --ssl --public-read #{BrighterPlanetLayout.public_path}/ #{BrighterPlanetLayout::S3_BUCKET}:#{BrighterPlanetLayout::VERSION}/"
33
+ if ENV['REAL'] == 'true'
34
+ $stderr.puts "Really updating"
35
+ else
36
+ $stderr.puts "Dry run... set REAL=true if you want to update for real"
37
+ end
38
+ $stderr.puts cmd
39
+ system cmd
40
+ $stderr.puts "Done"
57
41
  end
42
+
43
+ # sabshere 11/18/10 access control header doesn't work
44
+ # vidalia:~/github/brighter_planet_layout (master) $ ruby ~/bp/propsgod/s3sync/s3cmd.rb -v -s put brighterplanetlayout:0.2.43/stylesheets/fonts/KievitWebPro.woff public/stylesheets/fonts/KievitWebPro.woff x-amz-acl:public-read "Access-Control-Allow-Origin:*"
45
+ # put to key brighterplanetlayout:0.2.43/stylesheets/fonts/KievitWebPro.woff from public/stylesheets/fonts/KievitWebPro.woff {"Access-Control-Allow-Origin"=>"*", "x-amz-acl"=>"public-read", "Content-Length"=>"61924"}
46
+ #
47
+ # vidalia:~ $ curl -O -v http://brighterplanetlayout.s3.amazonaws.com/0.2.43/stylesheets/fonts/KievitWebPro.woff* About to connect() to brighterplanetlayout.s3.amazonaws.com port 80 (#0)
48
+ # * Trying 72.21.207.165... % Total % Received % Xferd Average Speed Time Time Time Current
49
+ # Dload Upload Total Spent Left Speed
50
+ # 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
51
+ # * Connected to brighterplanetlayout.s3.amazonaws.com (72.21.207.165) port 80 (#0)
52
+ # > GET /0.2.43/stylesheets/fonts/KievitWebPro.woff HTTP/1.1
53
+ # > User-Agent: curl/7.20.0 (i386-apple-darwin9.8.0) libcurl/7.20.0 OpenSSL/0.9.8m zlib/1.2.3 libidn/1.16
54
+ # > Host: brighterplanetlayout.s3.amazonaws.com
55
+ # > Accept: */*
56
+ # >
57
+ # < HTTP/1.1 200 OK
58
+ # < x-amz-id-2: lVNwntUjGX/0UxlygqXa+8yR2hFpAV+EZAzITK/ZMJQTnTOuJXvHEULNgPr1r9vt
59
+ # < x-amz-request-id: 2B46C5DEBD6083E3
60
+ # < Date: Thu, 18 Nov 2010 15:36:14 GMT
61
+ # < Last-Modified: Thu, 18 Nov 2010 15:33:11 GMT
62
+ # < ETag: "83c664104e2127f1b8519b653adc98dd"
63
+ # < Accept-Ranges: bytes
64
+ # < Content-Type:
65
+ # < Content-Length: 61924
66
+ # < Server: AmazonS3
67
+ # <
68
+ # { [data not shown]
69
+ # 100 61924 100 61924 0 0 138k 0 --:--:-- --:--:-- --:--:-- 216k* Connection #0 to host brighterplanetlayout.s3.amazonaws.com left intact
70
+ #
71
+ # * Closing connection #0
72
+ # vidalia:~ $
@@ -1,116 +1,25 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "brighter_planet_layout/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{brighter_planet_layout}
8
- s.version = "0.3.2"
6
+ s.name = "brighter_planet_layout"
7
+ s.version = BrighterPlanetLayout::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Andy Rossmeissl", "Seamus Abshere"]
10
+ s.email = ["andy@rossmeissl.net"]
11
+ s.homepage = "http://github.com/brighterplanet/brighter_planet_layout"
12
+ s.summary = %Q{Layout assets for Brighter Planet sites}
13
+ s.description = %Q{Layouts, partials, stylesheets, and images}
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Andy Rossmeissl", "Seamus Abshere"]
12
- s.date = %q{2011-01-13}
13
- s.description = %q{Layouts, partials, stylesheets, and images}
14
- s.email = %q{andy@rossmeissl.net}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".gitattributes",
21
- ".gitignore",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "app/helpers/brighter_planet_helper.rb",
26
- "app/views/layouts/_elsewhere.html.erb",
27
- "app/views/layouts/_footer.html.erb",
28
- "app/views/layouts/_google_analytics.html.erb",
29
- "app/views/layouts/_header.html.erb",
30
- "app/views/layouts/brighter_planet.html.erb",
31
- "brighter_planet_layout.gemspec",
32
- "lib/brighter_planet_layout.rb",
33
- "lib/brighter_planet_layout/rails.rb",
34
- "lib/brighter_planet_layout/railtie.rb",
35
- "lib/brighter_planet_layout/rake_tasks.rb",
36
- "public/401.html",
37
- "public/403.html",
38
- "public/403.xml",
39
- "public/404.html",
40
- "public/404.json",
41
- "public/404.xml",
42
- "public/409.html",
43
- "public/422.html",
44
- "public/500.html",
45
- "public/favicon.ico",
46
- "public/javascripts/controls.js",
47
- "public/javascripts/dragdrop.js",
48
- "public/javascripts/effects.js",
49
- "public/javascripts/prototype.rails-2.3.10.js",
50
- "public/javascripts/prototype.rails-3.0.1.js",
51
- "public/javascripts/prototype.rails-3.0.3.js",
52
- "public/javascripts/rails.rails-3.0.1.js",
53
- "public/javascripts/rails.rails-3.0.3.js",
54
- "public/maintenance.html",
55
- "public/stylesheets/brighter_planet.css",
56
- "public/stylesheets/fonts.css",
57
- "public/stylesheets/fonts/DejaVuSansMono-Oblique.eot",
58
- "public/stylesheets/fonts/DejaVuSansMono-Oblique.ttf",
59
- "public/stylesheets/fonts/DejaVuSansMono.eot",
60
- "public/stylesheets/fonts/DejaVuSansMono.ttf",
61
- "public/stylesheets/fonts/KievitOT-Bold.otf",
62
- "public/stylesheets/fonts/KievitOT-BoldItalic.otf",
63
- "public/stylesheets/fonts/KievitOT-Italic.otf",
64
- "public/stylesheets/fonts/KievitOT-Regular.otf",
65
- "public/stylesheets/fonts/KievitWebPro-Bold.eot",
66
- "public/stylesheets/fonts/KievitWebPro-Bold.woff",
67
- "public/stylesheets/fonts/KievitWebPro-BoldIta.eot",
68
- "public/stylesheets/fonts/KievitWebPro-BoldIta.woff",
69
- "public/stylesheets/fonts/KievitWebPro-Ita.eot",
70
- "public/stylesheets/fonts/KievitWebPro-Ita.woff",
71
- "public/stylesheets/fonts/KievitWebPro.eot",
72
- "public/stylesheets/fonts/KievitWebPro.woff",
73
- "public/stylesheets/idle.css",
74
- "public/stylesheets/images/andy.jpg",
75
- "public/stylesheets/images/bg.png",
76
- "public/stylesheets/images/cards.png",
77
- "public/stylesheets/images/derek.jpg",
78
- "public/stylesheets/images/gears.png",
79
- "public/stylesheets/images/glow.png",
80
- "public/stylesheets/images/ian.jpg",
81
- "public/stylesheets/images/logo.png",
82
- "public/stylesheets/images/matt.jpg",
83
- "public/stylesheets/images/meter.png",
84
- "public/stylesheets/images/patti.jpg",
85
- "public/stylesheets/images/prism.png",
86
- "public/stylesheets/images/radiant_earth-small.png",
87
- "public/stylesheets/images/robbie.jpg",
88
- "public/stylesheets/images/seamus.jpg",
89
- "rails/init.rb",
90
- "test/helper.rb",
91
- "test/test_brighter_planet_layout.rb"
92
- ]
93
- s.homepage = %q{http://github.com/brighterplanet/brighter_planet_layout}
94
- s.rdoc_options = ["--charset=UTF-8"]
95
- s.require_paths = ["lib"]
96
- s.rubygems_version = %q{1.3.7}
97
- s.summary = %q{Layout assets for Brighter Planet sites}
98
- s.test_files = [
99
- "test/helper.rb",
100
- "test/test_brighter_planet_layout.rb"
101
- ]
102
-
103
- if s.respond_to? :specification_version then
104
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
105
- s.specification_version = 3
15
+ s.rubyforge_project = "brighter_planet_layout"
106
16
 
107
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
108
- s.add_runtime_dependency(%q<simple-rss>, [">= 1.2.3"])
109
- else
110
- s.add_dependency(%q<simple-rss>, [">= 1.2.3"])
111
- end
112
- else
113
- s.add_dependency(%q<simple-rss>, [">= 1.2.3"])
114
- end
17
+ s.files = `git ls-files`.split("\n").reject { |fn| fn.downcase =~ /\.ai$/ or fn.downcase =~ /\.psd$/ }
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency 'simple-rss', '>=1.2.3'
23
+ s.add_dependency 'eat'
24
+ s.add_development_dependency 'test-unit'
115
25
  end
116
-
@@ -0,0 +1,6 @@
1
+ # sabshere 1/18/11 http://tim.bla.ir/tech/articles/using-apache-mod-headers-to-change-downloaded-filenames
2
+ # for web fonts
3
+ <Files "*.woff">
4
+ Header set Access-Control-Allow-Origin "*"
5
+ </Files>
6
+
@@ -0,0 +1,3 @@
1
+ module BrighterPlanetLayout
2
+ VERSION = '0.3.3'
3
+ end
@@ -1,12 +1,10 @@
1
1
  require 'fileutils'
2
- require 'yaml'
3
2
  require 'simple-rss'
4
- require 'timeout'
5
- require 'net/http'
3
+ require 'eat'
4
+ require 'brighter_planet_layout/version'
6
5
 
7
6
  module BrighterPlanetLayout
8
7
  GEM_ROOT = ::File.expand_path ::File.join(::File.dirname(__FILE__), '..')
9
- VERSION = ::YAML.load ::File.read(::File.join(GEM_ROOT, 'VERSION'))
10
8
  TWITTER_RSS = 'http://twitter.com/statuses/user_timeline/15042574.rss'
11
9
  BLOG_ATOM = 'http://numbers.brighterplanet.com/latest.xml'
12
10
  TIMEOUT = 5 # seconds
@@ -75,7 +73,7 @@ module BrighterPlanetLayout
75
73
  end
76
74
 
77
75
  def self.latest_tweet
78
- ::SimpleRSS.parse(get(TWITTER_RSS)).entries.first
76
+ ::SimpleRSS.parse(eat(TWITTER_RSS)).entries.first
79
77
  rescue ::SocketError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
80
78
  # nil
81
79
  rescue ::NoMethodError
@@ -83,69 +81,12 @@ module BrighterPlanetLayout
83
81
  end
84
82
 
85
83
  def self.latest_blog_post
86
- ::SimpleRSS.parse(get(BLOG_ATOM)).entries.first
84
+ ::SimpleRSS.parse(eat(BLOG_ATOM)).entries.first
87
85
  rescue ::SocketError, ::Timeout::Error, ::Errno::ETIMEDOUT, ::Errno::ENETUNREACH, ::Errno::ECONNRESET, ::Errno::ECONNREFUSED
88
86
  # nil
89
87
  rescue ::NoMethodError
90
88
  # nil
91
89
  end
92
-
93
- def self.timer
94
- defined?(::SystemTimer) ? ::SystemTimer : ::Timeout
95
- end
96
-
97
- # sabshere 11/17/10 thanks dkastner
98
- def self.get(url)
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
104
- end
105
- response.body
106
- end
107
-
108
- # sabshere 11/17/10 not worth it --cache-control=\"public, max-age=7776000\"
109
- def self.update_s3
110
- # ENV['AWS_ACCESS_KEY_ID'] =
111
- # ENV['AWS_SECRET_ACCESS_KEY'] =
112
- # ENV['SSL_CERT_DIR'] =
113
- # ENV['S3SYNC_DIR'] =
114
- ::ENV['S3SYNC_NATIVE_CHARSET'] = 'UTF-8'
115
- cmd = "ruby #{ENV['S3SYNC_DIR']}/s3sync.rb --exclude=\"\\.ai\" --exclude=\"\\.psd\" -v -r --ssl --public-read #{public_path}/ #{S3_BUCKET}:#{VERSION}/"
116
- `#{cmd}`
117
- end
118
-
119
- # sabshere 11/18/10 access control header doesn't work
120
- # vidalia:~/github/brighter_planet_layout (master) $ ruby ~/bp/propsgod/s3sync/s3cmd.rb -v -s put brighterplanetlayout:0.2.43/stylesheets/fonts/KievitWebPro.woff public/stylesheets/fonts/KievitWebPro.woff x-amz-acl:public-read "Access-Control-Allow-Origin:*"
121
- # put to key brighterplanetlayout:0.2.43/stylesheets/fonts/KievitWebPro.woff from public/stylesheets/fonts/KievitWebPro.woff {"Access-Control-Allow-Origin"=>"*", "x-amz-acl"=>"public-read", "Content-Length"=>"61924"}
122
- #
123
- # vidalia:~ $ curl -O -v http://brighterplanetlayout.s3.amazonaws.com/0.2.43/stylesheets/fonts/KievitWebPro.woff* About to connect() to brighterplanetlayout.s3.amazonaws.com port 80 (#0)
124
- # * Trying 72.21.207.165... % Total % Received % Xferd Average Speed Time Time Time Current
125
- # Dload Upload Total Spent Left Speed
126
- # 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
127
- # * Connected to brighterplanetlayout.s3.amazonaws.com (72.21.207.165) port 80 (#0)
128
- # > GET /0.2.43/stylesheets/fonts/KievitWebPro.woff HTTP/1.1
129
- # > User-Agent: curl/7.20.0 (i386-apple-darwin9.8.0) libcurl/7.20.0 OpenSSL/0.9.8m zlib/1.2.3 libidn/1.16
130
- # > Host: brighterplanetlayout.s3.amazonaws.com
131
- # > Accept: */*
132
- # >
133
- # < HTTP/1.1 200 OK
134
- # < x-amz-id-2: lVNwntUjGX/0UxlygqXa+8yR2hFpAV+EZAzITK/ZMJQTnTOuJXvHEULNgPr1r9vt
135
- # < x-amz-request-id: 2B46C5DEBD6083E3
136
- # < Date: Thu, 18 Nov 2010 15:36:14 GMT
137
- # < Last-Modified: Thu, 18 Nov 2010 15:33:11 GMT
138
- # < ETag: "83c664104e2127f1b8519b653adc98dd"
139
- # < Accept-Ranges: bytes
140
- # < Content-Type:
141
- # < Content-Length: 61924
142
- # < Server: AmazonS3
143
- # <
144
- # { [data not shown]
145
- # 100 61924 100 61924 0 0 138k 0 --:--:-- --:--:-- --:--:-- 216k* Connection #0 to host brighterplanetlayout.s3.amazonaws.com left intact
146
- #
147
- # * Closing connection #0
148
- # vidalia:~ $
149
90
  end
150
91
 
151
92
  if defined? ::Rails::Railtie and ::Rails::VERSION::MAJOR == 3