imgkit 1.0.0 → 1.0.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.
data/.gitignore CHANGED
@@ -1,22 +1,3 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
1
+ pkg/*
2
+ *.gem
22
3
  .bundle
data/README.md CHANGED
@@ -81,6 +81,6 @@ image when you need to.
81
81
 
82
82
  ## Copyright
83
83
 
84
- Copyright (c) 2010 Chris Continanza
84
+ Copyright (c) 2010 <a href="mailto:christopher.continanza@gmail.com">Chris Continanza</a>
85
85
  Based on work by Jared Pace
86
86
  See LICENSE for details.
data/Rakefile CHANGED
@@ -1,45 +1,2 @@
1
- require 'rubygems'
2
- require 'rake'
3
1
  require 'bundler'
4
- Bundler.require(:development)
5
-
6
- begin
7
- require 'jeweler'
8
- Jeweler::Tasks.new do |gem|
9
- gem.name = "imgkit"
10
- gem.summary = %Q{HTML+CSS -> JPG}
11
- gem.description = %Q{Uses wkhtmltoimage to create Images using HTML}
12
- gem.email = "christopher.continanza@gmail.com"
13
- gem.homepage = "http://github.com/csquared/IMGKit"
14
- gem.authors = ["csquared"]
15
- gem.add_development_dependency "rspec", "~> 2.0.0.beta.8"
16
- gem.add_development_dependency "rspec-core", "~> 2.0.0.beta.8"
17
- gem.add_development_dependency 'mocha'
18
- gem.post_install_message = File.read('POST_INSTALL')
19
- end
20
- Jeweler::GemcutterTasks.new
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
- end
24
-
25
- require 'rspec/core/rake_task'
26
- RSpec::Core::RakeTask.new(:spec) do |spec|
27
- end
28
-
29
- RSpec::Core::RakeTask.new(:rcov) do |spec|
30
- spec.rcov = true
31
- end
32
-
33
- task :spec => :check_dependencies
34
-
35
- task :default => :spec
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "IMGKit #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
2
+ Bundler::GemHelper.install_tasks
data/bin/imgkit CHANGED
@@ -6,7 +6,7 @@ require 'open-uri'
6
6
  require 'imgkit/configuration'
7
7
 
8
8
  def detect_architecture
9
- case Config::CONFIG['host_os']
9
+ case Config::CONFIG['arch']
10
10
  when /x86_64-linux/i
11
11
  'amd64'
12
12
  when /linux/i
@@ -24,10 +24,15 @@ def cleanup(install_to)
24
24
  end
25
25
 
26
26
  def download_wkhtmltoimage(arch)
27
- page = open("http://code.google.com/p/wkhtmltopdf/downloads/list").read
28
- download = page.match(/href=".*name=(.*wkhtmltoimage-.*#{arch}.*?)&/) || raise("File not found..")
29
- download = download[1]
30
- url = "http://wkhtmltopdf.googlecode.com/files/#{download}"
27
+ if ENV['BZIP']
28
+ download = "wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
29
+ url = "http://wkhtmltopdf.googlecode.com/files/wkhtmltoimage-0.10.0_beta4-static-#{arch}.tar.bz2"
30
+ 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..")
33
+ download = download[1]
34
+ url = "http://wkhtmltopdf.googlecode.com/files/#{download}"
35
+ end
31
36
  puts "Downloading #{download} from #{url}"
32
37
 
33
38
  `curl #{url} > #{download}`
@@ -37,36 +42,49 @@ end
37
42
  def install(download, arch, install_to)
38
43
  puts "Installing #{download} to #{install_to}"
39
44
  if download =~ /.tar.bz2$/
40
- `tar xjvf #{download}`
41
- `mv wkhtmltoimage-#{arch} #{install_to}`
45
+ `sudo tar xjvf #{download}`
46
+ `sudo mv wkhtmltoimage-#{arch} #{install_to}`
42
47
  elsif download =~ /.tar.lzma$/
43
48
  raise "couldn't extract archive: lzcat not found" unless system("which lzcat > /dev/null 2>/dev/null")
44
- `lzcat #{download} | tar x`
45
- `mv wkhtmltoimage-#{arch} #{install_to}`
49
+ puts "Warning: lzcat is broken on Ubuntu. Re-run with --use-bzip to install alternate version"
50
+ `sudo lzcat #{download} | tar x`
51
+ `sudo mv wkhtmltoimage-#{arch} #{install_to}`
46
52
  else
47
- `mv #{download} #{install_to}`
53
+ `sudo mv #{download} #{install_to}`
48
54
  end
49
55
  `sudo chmod +x #{install_to}`
50
56
  end
51
57
 
58
+ @command = Proc.new { puts "Nothing to do: use --help"}
59
+
52
60
  OptionParser.new do |parser|
53
61
  parser.banner = "IMGKit\n\nOptions are:"
54
62
 
63
+ parser.on("--use-bzip", "Force bzip download for Ubuntu because lzcat is broken") do
64
+ ENV['BZIP'] = 'true'
65
+ end
66
+
55
67
  parser.on("--install-wkhtmltoimage", "Install wkhtmltoimage binaries (TO=/usr/local/bin ARCHITECTURE=i386)") do
56
- architecture = ENV['ARCHITECTURE'] || detect_architecture
57
- install_to = ENV['TO'] || IMGKit.configuration.wkhtmltoimage
58
-
59
- Dir.chdir '/tmp'
60
-
61
- cleanup(install_to)
62
- download = download_wkhtmltoimage(architecture)
63
- install(download, architecture, install_to)
68
+ @command = Proc.new do
69
+ architecture = ENV['ARCHITECTURE'] || detect_architecture
70
+ install_to = ENV['TO'] || IMGKit.configuration.wkhtmltoimage
71
+
72
+ Dir.chdir '/tmp'
73
+
74
+ cleanup(install_to)
75
+ download = download_wkhtmltoimage(architecture)
76
+ install(download, architecture, install_to)
77
+ end
64
78
  end
65
79
 
66
80
  parser.on("--version", "Show Version.") do
67
- root = File.dirname(File.dirname(__FILE__))
68
- puts File.read(File.join(root, 'VERSION'))
81
+ @command = Proc.new do
82
+ root = File.dirname(File.dirname(__FILE__))
83
+ puts File.read(File.join(root, 'VERSION'))
84
+ end
69
85
  end
70
86
 
71
87
  parser.on("-h", "--help", "Show this.") { puts parser; exit }
72
88
  end.parse!
89
+
90
+ @command.call
@@ -1,84 +1,22 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "imgkit/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{imgkit}
8
- s.version = "1.0.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.name = "imgkit"
7
+ s.version = IMGKit::VERSION
8
+ s.platform = Gem::Platform::RUBY
11
9
  s.authors = ["csquared"]
12
- s.date = %q{2010-12-13}
13
- s.default_executable = %q{imgkit}
14
- s.description = %q{Uses wkhtmltoimage to create Images using HTML}
15
10
  s.email = %q{christopher.continanza@gmail.com}
16
- s.executables = ["imgkit"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".document",
23
- ".gitignore",
24
- ".rspec",
25
- ".rvmrc",
26
- "Gemfile",
27
- "Gemfile.lock",
28
- "LICENSE",
29
- "POST_INSTALL",
30
- "README.md",
31
- "Rakefile",
32
- "VERSION",
33
- "bin/imgkit",
34
- "imgkit.gemspec",
35
- "lib/imgkit.rb",
36
- "lib/imgkit/configuration.rb",
37
- "lib/imgkit/imgkit.rb",
38
- "lib/imgkit/source.rb",
39
- "spec/fixtures/example.css",
40
- "spec/fixtures/example.html",
41
- "spec/imgkit_spec.rb",
42
- "spec/source_spec.rb",
43
- "spec/spec_helper.rb"
44
- ]
45
- s.homepage = %q{http://github.com/csquared/IMGKit}
46
- s.post_install_message = %q{******************************************************************
11
+ s.homepage = "http://rubygems.org/gems/imgkit"
12
+ s.summary = %q{HTML+CSS -> JPG}
13
+ s.description = %q{Uses wkhtmltoimage to create Images using HTML}
14
+ s.post_install_message = File.read('POST_INSTALL')
47
15
 
48
- Now install wkhtmltoimage binaries:
49
- Global: sudo `which imgkit` --install-wkhtmltoimage
50
- or inside RVM folder: export TO=`which imgkit | sed 's:/imgkit:/wkhtmltoimage:'` && imgkit --install-wkhtmltoimage
51
- (run imgkit --help to see more options)
16
+ s.rubyforge_project = "imgkit"
52
17
 
53
- ******************************************************************
54
- }
55
- s.rdoc_options = ["--charset=UTF-8"]
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
56
21
  s.require_paths = ["lib"]
57
- s.rubygems_version = %q{1.3.7}
58
- s.summary = %q{HTML+CSS -> JPG}
59
- s.test_files = [
60
- "spec/imgkit_spec.rb",
61
- "spec/source_spec.rb",
62
- "spec/spec_helper.rb"
63
- ]
64
-
65
- if s.respond_to? :specification_version then
66
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
67
- s.specification_version = 3
68
-
69
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
- s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.8"])
71
- s.add_development_dependency(%q<rspec-core>, ["~> 2.0.0.beta.8"])
72
- s.add_development_dependency(%q<mocha>, [">= 0"])
73
- else
74
- s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.8"])
75
- s.add_dependency(%q<rspec-core>, ["~> 2.0.0.beta.8"])
76
- s.add_dependency(%q<mocha>, [">= 0"])
77
- end
78
- else
79
- s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.8"])
80
- s.add_dependency(%q<rspec-core>, ["~> 2.0.0.beta.8"])
81
- s.add_dependency(%q<mocha>, [">= 0"])
82
- end
83
22
  end
84
-
@@ -0,0 +1,3 @@
1
+ class IMGKit
2
+ VERSION = "1.0.1"
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - csquared
@@ -14,65 +14,18 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-13 00:00:00 -06:00
18
- default_executable: imgkit
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rspec
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 0
31
- - beta
32
- - 8
33
- version: 2.0.0.beta.8
34
- type: :development
35
- prerelease: false
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rspec-core
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- segments:
45
- - 2
46
- - 0
47
- - 0
48
- - beta
49
- - 8
50
- version: 2.0.0.beta.8
51
- type: :development
52
- prerelease: false
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: mocha
56
- requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- segments:
62
- - 0
63
- version: "0"
64
- type: :development
65
- prerelease: false
66
- version_requirements: *id003
17
+ date: 2010-12-14 00:00:00 -06:00
18
+ default_executable:
19
+ dependencies: []
20
+
67
21
  description: Uses wkhtmltoimage to create Images using HTML
68
22
  email: christopher.continanza@gmail.com
69
23
  executables:
70
24
  - imgkit
71
25
  extensions: []
72
26
 
73
- extra_rdoc_files:
74
- - LICENSE
75
- - README.md
27
+ extra_rdoc_files: []
28
+
76
29
  files:
77
30
  - .document
78
31
  - .gitignore
@@ -84,20 +37,20 @@ files:
84
37
  - POST_INSTALL
85
38
  - README.md
86
39
  - Rakefile
87
- - VERSION
88
40
  - bin/imgkit
89
41
  - imgkit.gemspec
90
42
  - lib/imgkit.rb
91
43
  - lib/imgkit/configuration.rb
92
44
  - lib/imgkit/imgkit.rb
93
45
  - lib/imgkit/source.rb
46
+ - lib/imgkit/version.rb
94
47
  - spec/fixtures/example.css
95
48
  - spec/fixtures/example.html
96
49
  - spec/imgkit_spec.rb
97
50
  - spec/source_spec.rb
98
51
  - spec/spec_helper.rb
99
52
  has_rdoc: true
100
- homepage: http://github.com/csquared/IMGKit
53
+ homepage: http://rubygems.org/gems/imgkit
101
54
  licenses: []
102
55
 
103
56
  post_install_message: |
@@ -110,8 +63,8 @@ post_install_message: |
110
63
 
111
64
  ******************************************************************
112
65
 
113
- rdoc_options:
114
- - --charset=UTF-8
66
+ rdoc_options: []
67
+
115
68
  require_paths:
116
69
  - lib
117
70
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -119,7 +72,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
72
  requirements:
120
73
  - - ">="
121
74
  - !ruby/object:Gem::Version
122
- hash: 420051578781479221
123
75
  segments:
124
76
  - 0
125
77
  version: "0"
@@ -133,12 +85,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
85
  version: "0"
134
86
  requirements: []
135
87
 
136
- rubyforge_project:
88
+ rubyforge_project: imgkit
137
89
  rubygems_version: 1.3.7
138
90
  signing_key:
139
91
  specification_version: 3
140
92
  summary: HTML+CSS -> JPG
141
93
  test_files:
94
+ - spec/fixtures/example.css
95
+ - spec/fixtures/example.html
142
96
  - spec/imgkit_spec.rb
143
97
  - spec/source_spec.rb
144
98
  - spec/spec_helper.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.0