imgkit 1.3.1 → 1.3.2

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.
@@ -2,7 +2,11 @@
2
2
 
3
3
  Now install wkhtmltoimage binaries:
4
4
  Global: sudo `which imgkit` --install-wkhtmltoimage
5
- or inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
6
- (run imgkit --help to see more options)
5
+ rvmsudo imgkit --install-wkhtmltoimage
6
+ (installs to default /usr/local/bin/wkhtmltoimage)
7
+
8
+ inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
9
+ (you'll have to configure the location of the binary if you do this!)
7
10
 
11
+ (run imgkit --help to see more options)
8
12
  ******************************************************************
data/bin/imgkit CHANGED
@@ -4,23 +4,32 @@ require 'optparse'
4
4
  require 'rbconfig'
5
5
  require 'open-uri'
6
6
  require 'imgkit/configuration'
7
+ require 'imgkit/version'
8
+
9
+ GOOGLE_CODE_URL = "http://code.google.com/p/wkhtmltopdf/downloads/list"
7
10
 
8
11
  def detect_architecture
9
- case Config::CONFIG['arch']
12
+ case arch = Config::CONFIG['arch']
10
13
  when /x86_64-linux/i
11
14
  'amd64'
12
15
  when /linux/i
13
16
  'i386'
14
17
  when /darwin/i
15
- 'OS-X.i386'
18
+ 'OSX'
16
19
  else
17
- raise "No binaries found for your system. Please install wkhtmltoimage by hand."
20
+ cant_find_binaries(arch)
18
21
  end
19
22
  end
20
23
 
24
+ def cant_find_binaries(arch)
25
+ puts "Sorry, I couldn't find the binary for your architecture (#{arch}) \n at #{GOOGLE_CODE_URL}"
26
+ puts "Please go to that page, unzip the appropriate binary, and install"
27
+ exit(1)
28
+ end
29
+
21
30
  def cleanup(install_to)
22
- `rm -rf wkhtmltoimage*`
23
- `rm #{install_to}`
31
+ `rm -rf wkhtmltoimage*` rescue nil
32
+ `rm #{install_to}` rescue nil
24
33
  end
25
34
 
26
35
  def download_wkhtmltoimage(arch)
@@ -28,8 +37,8 @@ def download_wkhtmltoimage(arch)
28
37
  download = "wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
29
38
  url = "http://wkhtmltopdf.googlecode.com/files/wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
30
39
  else
31
- page = open("http://code.google.com/p/wkhtmltopdf/downloads/list").read
32
- download = page.match(/href=".*name=(.*wkhtmltoimage-.*#{arch}.*?)&/) || raise("File not found..")
40
+ page = open(GOOGLE_CODE_URL).read
41
+ download = page.match(/href=".*name=(.*wkhtmltoimage-.*#{arch}.*?)&/) or cant_find_binaries(arch)
33
42
  download = download[1]
34
43
  url = "http://wkhtmltopdf.googlecode.com/files/#{download}"
35
44
  end
@@ -43,7 +52,7 @@ def install(download, arch, install_to)
43
52
  puts "Installing #{download} to #{install_to}"
44
53
  if download =~ /.tar.bz2$/
45
54
  `sudo tar xjvf #{download}`
46
- `sudo mv wkhtmltoimage-#{arch} #{install_to}`
55
+ `sudo mv wkhtmltoimage #{install_to}`
47
56
  elsif download =~ /.tar.lzma$/
48
57
  raise "couldn't extract archive: lzcat not found" unless system("which lzcat > /dev/null 2>/dev/null")
49
58
  puts "Warning: lzcat is broken on Ubuntu. Re-run with --use-bzip to install alternate version"
@@ -79,8 +88,7 @@ OptionParser.new do |parser|
79
88
 
80
89
  parser.on("--version", "Show Version.") do
81
90
  @command = Proc.new do
82
- root = File.dirname(File.dirname(__FILE__))
83
- puts File.read(File.join(root, 'VERSION'))
91
+ puts IMGKit::VERSION
84
92
  end
85
93
  end
86
94
 
@@ -3,3 +3,4 @@ require 'open3'
3
3
  require 'imgkit/source'
4
4
  require 'imgkit/imgkit'
5
5
  require 'imgkit/configuration'
6
+ require 'imgkit/version'
@@ -1,3 +1,3 @@
1
1
  class IMGKit
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: imgkit
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.1
5
+ version: 1.3.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - csquared
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-24 00:00:00 Z
13
+ date: 2011-06-29 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: Uses wkhtmltoimage to create Images using HTML
@@ -52,9 +52,13 @@ post_install_message: |
52
52
 
53
53
  Now install wkhtmltoimage binaries:
54
54
  Global: sudo `which imgkit` --install-wkhtmltoimage
55
- or inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
56
- (run imgkit --help to see more options)
55
+ rvmsudo imgkit --install-wkhtmltoimage
56
+ (installs to default /usr/local/bin/wkhtmltoimage)
57
+
58
+ inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
59
+ (you'll have to configure the location of the binary if you do this!)
57
60
 
61
+ (run imgkit --help to see more options)
58
62
  ******************************************************************
59
63
 
60
64
  rdoc_options: []
@@ -66,7 +70,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
70
  requirements:
67
71
  - - ">="
68
72
  - !ruby/object:Gem::Version
69
- hash: 3909095106456771647
73
+ hash: -3332981170482838796
70
74
  segments:
71
75
  - 0
72
76
  version: "0"