badcarl-webarchiver 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +11 -11
- data/VERSION +1 -1
- data/bin/webarchiver +10 -3
- data/lib/webarchiver.rb +5 -3
- data/webarchiver.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
= webarchiver
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MacRuby command line utility to create Safari webarchives
|
|
4
4
|
|
|
5
|
-
==
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
== Usage
|
|
6
|
+
|
|
7
|
+
webarchiver [OPTIONS] URL [FILE]
|
|
8
|
+
-t, --timeout SECONDS Timeout in seconds
|
|
9
|
+
-h, --help Show this message.
|
|
10
|
+
|
|
11
|
+
== Credits
|
|
12
|
+
|
|
13
|
+
Special Thanks to Paul William who implemented a webarchiver utility in Objective-C
|
|
14
|
+
http://github.com/paulwilliam/webarchiver/
|
|
15
15
|
|
|
16
16
|
== Copyright
|
|
17
17
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.1.0
|
data/bin/webarchiver
CHANGED
|
@@ -10,16 +10,21 @@ require 'webarchiver'
|
|
|
10
10
|
require 'optparse'
|
|
11
11
|
|
|
12
12
|
options = {
|
|
13
|
-
:seconds => 120
|
|
13
|
+
:seconds => 120,
|
|
14
|
+
:show => false
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
ARGV.options do |opts|
|
|
17
18
|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS] URL [FILE]"
|
|
18
19
|
|
|
19
|
-
opts.on( '-t', '--timeout SECONDS', Integer, '
|
|
20
|
+
opts.on( '-t', '--timeout SECONDS', Integer, 'Set a timeout in seconds.' ) do |seconds|
|
|
20
21
|
options[:seconds] = seconds
|
|
21
22
|
end
|
|
22
23
|
|
|
24
|
+
opts.on( '-s', '--show', 'Show location of downloaded file.' ) do
|
|
25
|
+
options[:show] = true
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
opts.on( '-h', '--help', 'Show this message.' ) do
|
|
24
29
|
puts opts
|
|
25
30
|
exit
|
|
@@ -35,4 +40,6 @@ ARGV.options do |opts|
|
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
|
|
38
|
-
WebArchiver.archive options[:url], options[:file], options[:seconds]
|
|
43
|
+
saved_file = WebArchiver.archive options[:url], options[:file], options[:seconds]
|
|
44
|
+
|
|
45
|
+
puts File.expand_path(saved_file) if options[:show]
|
data/lib/webarchiver.rb
CHANGED
|
@@ -35,6 +35,8 @@ class WebArchiver
|
|
|
35
35
|
runLoop.runMode(NSDefaultRunLoopMode, beforeDate:toDate)
|
|
36
36
|
break if NSDate.date.earlierDate(toDate) == toDate
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
@saved_file
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
def done?
|
|
@@ -44,10 +46,10 @@ class WebArchiver
|
|
|
44
46
|
# frameLoadDelegate methods
|
|
45
47
|
|
|
46
48
|
def webView sender, didFinishLoadForFrame:frame
|
|
47
|
-
data
|
|
48
|
-
|
|
49
|
+
data = frame.dataSource.webArchive.data
|
|
50
|
+
@saved_file = cleanseFilename(@file || frame.dataSource.pageTitle)
|
|
49
51
|
|
|
50
|
-
data.writeToFile(
|
|
52
|
+
data.writeToFile(@saved_file, atomically:false)
|
|
51
53
|
|
|
52
54
|
@done = true
|
|
53
55
|
end
|
data/webarchiver.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{webarchiver}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.1.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Carl Porth"]
|
|
12
|
-
s.date = %q{2009-08-
|
|
12
|
+
s.date = %q{2009-08-27}
|
|
13
13
|
s.default_executable = %q{webarchiver}
|
|
14
14
|
s.description = %q{MacRuby command line utility to create Safari webarchives}
|
|
15
15
|
s.email = %q{badcarl@gmail.com}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: badcarl-webarchiver
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carl Porth
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-08-
|
|
12
|
+
date: 2009-08-27 00:00:00 -07:00
|
|
13
13
|
default_executable: webarchiver
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|