plumnailer 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -14,7 +14,7 @@ module Plumnailer
14
14
  end
15
15
 
16
16
  # Fetch the contents of a url and cache result on filesystem.
17
- def fetch(url)
17
+ def fetch(url, orig_url=nil, redirect_count=0)
18
18
  cache_file = File.join(cache_dir, CGI.escape(url.to_s))
19
19
 
20
20
  if File.exists?(cache_file)
@@ -5,8 +5,9 @@ module Plumnailer
5
5
  # Fetch the contents of a url.
6
6
  class Fetcher
7
7
 
8
- # User agent to send with requests.
9
- UserAgent = 'plumnailer (http://github.com/mmb/plumnailer)'
8
+ def initialize
9
+ @user_agent = 'plumnailer (http://github.com/mmb/plumnailer)'
10
+ end
10
11
 
11
12
  # Follow this many chained HTTP redirects at most.
12
13
  RedirectLimit = 3
@@ -25,6 +26,7 @@ module Plumnailer
25
26
  uri = url.is_a?(URI) ? url : URI(url)
26
27
  if uri.is_a?(URI::HTTP)
27
28
  http = Net::HTTP::Persistent.new('plumnailer')
29
+ http.headers['User-Agent'] = user_agent
28
30
  resp = http.request(uri)
29
31
  case resp
30
32
  when Net::HTTPSuccess; resp.body
@@ -35,6 +37,7 @@ module Plumnailer
35
37
  end
36
38
  end
37
39
 
40
+ attr_accessor :user_agent
38
41
  end
39
42
 
40
43
  end
data/plumnailer.gemspec CHANGED
@@ -1,64 +1,26 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = %q{plumnailer}
8
- s.version = "0.1.1"
4
+ s.name = 'plumnailer'
5
+ s.version = '0.1.2'
6
+ s.summary = 'Choose the most representative image on an HTML page for use as a thumbnail'
7
+ s.description = s.summary
8
+ s.homepage = 'https://github.com/mmb/plumnailer'
9
+ s.authors = ['Matthew M. Boedicker']
10
+ s.email = %w{matthewm@boedicker.org}
11
+ s.license = 'MIT'
9
12
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Matthew M. Boedicker"]
12
- s.date = %q{2010-12-08}
13
- s.description = %q{Choose the most representative image on an HTML page for use as a thumbnail}
14
- s.email = %q{matthewm@boedicker.org}
15
- s.extra_rdoc_files = [
16
- "README.textile"
17
- ]
18
- s.files = [
19
- "COPYING",
20
- "README.textile",
21
- "Rakefile",
22
- "VERSION",
23
- "lib/plumnailer.rb",
24
- "lib/plumnailer/caching_fetcher.rb",
25
- "lib/plumnailer/chooser.rb",
26
- "lib/plumnailer/doc.rb",
27
- "lib/plumnailer/doc_parser.rb",
28
- "lib/plumnailer/fetcher.rb",
29
- "lib/plumnailer/img_comparator.rb",
30
- "lib/plumnailer/img_parser.rb",
31
- "lib/plumnailer/img_url_filter.rb",
32
- "lib/plumnailer/web_image.rb",
33
- "plumnailer.gemspec",
34
- "test.rb"
35
- ]
36
- s.homepage = %q{http://github.com/mmb/plumnailer}
37
- s.licenses = ["MIT"]
38
- s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.3.7}
40
- s.summary = %q{Choose the most representative image on an HTML page}
13
+ s.required_rubygems_version = '>= 1.3.6'
41
14
 
42
- if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
- s.specification_version = 3
15
+ %w{
16
+ net-http-persistent > 0
17
+ nokogiri > 0
18
+ rmagick > 0
19
+ }.each_slice(3) { |g,o,v| s.add_dependency(g, "#{o} #{v}") }
45
20
 
46
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<net-http-persistent>, ["~> 1.0"])
48
- s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.3.1"])
49
- s.add_runtime_dependency(%q<rmagick>, [">= 1.15.14"])
50
- s.add_development_dependency(%q<sinatra>, [">= 1.1.0"])
51
- else
52
- s.add_dependency(%q<net-http-persistent>, ["~> 1.0"])
53
- s.add_dependency(%q<nokogiri>, [">= 1.4.3.1"])
54
- s.add_dependency(%q<rmagick>, [">= 1.15.14"])
55
- s.add_dependency(%q<sinatra>, [">= 1.1.0"])
56
- end
57
- else
58
- s.add_dependency(%q<net-http-persistent>, ["~> 1.0"])
59
- s.add_dependency(%q<nokogiri>, [">= 1.4.3.1"])
60
- s.add_dependency(%q<rmagick>, [">= 1.15.14"])
61
- s.add_dependency(%q<sinatra>, [">= 1.1.0"])
62
- end
63
- end
21
+ %w{
22
+ sinatra > 0
23
+ }.each_slice(3) { |g,o,v| s.add_development_dependency(g, "#{o} #{v}") }
64
24
 
25
+ s.files = `git ls-files`.split("\n")
26
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plumnailer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew M. Boedicker
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-08 00:00:00 -05:00
18
+ date: 2011-02-16 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,13 +24,12 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ">"
28
28
  - !ruby/object:Gem::Version
29
- hash: 15
29
+ hash: 3
30
30
  segments:
31
- - 1
32
31
  - 0
33
- version: "1.0"
32
+ version: "0"
34
33
  type: :runtime
35
34
  version_requirements: *id001
36
35
  - !ruby/object:Gem::Dependency
@@ -39,15 +38,12 @@ dependencies:
39
38
  requirement: &id002 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
- - - ">="
41
+ - - ">"
43
42
  - !ruby/object:Gem::Version
44
- hash: 113
43
+ hash: 3
45
44
  segments:
46
- - 1
47
- - 4
48
- - 3
49
- - 1
50
- version: 1.4.3.1
45
+ - 0
46
+ version: "0"
51
47
  type: :runtime
52
48
  version_requirements: *id002
53
49
  - !ruby/object:Gem::Dependency
@@ -56,14 +52,12 @@ dependencies:
56
52
  requirement: &id003 !ruby/object:Gem::Requirement
57
53
  none: false
58
54
  requirements:
59
- - - ">="
55
+ - - ">"
60
56
  - !ruby/object:Gem::Version
61
- hash: 55
57
+ hash: 3
62
58
  segments:
63
- - 1
64
- - 15
65
- - 14
66
- version: 1.15.14
59
+ - 0
60
+ version: "0"
67
61
  type: :runtime
68
62
  version_requirements: *id003
69
63
  - !ruby/object:Gem::Dependency
@@ -72,29 +66,27 @@ dependencies:
72
66
  requirement: &id004 !ruby/object:Gem::Requirement
73
67
  none: false
74
68
  requirements:
75
- - - ">="
69
+ - - ">"
76
70
  - !ruby/object:Gem::Version
77
- hash: 19
71
+ hash: 3
78
72
  segments:
79
- - 1
80
- - 1
81
73
  - 0
82
- version: 1.1.0
74
+ version: "0"
83
75
  type: :development
84
76
  version_requirements: *id004
85
77
  description: Choose the most representative image on an HTML page for use as a thumbnail
86
- email: matthewm@boedicker.org
78
+ email:
79
+ - matthewm@boedicker.org
87
80
  executables: []
88
81
 
89
82
  extensions: []
90
83
 
91
- extra_rdoc_files:
92
- - README.textile
84
+ extra_rdoc_files: []
85
+
93
86
  files:
94
87
  - COPYING
88
+ - Gemfile
95
89
  - README.textile
96
- - Rakefile
97
- - VERSION
98
90
  - lib/plumnailer.rb
99
91
  - lib/plumnailer/caching_fetcher.rb
100
92
  - lib/plumnailer/chooser.rb
@@ -108,7 +100,7 @@ files:
108
100
  - plumnailer.gemspec
109
101
  - test.rb
110
102
  has_rdoc: true
111
- homepage: http://github.com/mmb/plumnailer
103
+ homepage: https://github.com/mmb/plumnailer
112
104
  licenses:
113
105
  - MIT
114
106
  post_install_message:
@@ -130,16 +122,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
122
  requirements:
131
123
  - - ">="
132
124
  - !ruby/object:Gem::Version
133
- hash: 3
125
+ hash: 23
134
126
  segments:
135
- - 0
136
- version: "0"
127
+ - 1
128
+ - 3
129
+ - 6
130
+ version: 1.3.6
137
131
  requirements: []
138
132
 
139
133
  rubyforge_project:
140
- rubygems_version: 1.3.7
134
+ rubygems_version: 1.5.2
141
135
  signing_key:
142
136
  specification_version: 3
143
- summary: Choose the most representative image on an HTML page
137
+ summary: Choose the most representative image on an HTML page for use as a thumbnail
144
138
  test_files: []
145
139
 
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- begin
2
- require 'jeweler'
3
- Jeweler::Tasks.new do |gemspec|
4
- gemspec.name = 'plumnailer'
5
- gemspec.summary = 'Choose the most representative image on an HTML page'
6
- gemspec.description = 'Choose the most representative image on an HTML page for use as a thumbnail'
7
- gemspec.email = 'matthewm@boedicker.org'
8
- gemspec.homepage = 'http://github.com/mmb/plumnailer'
9
- gemspec.authors = ['Matthew M. Boedicker']
10
- gemspec.license = 'MIT'
11
-
12
- %w{
13
- net-http-persistent ~> 1.0
14
- nokogiri >= 1.4.3.1
15
- rmagick >= 1.15.14
16
- }.each_slice(3) { |g,o,v| gemspec.add_dependency(g, "#{o} #{v}") }
17
- %w{
18
- sinatra >= 1.1.0
19
- }.each_slice(3) do |g,o,v|
20
- gemspec.add_development_dependency(g, "#{o} #{v}")
21
- end
22
- end
23
- rescue LoadError
24
- puts "Jeweler not available. Install it with: gem install jeweler"
25
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.1