tourist 0.0.3 → 0.0.4
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/lib/rasterize.js +3 -3
- data/lib/tourist.rb +2 -2
- metadata +2 -2
data/lib/rasterize.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
var page = new WebPage(),
|
2
2
|
address, output, size;
|
3
3
|
|
4
|
-
if (phantom.args.length < 2 || phantom.args.length >
|
5
|
-
console.log('Usage: rasterize.js URL filename');
|
4
|
+
if (phantom.args.length < 2 || phantom.args.length > 5) {
|
5
|
+
console.log('Usage: rasterize.js URL filename view_width view_height');
|
6
6
|
phantom.exit();
|
7
7
|
} else {
|
8
8
|
address = phantom.args[0];
|
9
9
|
output = phantom.args[1];
|
10
|
-
page.viewportSize = { width:
|
10
|
+
page.viewportSize = { width: phantom.args[2], height: phanton.args[3]};
|
11
11
|
page.open(address, function (status) {
|
12
12
|
if (status !== 'success') {
|
13
13
|
console.log('Unable to load the address!');
|
data/lib/tourist.rb
CHANGED
@@ -3,7 +3,7 @@ require 'timeout'
|
|
3
3
|
|
4
4
|
class Tourist
|
5
5
|
|
6
|
-
def self.tour_site(site_name, site_address, image_location, depth = nil)
|
6
|
+
def self.tour_site(site_name, site_address, image_location, depth = nil, view_width = 1000, view_height = 1000)
|
7
7
|
spec = Gem::Specification.find_by_name("tourist")
|
8
8
|
gem_root = spec.gem_dir
|
9
9
|
gem_lib = gem_root + "/lib"
|
@@ -20,7 +20,7 @@ class Tourist
|
|
20
20
|
status = Timeout::timeout(10) {
|
21
21
|
#image name is the page title plus a hash of the url plus extension
|
22
22
|
image_name = page.url.to_s.split("/").last.to_s + "." + page.url.hash.to_s + ".png"
|
23
|
-
puts `phantomjs #{gem_lib}/rasterize.js #{page.url} #{site_dir}/#{image_name}`
|
23
|
+
puts `phantomjs #{gem_lib}/rasterize.js #{page.url} #{site_dir}/#{image_name} #{view_width} #{view_height}`
|
24
24
|
}
|
25
25
|
rescue Exception => ex
|
26
26
|
puts ex
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tourist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -58,6 +58,6 @@ rubyforge_project:
|
|
58
58
|
rubygems_version: 1.8.24
|
59
59
|
signing_key:
|
60
60
|
specification_version: 3
|
61
|
-
summary:
|
61
|
+
summary: Added viewport size to arguments
|
62
62
|
test_files: []
|
63
63
|
has_rdoc:
|