turingstudio-webloc_cleaner 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -1
- data/bin/webloc_cleaner +4 -4
- data/lib/webloc_cleaner.rb +13 -2
- metadata +3 -1
data/README.rdoc
CHANGED
@@ -4,12 +4,18 @@ http://github.com/turingstudio/webloc_cleaner/
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
This RubyGem searches a path for webloc files, displays a list of OK and damaged files, and converts them to url files.
|
7
|
+
This RubyGem searches a path and all subdirectories for webloc files, displays a list of OK and damaged files, and converts them to url files.
|
8
8
|
|
9
9
|
== INSTALL:
|
10
10
|
|
11
11
|
gem install turingstudio-webloc_cleaner
|
12
12
|
|
13
|
+
== USAGE:
|
14
|
+
|
15
|
+
webloc_cleaner list ~/Desktop/
|
16
|
+
|
17
|
+
webloc_cleaner convert ~/Desktop/
|
18
|
+
|
13
19
|
== LICENSE:
|
14
20
|
|
15
21
|
Copyright (c) 2009 The Turing Studio, Inc.
|
data/bin/webloc_cleaner
CHANGED
data/lib/webloc_cleaner.rb
CHANGED
@@ -5,7 +5,7 @@ require 'simpleconsole'
|
|
5
5
|
require 'activesupport'
|
6
6
|
|
7
7
|
module WeblocCleaner
|
8
|
-
VERSION = '1.0.
|
8
|
+
VERSION = '1.0.4'
|
9
9
|
|
10
10
|
class Controller < SimpleConsole::Controller
|
11
11
|
def default
|
@@ -56,8 +56,19 @@ module WeblocCleaner
|
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
+
def shell_escape(str)
|
60
|
+
String(str).gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').
|
61
|
+
gsub(/\n/, "'\n'").
|
62
|
+
sub(/^$/, "''")
|
63
|
+
end
|
64
|
+
|
59
65
|
def webloc_url(path)
|
60
|
-
|
66
|
+
if File.exists?("#{path}/rsrc")
|
67
|
+
path = shell_escape(path)
|
68
|
+
%x[strings #{path}/rsrc | grep http | sed '/^.http/s//http/' | head -1]
|
69
|
+
else
|
70
|
+
nil
|
71
|
+
end
|
61
72
|
end
|
62
73
|
|
63
74
|
def webloc_ok?(path)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turingstudio-webloc_cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Turing Studio, Inc.
|
@@ -14,6 +14,7 @@ default_executable: webloc_cleaner
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: simpleconsole
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|