imgkit 1.6.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +6 -5
- data/README.md +7 -7
- data/imgkit.gemspec +1 -1
- data/lib/imgkit/configuration.rb +2 -1
- data/lib/imgkit/imgkit.rb +1 -1
- data/lib/imgkit/version.rb +1 -1
- data/spec/configuration_spec.rb +12 -0
- data/spec/imgkit_spec.rb +1 -1
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f48347ff93f2901222e86e43519e2b143119dc79441283bdfc5baaa3138dfab1
|
4
|
+
data.tar.gz: 93a236c5a317140a321d0c037b8aff7808a7634e01b1c94a491b774b29debb64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c25ffc5a0e4d8d0343070baf27dbb37da6b64f695ded57a9f749c0422f16f61be5aaef740458297c5b158ca74b882e58c53b806fd16cd354ce8f2c00f8eb875
|
7
|
+
data.tar.gz: 5be2fed7ab4df62c9b8843f3a7ffc28da5470ceab663e4c9d57e37c03644343d59feddeefb96ca8e2924c032d5686595066e7cc51a78dcca609602a9acc51ddb
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
imgkit (1.6.
|
4
|
+
imgkit (1.6.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
diff-lcs (1.1.2)
|
10
10
|
mocha (0.9.12)
|
11
|
-
rack (
|
11
|
+
rack (2.0.6)
|
12
12
|
rake (0.9.2.2)
|
13
13
|
rspec (2.6.0)
|
14
14
|
rspec-core (~> 2.6.0)
|
@@ -18,7 +18,6 @@ GEM
|
|
18
18
|
rspec-expectations (2.6.0)
|
19
19
|
diff-lcs (~> 1.1.2)
|
20
20
|
rspec-mocks (2.6.0)
|
21
|
-
wkhtmltoimage-binary (0.12.1)
|
22
21
|
|
23
22
|
PLATFORMS
|
24
23
|
ruby
|
@@ -26,8 +25,10 @@ PLATFORMS
|
|
26
25
|
DEPENDENCIES
|
27
26
|
imgkit!
|
28
27
|
mocha
|
29
|
-
rack
|
28
|
+
rack (>= 1.6.11)
|
30
29
|
rake
|
31
30
|
rspec (~> 2)
|
32
31
|
rspec-core (~> 2)
|
33
|
-
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
2.1.4
|
data/README.md
CHANGED
@@ -13,14 +13,14 @@ Heavily based on [PDFKit](http://github.com/jdpace/pdfkit/).
|
|
13
13
|
gem install imgkit
|
14
14
|
|
15
15
|
### wkhtmltoimage
|
16
|
-
1. Use
|
17
|
-
install latest version into /usr/local/bin
|
18
|
-
(overwrite defaults with e.g. ARCHITECTURE=amd64 TO=/home/foo/bin)
|
19
|
-
2. Install by hand: [http://wkhtmltopdf.org/downloads.html](http://wkhtmltopdf.org/downloads.html)
|
20
|
-
3. Try using the `wkhtmltoimage-binary` gem (mac + linux)
|
16
|
+
1. Use the `wkhtmltoimage-binary` gem (mac + linux)
|
21
17
|
```
|
22
18
|
gem install wkhtmltoimage-binary
|
23
19
|
```
|
20
|
+
2. Install by hand: [http://wkhtmltopdf.org/downloads.html](http://wkhtmltopdf.org/downloads.html)
|
21
|
+
3. Use installer: `sudo imgkit --install-wkhtmltoimage`
|
22
|
+
install latest version into /usr/local/bin
|
23
|
+
(overwrite defaults with e.g. ARCHITECTURE=amd64 TO=/home/foo/bin)
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
@@ -152,7 +152,7 @@ You can respond in a controller with:
|
|
152
152
|
|
153
153
|
respond_to do |format|
|
154
154
|
send_data(@kit.to_img(format.to_sym),
|
155
|
-
:type => "image
|
155
|
+
:type => "image/#{format}", :disposition => 'inline')
|
156
156
|
end
|
157
157
|
|
158
158
|
This allows you to take advantage of rails page caching so you only generate the
|
@@ -228,7 +228,7 @@ Contributed by @ticktricktrack
|
|
228
228
|
# private
|
229
229
|
|
230
230
|
def take_snapshot
|
231
|
-
file = Tempfile.new(["template_#{self.id.to_s}", 'jpg'], 'tmp', :encoding => 'ascii-8bit')
|
231
|
+
file = Tempfile.new(["template_#{self.id.to_s}", '.jpg'], 'tmp', :encoding => 'ascii-8bit')
|
232
232
|
file.write(IMGKit.new(self.html_body, quality: 50, width: 600).to_jpg)
|
233
233
|
file.flush
|
234
234
|
self.snapshot = file
|
data/imgkit.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["csquared"]
|
10
10
|
s.email = %q{christopher.continanza@gmail.com}
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://github.com/csquared/IMGKit"
|
12
12
|
s.summary = %q{HTML+CSS -> JPG}
|
13
13
|
s.description = %q{Uses wkhtmltoimage to create Images using HTML}
|
14
14
|
s.post_install_message = File.read('POST_INSTALL')
|
data/lib/imgkit/configuration.rb
CHANGED
@@ -11,7 +11,8 @@ class IMGKit
|
|
11
11
|
|
12
12
|
def wkhtmltoimage
|
13
13
|
@wkhtmltoimage ||= begin
|
14
|
-
path = (using_bundler? ? `bundle exec which wkhtmltoimage` : `which wkhtmltoimage`)
|
14
|
+
path = (using_bundler? ? `bundle exec which wkhtmltoimage` : `which wkhtmltoimage`)
|
15
|
+
path = (path.split("\n").compact.last || "").chomp
|
15
16
|
path = '/usr/local/bin/wkhtmltoimage' if path.strip.empty? # Fallback
|
16
17
|
path
|
17
18
|
end
|
data/lib/imgkit/imgkit.rb
CHANGED
@@ -42,7 +42,7 @@ class IMGKit
|
|
42
42
|
@options = IMGKit.configuration.default_options.merge(options)
|
43
43
|
@options.merge! find_options_in_meta(url_file_or_html) unless source.url?
|
44
44
|
|
45
|
-
raise NoExecutableError.new unless File.
|
45
|
+
raise NoExecutableError.new unless File.exist?(IMGKit.configuration.wkhtmltoimage)
|
46
46
|
end
|
47
47
|
|
48
48
|
def command(output_file = nil)
|
data/lib/imgkit/version.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -4,6 +4,7 @@ describe IMGKit::Configuration do
|
|
4
4
|
describe "#wkhtmltoimage" do
|
5
5
|
context "system version exists" do
|
6
6
|
let(:system_path) { "/path/to/wkhtmltoimage\n" }
|
7
|
+
let(:system_path_with_bundler_warning) { "`/` is not writable.\nBundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.\n/path/to/wkhtmltoimage\n" }
|
7
8
|
|
8
9
|
before(:each) do
|
9
10
|
subject.stub :` => system_path
|
@@ -18,6 +19,17 @@ describe IMGKit::Configuration do
|
|
18
19
|
subject.should_receive(:`).with("bundle exec which wkhtmltoimage")
|
19
20
|
subject.wkhtmltoimage.should == system_path.chomp
|
20
21
|
end
|
22
|
+
|
23
|
+
context "with warning" do
|
24
|
+
before(:each) do
|
25
|
+
subject.stub :` => system_path_with_bundler_warning
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the result of `bundle exec which wkhtmltoimage` with warning stripped" do
|
29
|
+
subject.should_receive(:`).with("bundle exec which wkhtmltoimage")
|
30
|
+
subject.wkhtmltoimage.should == system_path.chomp
|
31
|
+
end
|
32
|
+
end
|
21
33
|
end
|
22
34
|
|
23
35
|
context "without Bundler" do
|
data/spec/imgkit_spec.rb
CHANGED
@@ -286,7 +286,7 @@ describe IMGKit do
|
|
286
286
|
imgkit = IMGKit.new('html', :quality => 50)
|
287
287
|
file = imgkit.to_file(@file_path)
|
288
288
|
file.should be_instance_of(File)
|
289
|
-
File.
|
289
|
+
File.exist?(file.path).should be_true
|
290
290
|
end
|
291
291
|
|
292
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.3
|
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: 2023-05-25 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
|
-
- .document
|
21
|
-
- .gitignore
|
22
|
-
- .rspec
|
23
|
-
- .rvmrc
|
24
|
-
- .travis.yml
|
20
|
+
- ".document"
|
21
|
+
- ".gitignore"
|
22
|
+
- ".rspec"
|
23
|
+
- ".rvmrc"
|
24
|
+
- ".travis.yml"
|
25
25
|
- Gemfile
|
26
26
|
- Gemfile.lock
|
27
27
|
- LICENSE
|
@@ -44,7 +44,7 @@ files:
|
|
44
44
|
- spec/source_spec.rb
|
45
45
|
- spec/spec_helper.rb
|
46
46
|
- spec/warning_binary
|
47
|
-
homepage:
|
47
|
+
homepage: https://github.com/csquared/IMGKit
|
48
48
|
licenses: []
|
49
49
|
metadata: {}
|
50
50
|
post_install_message: |
|
@@ -65,17 +65,16 @@ 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
|
-
|
78
|
-
rubygems_version: 2.0.14
|
77
|
+
rubygems_version: 3.1.6
|
79
78
|
signing_key:
|
80
79
|
specification_version: 4
|
81
80
|
summary: HTML+CSS -> JPG
|