unsavory 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/unsavory +11 -1
  2. metadata +3 -3
data/bin/unsavory CHANGED
@@ -28,6 +28,7 @@ else
28
28
  end
29
29
 
30
30
  delicious = Delicious.new(user, pass)
31
+ moved = 0
31
32
 
32
33
  begin
33
34
  urls = delicious.get_all_urls
@@ -57,6 +58,14 @@ urls.each_with_index do |url, idx|
57
58
  next
58
59
  end
59
60
 
61
+ # handle redirects
62
+ if response.is_a?(Net::HTTPRedirection)
63
+ new_uri = URI.parse(response['location'])
64
+ moved += 1
65
+ puts "URI redirects to #{new_uri}"
66
+ next
67
+ end
68
+
60
69
  puts case response.code
61
70
  when '200' then 'OK'
62
71
  when '404' then
@@ -64,4 +73,5 @@ urls.each_with_index do |url, idx|
64
73
  "Deleted #{url}"
65
74
  else "#{response.code}: #{url}"
66
75
  end
67
- end
76
+ end
77
+ puts "\n#{moved} URIs are redirecting to new locations, you might want to fix them." if moved > 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unsavory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kohl
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-06 00:00:00 +02:00
12
+ date: 2009-12-30 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.4.3
24
24
  version:
25
- description: " unsavory is a little Ruby script which checks your Delicious bookmarks for \n dead links (HTTP status code 404) and removes them. Additionally it will \n also inform you about links which return a status code other than 200 (OK). \n"
25
+ description:
26
26
  email: citizen428@gmail.com
27
27
  executables:
28
28
  - unsavory