websnap 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +2 -0
- data/README.md +6 -0
- data/Rakefile +1 -1
- data/bin/wkhtml_image_executable.rb +26 -0
- data/bin/wkhtmltoimage-amd64 +0 -0
- data/bin/wkhtmltoimage-proxy +4 -12
- data/spec/websnap_spec.rb +1 -1
- data/websnap.gemspec +6 -6
- metadata +30 -9
data/Manifest
CHANGED
data/README.md
CHANGED
@@ -32,6 +32,12 @@ Create snapshot of webpage. Uses [wkhtmltoimage](http://github.com/antialize/wkh
|
|
32
32
|
kit = WebSnap::Snapper.new('http://google.com')
|
33
33
|
kit = WebSnap::Snapper.new(File.new('/path/to/html'))
|
34
34
|
|
35
|
+
## Changes
|
36
|
+
|
37
|
+
### 0.1.5
|
38
|
+
|
39
|
+
- Added supports on x86_64 platform, thanks @willywos for the [PR](https://github.com/siuying/websnap/pull/6)
|
40
|
+
|
35
41
|
## Attributions
|
36
42
|
|
37
43
|
* This application use wkhtmltoimage as backend
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'echoe'
|
|
4
4
|
require 'rake'
|
5
5
|
require 'rspec/core/rake_task'
|
6
6
|
|
7
|
-
Echoe.new("websnap", "0.1.
|
7
|
+
Echoe.new("websnap", "0.1.5") do |p|
|
8
8
|
p.author = "Francis Chong"
|
9
9
|
p.description = "Create snapshot of webpage"
|
10
10
|
p.url = "http://github.com/siuying/websnap"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class WkhtmlImageExecutable
|
2
|
+
attr_reader :system_platform
|
3
|
+
|
4
|
+
def initialize(args={})
|
5
|
+
@system_platform = args[:system_platform] || default_platform
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_platform
|
9
|
+
RUBY_PLATFORM
|
10
|
+
end
|
11
|
+
|
12
|
+
def binary_wkhtmltoimage
|
13
|
+
case @system_platform
|
14
|
+
when /x86_64-linux/
|
15
|
+
'wkhtmltoimage-amd64'
|
16
|
+
when /linux/
|
17
|
+
'wkhtmltoimage-linux-i386-0.10.0'
|
18
|
+
when /darwin/
|
19
|
+
'wkhtmltoimage-osx-i386-0.10.0'
|
20
|
+
else
|
21
|
+
raise "No bundled binaries found for your system. Please install wkhtmltopdf."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
Binary file
|
data/bin/wkhtmltoimage-proxy
CHANGED
@@ -1,21 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/wkhtml_image_executable')
|
4
|
+
|
3
5
|
executable = `which wkhtmltoimage`.chomp
|
4
6
|
|
5
7
|
if executable.empty?
|
6
|
-
|
7
|
-
binary = case RUBY_PLATFORM
|
8
|
-
when /linux/
|
9
|
-
'wkhtmltoimage-linux-i386-0.10.0'
|
10
|
-
when /darwin/
|
11
|
-
'wkhtmltoimage-osx-i386-0.10.0'
|
12
|
-
else
|
13
|
-
raise "No bundled binaries found for your system. Please install wkhtmltopdf."
|
14
|
-
end
|
15
|
-
executable = File.join(File.dirname(__FILE__), binary)
|
16
|
-
|
8
|
+
executable = File.join(File.dirname(__FILE__), WkhtmlImageExecutable.new.binary_wkhtmltoimage)
|
17
9
|
end
|
18
10
|
|
19
11
|
arguments = $*.map { |arg| arg.include?(' ') ? %Q("#{arg}") : arg }
|
20
12
|
|
21
|
-
system(executable + " " + arguments.join(" "))
|
13
|
+
system(executable + " " + arguments.join(" "))
|
data/spec/websnap_spec.rb
CHANGED
@@ -29,7 +29,7 @@ describe WebSnap::Snapper do
|
|
29
29
|
|
30
30
|
it "should provide default options" do
|
31
31
|
websnap = WebSnap::Snapper.new('<h1>Oh Hai</h1>')
|
32
|
-
['--
|
32
|
+
['--format'].each do |option|
|
33
33
|
websnap.options.should have_key(option)
|
34
34
|
end
|
35
35
|
end
|
data/websnap.gemspec
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "websnap"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Francis Chong"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-12-13"
|
10
10
|
s.description = "Create snapshot of webpage"
|
11
11
|
s.email = ""
|
12
|
-
s.executables = ["wkhtmltoimage-linux-i386-0.10.0", "wkhtmltoimage-osx-i386-0.10.0", "wkhtmltoimage-proxy"]
|
13
|
-
s.extra_rdoc_files = ["LICENSE", "README.md", "bin/wkhtmltoimage-linux-i386-0.10.0", "bin/wkhtmltoimage-osx-i386-0.10.0", "bin/wkhtmltoimage-proxy", "lib/websnap.rb", "lib/websnap/source.rb", "lib/websnap/websnap.rb"]
|
14
|
-
s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "bin/wkhtmltoimage-linux-i386-0.10.0", "bin/wkhtmltoimage-osx-i386-0.10.0", "bin/wkhtmltoimage-proxy", "lib/websnap.rb", "lib/websnap/source.rb", "lib/websnap/websnap.rb", "spec/fixtures/google.html", "spec/source_spec.rb", "spec/spec_helper.rb", "spec/websnap_spec.rb", "websnap.gemspec"]
|
12
|
+
s.executables = ["wkhtml_image_executable.rb", "wkhtmltoimage-amd64", "wkhtmltoimage-linux-i386-0.10.0", "wkhtmltoimage-osx-i386-0.10.0", "wkhtmltoimage-proxy"]
|
13
|
+
s.extra_rdoc_files = ["LICENSE", "README.md", "bin/wkhtml_image_executable.rb", "bin/wkhtmltoimage-amd64", "bin/wkhtmltoimage-linux-i386-0.10.0", "bin/wkhtmltoimage-osx-i386-0.10.0", "bin/wkhtmltoimage-proxy", "lib/websnap.rb", "lib/websnap/source.rb", "lib/websnap/websnap.rb"]
|
14
|
+
s.files = ["LICENSE", "Manifest", "README.md", "Rakefile", "bin/wkhtml_image_executable.rb", "bin/wkhtmltoimage-amd64", "bin/wkhtmltoimage-linux-i386-0.10.0", "bin/wkhtmltoimage-osx-i386-0.10.0", "bin/wkhtmltoimage-proxy", "lib/websnap.rb", "lib/websnap/source.rb", "lib/websnap/websnap.rb", "spec/fixtures/google.html", "spec/source_spec.rb", "spec/spec_helper.rb", "spec/websnap_spec.rb", "websnap.gemspec"]
|
15
15
|
s.homepage = "http://github.com/siuying/websnap"
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Websnap", "--main", "README.md"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = "websnap"
|
19
|
-
s.rubygems_version = "1.8.
|
19
|
+
s.rubygems_version = "1.8.23"
|
20
20
|
s.summary = "Create snapshot of webpage"
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: echoe
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: mocha
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,17 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
description: Create snapshot of webpage
|
48
63
|
email: ''
|
49
64
|
executables:
|
65
|
+
- wkhtml_image_executable.rb
|
66
|
+
- wkhtmltoimage-amd64
|
50
67
|
- wkhtmltoimage-linux-i386-0.10.0
|
51
68
|
- wkhtmltoimage-osx-i386-0.10.0
|
52
69
|
- wkhtmltoimage-proxy
|
@@ -54,6 +71,8 @@ extensions: []
|
|
54
71
|
extra_rdoc_files:
|
55
72
|
- LICENSE
|
56
73
|
- README.md
|
74
|
+
- bin/wkhtml_image_executable.rb
|
75
|
+
- bin/wkhtmltoimage-amd64
|
57
76
|
- bin/wkhtmltoimage-linux-i386-0.10.0
|
58
77
|
- bin/wkhtmltoimage-osx-i386-0.10.0
|
59
78
|
- bin/wkhtmltoimage-proxy
|
@@ -65,6 +84,8 @@ files:
|
|
65
84
|
- Manifest
|
66
85
|
- README.md
|
67
86
|
- Rakefile
|
87
|
+
- bin/wkhtml_image_executable.rb
|
88
|
+
- bin/wkhtmltoimage-amd64
|
68
89
|
- bin/wkhtmltoimage-linux-i386-0.10.0
|
69
90
|
- bin/wkhtmltoimage-osx-i386-0.10.0
|
70
91
|
- bin/wkhtmltoimage-proxy
|
@@ -102,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
123
|
version: '1.2'
|
103
124
|
requirements: []
|
104
125
|
rubyforge_project: websnap
|
105
|
-
rubygems_version: 1.8.
|
126
|
+
rubygems_version: 1.8.23
|
106
127
|
signing_key:
|
107
128
|
specification_version: 3
|
108
129
|
summary: Create snapshot of webpage
|