badcarl-webarchiver 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,17 @@
1
1
  = webarchiver
2
2
 
3
- Description goes here.
3
+ MacRuby command line utility to create Safari webarchives
4
4
 
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but
13
- bump version in a commit by itself I can ignore when I pull)
14
- * Send me a pull request. Bonus points for topic branches.
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.0.0
1
+ 0.1.0
@@ -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, 'Timeout in seconds' ) do |seconds|
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]
@@ -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 = frame.dataSource.webArchive.data
48
- file = cleanseFilename(@file || frame.dataSource.pageTitle)
49
+ data = frame.dataSource.webArchive.data
50
+ @saved_file = cleanseFilename(@file || frame.dataSource.pageTitle)
49
51
 
50
- data.writeToFile(file, atomically:false)
52
+ data.writeToFile(@saved_file, atomically:false)
51
53
 
52
54
  @done = true
53
55
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webarchiver}
8
- s.version = "0.0.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-24}
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.0.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-24 00:00:00 -07:00
12
+ date: 2009-08-27 00:00:00 -07:00
13
13
  default_executable: webarchiver
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency