smeargle 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -7,3 +7,7 @@
7
7
 
8
8
  ## v0.1.1
9
9
  * Fixed case on RMagick
10
+
11
+ ## v0.1.2
12
+ * Added error handling to image_details
13
+ * Added better image link support
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # Smeargle [![Build
2
- Status](https://secure.travis-ci.org/mockra/smeargle.png)](http://travis-ci.org/mockra/smeargle)
1
+ # Smeargle [![BuildStatus](https://secure.travis-ci.org/mockra/smeargle.png)](http://travis-ci.org/mockra/smeargle)
3
2
 
4
3
  Smeargle is an image collection tool that will return an object
5
4
  containing images from a given URL. Smeargle was designed to be
@@ -82,3 +81,11 @@ urls, and is faster than the images method.
82
81
  3. Commit your changes (`git commit -am 'Added some feature'`)
83
82
  4. Push to the branch (`git push origin my-new-feature`)
84
83
  5. Create new Pull Request
84
+
85
+ ## Contact
86
+
87
+ [david@mockra.com](mailto:david@mockra.com)
88
+
89
+ [@Mockra_](http://twitter.com/#!/mockra_)
90
+
91
+ [mockra.com](http://mockra.com)
@@ -31,16 +31,20 @@ module Smeargle
31
31
 
32
32
  def image_format img
33
33
  if URI(img).relative?
34
- self.safe_url + img
34
+ self.clean_url + img
35
35
  else
36
36
  img
37
37
  end
38
38
  end
39
39
 
40
40
  def image_details img
41
- remote_image = open img
42
- image = Magick::Image::from_blob(remote_image.read).first
43
- { url: img, height: image.columns, width: image.rows }
41
+ begin
42
+ remote_image = open img
43
+ image = Magick::Image::from_blob(remote_image.read).first
44
+ { url: img, height: image.columns, width: image.rows }
45
+ rescue
46
+ nil
47
+ end
44
48
  end
45
49
 
46
50
  def filtered_images
@@ -24,5 +24,11 @@ module Smeargle
24
24
  @response_body ||= Nokogiri::HTML(open safe_url)
25
25
  end
26
26
 
27
+ def clean_url
28
+ @clean_url ||=
29
+ URI(safe_url).scheme +
30
+ '://' + URI(safe_url).host
31
+ end
32
+
27
33
  end
28
34
  end
@@ -1,3 +1,3 @@
1
1
  module Smeargle
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/smeargle.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_development_dependency 'rake'
21
21
  gem.add_development_dependency 'rspec'
22
+ gem.add_development_dependency 'fakeweb'
22
23
  gem.add_dependency 'nokogiri'
23
- gem.add_dependency 'fakeweb'
24
24
  gem.add_dependency 'rmagick'
25
25
  end
@@ -42,4 +42,11 @@ describe Smeargle::Sketch do
42
42
  end
43
43
  end
44
44
 
45
+ describe 'clean_url' do
46
+ it 'should clean up paramaters' do
47
+ s = Smeargle::Sketch.new 'google.com/test/clean?go=now'
48
+ s.clean_url.should == 'http://google.com'
49
+ end
50
+ end
51
+
45
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smeargle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-05 00:00:00.000000000 Z
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -44,14 +44,14 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: nokogiri
47
+ name: fakeweb
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
- type: :runtime
54
+ type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
@@ -60,7 +60,7 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: fakeweb
63
+ name: nokogiri
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: 700197448308906755
131
+ hash: -3610093232473006616
132
132
  required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements:
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  segments:
139
139
  - 0
140
- hash: 700197448308906755
140
+ hash: -3610093232473006616
141
141
  requirements: []
142
142
  rubyforge_project:
143
143
  rubygems_version: 1.8.23