imgkit 1.3.4 → 1.3.5
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/Gemfile +1 -0
- data/Gemfile.lock +6 -2
- data/README.md +15 -1
- data/lib/imgkit/source.rb +1 -1
- data/lib/imgkit/version.rb +1 -1
- data/spec/source_spec.rb +5 -0
- metadata +53 -28
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,13 +2,16 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
archive-tar-minitar (0.5.2)
|
5
|
-
columnize (0.3.
|
5
|
+
columnize (0.3.4)
|
6
6
|
diff-lcs (1.1.2)
|
7
|
-
linecache (0.
|
7
|
+
linecache (0.46)
|
8
|
+
rbx-require-relative (> 0.0.4)
|
8
9
|
linecache19 (0.5.12)
|
9
10
|
ruby_core_source (>= 0.1.4)
|
10
11
|
mocha (0.9.12)
|
11
12
|
rack (1.3.0)
|
13
|
+
rake (0.9.2.2)
|
14
|
+
rbx-require-relative (0.0.5)
|
12
15
|
rspec (2.6.0)
|
13
16
|
rspec-core (~> 2.6.0)
|
14
17
|
rspec-expectations (~> 2.6.0)
|
@@ -39,6 +42,7 @@ PLATFORMS
|
|
39
42
|
DEPENDENCIES
|
40
43
|
mocha
|
41
44
|
rack
|
45
|
+
rake
|
42
46
|
rspec (~> 2)
|
43
47
|
rspec-core (~> 2)
|
44
48
|
ruby-debug
|
data/README.md
CHANGED
@@ -66,6 +66,20 @@ If you're on Windows or you installed wkhtmltoimage by hand to a location other
|
|
66
66
|
config.default_format = :png
|
67
67
|
end
|
68
68
|
|
69
|
+
## Heroku
|
70
|
+
|
71
|
+
get a version of `wkhtmltoimage` as an amd64 binary and commit it
|
72
|
+
to your git repo. I like to put mine in "./bin/wkhtmltoimage-amd64"
|
73
|
+
|
74
|
+
assuming its in that location you can just do:
|
75
|
+
|
76
|
+
IMGKit.configure do |config|
|
77
|
+
config.wkhtmltoimage = Rails.root.join('bin', 'wkhtmltoimage-amd64').to_s if ENV['RACK_ENV'] == 'production'
|
78
|
+
end
|
79
|
+
|
80
|
+
If you're not using Rails just replace Rails.root with the root dir of your app.
|
81
|
+
|
82
|
+
|
69
83
|
## Rails
|
70
84
|
|
71
85
|
### Mime Types
|
@@ -82,7 +96,7 @@ register a .png mime type in:
|
|
82
96
|
### Controller Actions
|
83
97
|
You can respond in a controller with:
|
84
98
|
|
85
|
-
@kit = IMGKit.new(
|
99
|
+
@kit = IMGKit.new(render_to_string)
|
86
100
|
|
87
101
|
format.jpg do
|
88
102
|
send_data(@kit.to_jpg, :type => "image/jpeg", :disposition => 'inline')
|
data/lib/imgkit/source.rb
CHANGED
data/lib/imgkit/version.rb
CHANGED
data/spec/source_spec.rb
CHANGED
@@ -17,6 +17,11 @@ describe IMGKit::Source do
|
|
17
17
|
source = IMGKit::Source.new('<blink>Oh Hai!</blink>')
|
18
18
|
source.should_not be_url
|
19
19
|
end
|
20
|
+
|
21
|
+
it "should return false if passed HTML with a line starting with 'http'" do
|
22
|
+
source = IMGKit::Source.new("<blink>Oh Hai!</blink>\nhttp://google.com")
|
23
|
+
source.should_not be_url
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
describe "#file?" do
|
metadata
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: imgkit
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 5
|
10
|
+
version: 1.3.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- csquared
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2012-02-09 00:00:00 -08:00
|
19
|
+
default_executable:
|
13
20
|
dependencies: []
|
21
|
+
|
14
22
|
description: Uses wkhtmltoimage to create Images using HTML
|
15
23
|
email: christopher.continanza@gmail.com
|
16
|
-
executables:
|
24
|
+
executables:
|
17
25
|
- imgkit
|
18
26
|
extensions: []
|
27
|
+
|
19
28
|
extra_rdoc_files: []
|
20
|
-
|
29
|
+
|
30
|
+
files:
|
21
31
|
- .document
|
22
32
|
- .gitignore
|
23
33
|
- .rspec
|
@@ -42,39 +52,54 @@ files:
|
|
42
52
|
- spec/source_spec.rb
|
43
53
|
- spec/spec_helper.rb
|
44
54
|
- spec/warning_binary
|
55
|
+
has_rdoc: true
|
45
56
|
homepage: http://rubygems.org/gems/imgkit
|
46
57
|
licenses: []
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
58
|
+
|
59
|
+
post_install_message: |
|
60
|
+
******************************************************************
|
61
|
+
|
62
|
+
Now install wkhtmltoimage binaries:
|
63
|
+
Global: sudo `which imgkit` --install-wkhtmltoimage
|
64
|
+
rvmsudo imgkit --install-wkhtmltoimage
|
65
|
+
(installs to default /usr/local/bin/wkhtmltoimage)
|
66
|
+
|
67
|
+
inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
|
68
|
+
(you'll have to configure the location of the binary if you do this!)
|
69
|
+
|
70
|
+
(run imgkit --help to see more options)
|
71
|
+
******************************************************************
|
72
|
+
|
53
73
|
rdoc_options: []
|
54
|
-
|
74
|
+
|
75
|
+
require_paths:
|
55
76
|
- lib
|
56
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
78
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
63
84
|
- 0
|
64
|
-
|
65
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
version: "0"
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
87
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
94
|
+
version: "0"
|
71
95
|
requirements: []
|
96
|
+
|
72
97
|
rubyforge_project: imgkit
|
73
|
-
rubygems_version: 1.
|
98
|
+
rubygems_version: 1.6.2
|
74
99
|
signing_key:
|
75
100
|
specification_version: 3
|
76
101
|
summary: HTML+CSS -> JPG
|
77
|
-
test_files:
|
102
|
+
test_files:
|
78
103
|
- spec/error_binary
|
79
104
|
- spec/fixtures/example.css
|
80
105
|
- spec/fixtures/example.html
|