Skip to content

Commit

Permalink
Issue #18, Issue #19 + removed Jeweler
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-alexandrov committed Oct 15, 2013
1 parent e7eb5fb commit 024d08f
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,4 +1,4 @@
language: ruby
rvm:
- 1.9.2
- 1.9.3
- 2.0.0
13 changes: 2 additions & 11 deletions Gemfile
@@ -1,12 +1,3 @@
source "http://rubygems.org"
source 'http://rubygems.org'

group :development, :test do
gem 'sqlite3'
gem 'wkhtmltopdf-binary'

gem "shoulda", ">= 0"
gem "bundler", ">= 1.0.0"
gem "jeweler"

gem 'rails', '>=3.0.0'
end
gemspec
170 changes: 111 additions & 59 deletions Gemfile.lock
@@ -1,57 +1,79 @@
PATH
remote: .
specs:
wisepdf (1.3.0)

GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.12)
actionpack (= 3.2.12)
mail (~> 2.4.4)
actionpack (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
actionmailer (3.2.14)
actionpack (= 3.2.14)
mail (~> 2.5.4)
actionpack (3.2.14)
activemodel (= 3.2.14)
activesupport (= 3.2.14)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.12)
activesupport (= 3.2.12)
activemodel (3.2.14)
activesupport (= 3.2.14)
builder (~> 3.0.0)
activerecord (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activerecord (3.2.14)
activemodel (= 3.2.14)
activesupport (= 3.2.14)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.12)
activemodel (= 3.2.12)
activesupport (= 3.2.12)
activesupport (3.2.12)
i18n (~> 0.6)
activeresource (3.2.14)
activemodel (= 3.2.14)
activesupport (= 3.2.14)
activesupport (3.2.14)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.5)
arel (3.0.2)
bourne (1.1.2)
mocha (= 0.10.5)
builder (3.0.4)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
crack (0.4.1)
safe_yaml (~> 0.9.0)
diff-lcs (1.2.4)
erubis (2.7.0)
git (1.2.5)
hike (1.2.1)
i18n (0.6.4)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
execjs (2.0.2)
faker (1.2.0)
i18n (~> 0.5)
hike (1.2.3)
i18n (0.6.5)
journey (1.0.4)
json (1.7.7)
mail (2.4.4)
i18n (>= 0.4.0)
json (1.8.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
metaclass (0.0.1)
mime-types (1.21)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.6.1)
mime-types (1.25)
mini_portile (0.5.1)
multi_json (1.8.2)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
Expand All @@ -60,52 +82,82 @@ GEM
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.12)
actionmailer (= 3.2.12)
actionpack (= 3.2.12)
activerecord (= 3.2.12)
activeresource (= 3.2.12)
activesupport (= 3.2.12)
rails (3.2.14)
actionmailer (= 3.2.14)
actionpack (= 3.2.14)
activerecord (= 3.2.14)
activeresource (= 3.2.14)
activesupport (= 3.2.14)
bundler (~> 1.0)
railties (= 3.2.12)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
railties (= 3.2.14)
railties (3.2.14)
actionpack (= 3.2.14)
activesupport (= 3.2.14)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
shoulda (3.3.2)
shoulda-context (~> 1.0.1)
shoulda-matchers (~> 1.4.1)
shoulda-context (1.0.2)
shoulda-matchers (1.4.2)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.5)
rspec-expectations (2.14.3)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
safe_yaml (0.9.7)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.1.5)
shoulda-matchers (2.4.0)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
simplecov (0.7.1)
multi_json (~> 1.0)
simplecov-html (~> 0.7.1)
simplecov-html (0.7.1)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
thor (0.17.0)
tilt (1.3.5)
treetop (1.4.12)
sqlite3 (1.3.8)
term-ansicolor (1.2.2)
tins (~> 0.8)
thor (0.18.1)
tilt (1.4.1)
tins (0.12.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.36)
tzinfo (0.3.38)
webmock (1.9.3)
addressable (>= 2.2.7)
crack (>= 0.3.2)
wkhtmltopdf-binary (0.9.9.1)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.0.0)
jeweler
rails (>= 3.0.0)
bundler
capybara
coffee-rails
coveralls
faker
rails (~> 3.2.13)
rake
rspec
shoulda
simplecov
sqlite3
webmock (~> 1.9.0)
wisepdf!
wkhtmltopdf-binary
18 changes: 11 additions & 7 deletions README.md
Expand Up @@ -25,8 +25,12 @@ Add this to your Gemfile:

gem 'wisepdf'

if you don't already have wkhtmltopdf installed on your machine you can get up and running quickly by adding this to your Gemfile:

gem 'wkhtmltopdf-binary'

then do:

bundle install

## How does it work?
Expand Down Expand Up @@ -125,10 +129,10 @@ If you need to just create a pdf and not display it:

# create a pdf from a string
pdf = Wisepdf::Writer.new.to_pdf('<h1>Hello There!</h1>')

# or from your controller, using views & templates and all other options as normal
pdf = render_to_string :pdf => "some_file_name"

# then save to a file
save_path = Rails.root.join('pdfs','filename.pdf')
File.open(save_path, 'wb') do |file|
Expand Down Expand Up @@ -200,7 +204,7 @@ You can put your default configuration, applied to all pdf's at "configure_wisep
c.options = {
:layout => "layout.html",
:use_xserver => true,
:footer => {
:footer => {
:right => "#{Date.today.year}",
:font_size => 8,
:spacing => 8
Expand All @@ -209,9 +213,9 @@ You can put your default configuration, applied to all pdf's at "configure_wisep
:bottom => 15
}
}

end

### Problems with with wkhtmltopdf-0.10 and above?

If you experience problems with wkhtmltopdf-0.10 and above like getting `Broken Pipe` error or something similar, then you probably should compile wkhtmltopdf from source.
Expand All @@ -238,7 +242,7 @@ However, the wisepdf_* helpers will use file:// paths for assets when using :sho

<%= params[:debug].present? ? image_tag('foo') : wisepdf_image_tag('foo') %>

## Production?
## Production?

**wisepdf** is used at:

Expand Down
36 changes: 2 additions & 34 deletions Rakefile
@@ -1,43 +1,11 @@
# encoding: utf-8

require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'

require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "wisepdf"
gem.homepage = "http://github.com/igor-alexandrov/wisepdf"
gem.license = "MIT"
gem.summary = "wkhtmltopdf for Rails done right"
gem.description = %Q{wisepdf uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, and let pdf take care of the hard stuff.}
gem.email = "igor.alexandrov@gmail.com"
gem.authors = [ "Igor Alexandrov" ]
end
Jeweler::RubygemsDotOrgTasks.new

require 'bundler/gem_tasks'
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end

task :default => :test

require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "wisepdf #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
task :default => :test
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion lib/wisepdf/rails.rb
Expand Up @@ -3,7 +3,7 @@ module Rails
if ::Rails::VERSION::MAJOR == 2
require 'wisepdf/rails/legacy'
elsif ::Rails::VERSION::MAJOR > 2
if ::Rails::VERSION::MINOR < 1
if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR < 1
require 'wisepdf/rails/railtie'
else
require 'wisepdf/rails/engine'
Expand Down
4 changes: 2 additions & 2 deletions lib/wisepdf/rails/engine.rb
@@ -1,9 +1,9 @@
module Wisepdf
module Rails
class Engine < ::Rails::Engine
initializer "wicked_pdf.register" do
initializer "wise_pdf.register" do
ActionController::Base.send :include, Render
if ::Rails.configuration.assets.enabled
if !!(::Rails.configuration.assets.enabled)
ActionView::Base.send :include, Helper::Assets
else
ActionView::Base.send :include, Helper::Legacy
Expand Down
2 changes: 1 addition & 1 deletion lib/wisepdf/rails/railtie.rb
@@ -1,7 +1,7 @@
module Wisepdf
module Rails
class Railtie < ::Rails::Railtie
initializer "wicked_pdf.register" do
initializer "wise_pdf.register" do
ActionController::Base.send :include, Render
ActionView::Base.send :include, Helper::Legacy
end
Expand Down
12 changes: 12 additions & 0 deletions lib/wisepdf/version.rb
@@ -0,0 +1,12 @@
# encoding: utf-8

module Wisepdf
module Version
MAJOR = 1
MINOR = 3
PATCH = 0
BUILD = nil

STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
end
end

0 comments on commit 024d08f

Please sign in to comment.