imgkit 1.6.0 → 1.6.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/imgkit +5 -5
- data/lib/imgkit/imgkit.rb +12 -8
- data/lib/imgkit/version.rb +1 -1
- data/spec/imgkit_spec.rb +2 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5ed8f0be7c4decfabdf2d979460cb8697f2b05
|
4
|
+
data.tar.gz: 7e1b079b97fc5f9f71c3d1e62d242aa1ab3177db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 941f53f2c3fb7391999e54c81fcf036f6f1e94929f056a5d1979d8372865134fa120305ccbd2563c0b689bae8d2a826717933480e3405f4c36da40ac9d8f4f37
|
7
|
+
data.tar.gz: 0a407a93a60d9007edda86266bc373614cde9a614419c41d9cee98983ab1f688bf005c6bd8dbdf7b6859cdc7456e0d6b8abf94bf013478f14d203708ed3e7f32
|
data/Gemfile.lock
CHANGED
data/bin/imgkit
CHANGED
@@ -9,7 +9,7 @@ require 'imgkit/version'
|
|
9
9
|
GOOGLE_CODE_URL = ENV['GOOGLE_CODE_URL'] || "http://code.google.com/p/wkhtmltopdf/downloads/list?can=1"
|
10
10
|
|
11
11
|
def detect_architecture
|
12
|
-
case arch =
|
12
|
+
case arch = RbConfig::CONFIG['arch']
|
13
13
|
when /x86_64-linux/i
|
14
14
|
'amd64'
|
15
15
|
when /linux/i
|
@@ -33,7 +33,7 @@ def cleanup(install_to)
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def download_wkhtmltoimage(arch)
|
36
|
-
if ENV['BZIP']
|
36
|
+
if ENV['BZIP']
|
37
37
|
download = "wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
|
38
38
|
url = "http://wkhtmltopdf.googlecode.com/files/wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
|
39
39
|
else
|
@@ -43,7 +43,7 @@ def download_wkhtmltoimage(arch)
|
|
43
43
|
url = "http://wkhtmltopdf.googlecode.com/files/#{download}"
|
44
44
|
end
|
45
45
|
puts "Downloading #{download} from #{url}"
|
46
|
-
|
46
|
+
|
47
47
|
`curl #{url} > #{download}`
|
48
48
|
download
|
49
49
|
end
|
@@ -77,9 +77,9 @@ OptionParser.new do |parser|
|
|
77
77
|
@command = Proc.new do
|
78
78
|
architecture = ENV['ARCHITECTURE'] || detect_architecture
|
79
79
|
install_to = ENV['TO'] ? ENV['TO']+'/wkhtmltoimage' : IMGKit.configuration.wkhtmltoimage
|
80
|
-
|
80
|
+
|
81
81
|
Dir.chdir '/tmp'
|
82
|
-
|
82
|
+
|
83
83
|
cleanup(install_to)
|
84
84
|
download = download_wkhtmltoimage(architecture)
|
85
85
|
install(download, architecture, install_to)
|
data/lib/imgkit/imgkit.rb
CHANGED
@@ -45,7 +45,7 @@ class IMGKit
|
|
45
45
|
raise NoExecutableError.new unless File.exists?(IMGKit.configuration.wkhtmltoimage)
|
46
46
|
end
|
47
47
|
|
48
|
-
def command
|
48
|
+
def command(output_file = nil)
|
49
49
|
args = [executable]
|
50
50
|
args += normalize_options(@options).to_a.flatten.compact
|
51
51
|
|
@@ -55,7 +55,12 @@ class IMGKit
|
|
55
55
|
args << @source.to_s
|
56
56
|
end
|
57
57
|
|
58
|
-
|
58
|
+
if output_file
|
59
|
+
args << output_file.to_s
|
60
|
+
else
|
61
|
+
args << '-' # Read IMG from stdout
|
62
|
+
end
|
63
|
+
|
59
64
|
args
|
60
65
|
end
|
61
66
|
|
@@ -101,23 +106,22 @@ class IMGKit
|
|
101
106
|
end
|
102
107
|
end
|
103
108
|
|
104
|
-
def to_img(format = nil)
|
109
|
+
def to_img(format = nil, path = nil)
|
105
110
|
append_stylesheets
|
106
111
|
append_javascripts
|
107
112
|
set_format(format)
|
108
113
|
|
109
114
|
opts = @source.html? ? {:stdin_data => @source.to_s} : {}
|
110
|
-
result, stderr = capture3(*(command + [opts]))
|
115
|
+
result, stderr = capture3(*(command(path) + [opts]))
|
111
116
|
result.force_encoding("ASCII-8BIT") if result.respond_to? :force_encoding
|
112
|
-
|
113
|
-
raise CommandFailedError.new(command.join(' '), stderr) if result.size == 0
|
117
|
+
raise CommandFailedError.new(command.join(' '), stderr) if path.nil? and result.size == 0
|
114
118
|
result
|
115
119
|
end
|
116
120
|
|
117
121
|
def to_file(path)
|
118
122
|
format = File.extname(path).gsub(/^\./,'').to_sym
|
119
|
-
|
120
|
-
File.
|
123
|
+
self.to_img(format, path)
|
124
|
+
File.new(path)
|
121
125
|
end
|
122
126
|
|
123
127
|
def method_missing(name, *args, &block)
|
data/lib/imgkit/version.rb
CHANGED
data/spec/imgkit_spec.rb
CHANGED
@@ -282,12 +282,11 @@ describe IMGKit do
|
|
282
282
|
File.delete(@file_path) if File.exist?(@file_path)
|
283
283
|
end
|
284
284
|
|
285
|
-
it "should create a file
|
285
|
+
it "should create a binary file" do
|
286
286
|
imgkit = IMGKit.new('html', :quality => 50)
|
287
|
-
imgkit.expects(:to_img).returns('CONTENT')
|
288
287
|
file = imgkit.to_file(@file_path)
|
289
288
|
file.should be_instance_of(File)
|
290
|
-
File.
|
289
|
+
File.exists?(file.path).should be_true
|
291
290
|
end
|
292
291
|
|
293
292
|
IMGKit::KNOWN_FORMATS.each do |format|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- csquared
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Uses wkhtmltoimage to create Images using HTML
|
14
14
|
email: christopher.continanza@gmail.com
|
@@ -17,11 +17,11 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
20
|
+
- .document
|
21
|
+
- .gitignore
|
22
|
+
- .rspec
|
23
|
+
- .rvmrc
|
24
|
+
- .travis.yml
|
25
25
|
- Gemfile
|
26
26
|
- Gemfile.lock
|
27
27
|
- LICENSE
|
@@ -65,17 +65,17 @@ require_paths:
|
|
65
65
|
- lib
|
66
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project: imgkit
|
78
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.0.14
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: HTML+CSS -> JPG
|