imgkit 1.6.1 → 1.6.2
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 -1
- data/Gemfile.lock +5 -2
- data/README.md +7 -7
- data/imgkit.gemspec +1 -1
- data/lib/imgkit/configuration.rb +2 -1
- data/lib/imgkit/version.rb +1 -1
- data/spec/configuration_spec.rb +12 -0
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 54a77e4808782d6937ad10e99fa36faca8ecbb6d9829f4aba577a119c09a966a
|
4
|
+
data.tar.gz: ef362d9a0d2a1879f829a42c34f5f4c3812a430c46e20c0dabd81a9f11c8c23c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0764b88f8d36d783d6b8c6c54f28d3222a7e55c40988a342d7cbaa94c1df31961db2055ad8fd9d57b54a483dbe9b50a3a70a4f061b5f7e8632457c9ad81a1de
|
7
|
+
data.tar.gz: bf3f1ac220cf83230b9b21e66b1c298589b77f678ea172eb693665192eb879b873055c07550b8d64a3ce2fb1cb5a0169293e1375d6f6de3a21104d4cdcf427c7
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ GEM
|
|
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)
|
@@ -26,8 +26,11 @@ PLATFORMS
|
|
26
26
|
DEPENDENCIES
|
27
27
|
imgkit!
|
28
28
|
mocha
|
29
|
-
rack
|
29
|
+
rack (>= 1.6.11)
|
30
30
|
rake
|
31
31
|
rspec (~> 2)
|
32
32
|
rspec-core (~> 2)
|
33
33
|
wkhtmltoimage-binary
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
1.17.1
|
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/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
|
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.2
|
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: 2019-03-19 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,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.7.7
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: HTML+CSS -> JPG
|