Commit 15ef6f7f authored by Cédric Boutillier's avatar Cédric Boutillier

Update upstream source from tag 'upstream/2.2.0+dfsg'

Update to upstream version '2.2.0+dfsg'
with Debian dir c0ec5d69b630ca06f8eda8dbacadf754dc867edd
parents 8520c547 cc5ade3a
Encoding:
require: rubocop-rspec
RSpec/ExampleLength:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/NestedGroups:
Max: 5
RSpec/NotToNot:
EnforcedStyle: to_not
# This file shows examples on how to instantiate a document in multiple ways,
# it does not actually do the instantiation and isn't actually shadowing any
# variables.
Lint/ShadowingOuterLocalVariable:
Exclude:
- manual/basic_concepts/creation.rb
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Exclude:
- lib/prawn/graphics.rb
- lib/prawn/images/png.rb
- lib/prawn/text/formatted/parser.rb
- manual/**/*.rb
- prawn.gemspec
- spec/**/*.rb
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Style/AccessorMethodName:
Exclude:
- lib/prawn/graphics/color.rb
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
# We need to reference non-ascii characters when testing and explaining
# behavior related to win-1252, UTF-8 and UTF-16 encodings for example.
Style/AsciiComments:
Enabled: false
Style/Documentation:
Enabled: false
Style/Encoding:
EnforcedStyle: never
# To be safe we are leaving these files encoded ASCII-8BIT as
# discussed at https://github.com/prawnpdf/prawn/pull/705
Exclude:
......@@ -7,173 +65,66 @@ Encoding:
- lib/prawn/images.rb
- spec/png_spec.rb
# These cops need to remain disabled for valid reasons on this code base
Style/FirstArrayElementLineBreak:
Enabled: true
# We need to reference non-ascii characters when testing and explaining
# behavior related to win-1252, UTF-8 and UTF-16 encodings for example.
AsciiComments:
Enabled: false
Style/FirstHashElementLineBreak:
Enabled: true
# We don't always prefer modified if statements even if they do fit on
# a line.
IfUnlessModifier:
Style/FirstMethodArgumentLineBreak:
Enabled: true
Style/FirstParameterIndentation:
EnforcedStyle: consistent
Style/GuardClause:
Enabled: false
# In this case we supress Prawn::Errors::CannotFit while trying to scale
# text down to fit.
HandleExceptions:
Lint/HandleExceptions:
Exclude:
- lib/prawn/text/formatted/box.rb
# %w() style arrays don't always look better.
WordArray:
# We don't always prefer modified if statements even if they do fit on
# a line.
Style/IfUnlessModifier:
Enabled: false
# Due to some layout constraints in our examples we want to allow these rule to
# be ignored in the manual.
Style/ClosingParenthesisIndentation:
Exclude:
- manual/**/*
LineEndConcatenation:
Exclude:
- manual/**/*
MultilineOperationIndentation:
Style/IndentArray:
EnforcedStyle: consistent
Style/IndentHash:
EnforcedStyle: consistent
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Exclude:
- manual/**/*
- prawn.gemspec
Style/SpaceInsideParens:
Exclude:
- manual/**/*
SingleSpaceBeforeFirstArg:
Exclude:
- manual/**/*
# This file shows examples on how to instantiate a document in multiple ways,
# it does not actually do the instantiation and isn't actually shadowing any
# variables.
ShadowingOuterLocalVariable:
Exclude:
- manual/basic_concepts/creation.rb
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': '()'
'%i': '[]'
'%I': '[]'
'%q': '()'
'%Q': '()'
'%r': '{}'
'%s': '()'
'%w': '[]'
'%W': '[]'
'%x': '()'
# We currently ignore usage of semicolons on this page of the manual so we
# don't have to worry about changing the content of the manual for now.
Semicolon:
Style/PredicateName:
Exclude:
- manual/bounding_box/nesting.rb
- lib/prawn/font/ttf.rb
- lib/prawn/font/afm.rb
Style/SpaceAroundOperators:
AllowForAlignment: false
# This cops are candidates for enabling and doing the related cleanup and/or
# refactoring
Style/BlockDelimiters:
Enabled: false
EnforcedStyle: semantic
Void:
Enabled: false
StringLiterals:
Enabled: false
HashSyntax:
Enabled: false
UselessAssignment:
Enabled: false
Lambda:
Enabled: false
LineLength:
Enabled: false
SpaceBeforeBlockBraces:
Enabled: false
SpaceInsideBrackets:
Enabled: false
FormatString:
Enabled: false
CollectionMethods:
Enabled: false
DotPosition:
Enabled: false
SingleLineBlockParams:
Enabled: false
PercentLiteralDelimiters:
Enabled: false
Documentation:
Enabled: false
RegexpLiteral:
Enabled: false
MethodLength:
Enabled: false
VariableInterpolation:
Enabled: false
AndOr:
Enabled: false
AssignmentInCondition:
Enabled: false
ClassAndModuleChildren:
Enabled: false
NumericLiterals:
Enabled: false
DoubleNegation:
Enabled: false
SelfAssignment:
Enabled: false
ClassLength:
Enabled: false
CaseEquality:
Enabled: false
RedundantSelf:
Enabled: false
BlockNesting:
Enabled: false
NegatedWhile:
Enabled: false
MultilineIfThen:
Enabled: false
ModuleFunction:
Enabled: false
CyclomaticComplexity:
Enabled: false
UnreachableCode:
Enabled: false
AccessorMethodName:
Enabled: false
SpaceAfterControlKeyword:
Enabled: false
PredicateName:
Enabled: false
ConstantName:
Enabled: false
MethodName:
Enabled: false
Alias:
Enabled: false
RedundantReturn:
Enabled: false
WhileUntilModifier:
Enabled: false
StringConversionInInterpolation:
Enabled: false
RedundantBegin:
Enabled: false
PerlBackrefs:
Enabled: false
ClassVars:
Enabled: false
ParameterLists:
Enabled: false
AbcSize:
Enabled: false
PerceivedComplexity:
Enabled: false
UnusedBlockArgument:
Enabled: false
UnusedMethodArgument:
Enabled: false
Next:
Enabled: false
ClassCheck:
Enabled: false
SpaceBeforeComma:
Enabled: false
StringLiteralsInInterpolation:
Enabled: false
GuardClause:
Enabled: false
BlockEndNewline:
Style/WhileUntilModifier:
Enabled: false
language: ruby
before_install:
- gem update --system
- gem install bundler
- bundle --version
rvm:
- 2.0.0-p0
- 2.0.0-p648
- 2.1.0-p0
- 2.1.8
- 2.1.10
- 2.2.0-p0
- 2.2.4
- 2.2.6
- 2.3.0
- rbx-2
- jruby-9.0.4.0
matrix:
include:
- rvm: jruby-1.7.22
env: JRUBY_OPTS=--2.0
allow_failures:
- rvm: rbx-2
- 2.3.3
- 2.4.0
- jruby-9.1.7.0
## PrawnPDF master branch
## PrawnPDF 2.2.0 -- Unreleased
### Added support of TTC fonts
You can use TTC fonts with Prawn now.
(Jamis Buck, [#1002](https://github.com/prawnpdf/prawn/pull/1007))
### Join style is validated now
Previously it was possible to specify anything for join style which could result
in and invalid document. It's impossible now.
(Tim Woodbury, [#989](https://github.com/prawnpdf/prawn/pull/989))
### Fixed handling of NBSP in Windows-1252 text
NBSP was improperly treated as a regular space in Windows-1252 encoded text.
(Alexander Mankuta, [#939](https://github.com/prawnpdf/prawn/issues/939))
### Fixed wrong leading of one-line paragraphs
Extra leading was erroneously added to one-line paragraphs.
(Marcin Skirzynski, [#922](https://github.com/prawnpdf/prawn/pull/922))
### Fixed dashing
Dashing now allows 0 length segments. It now fully conforms to PDF spec.
(Thomas Leitner, [#1001](https://github.com/prawnpdf/prawn/issues/1001))
### Code of Conduct
PrawnPDF now has [Code of Conduct].
[Code of Conduct]: https://github.com/prawnpdf/prawn/blob/master/CODE_OF_CONDUCT.md
### Improved generated document consistency
There was a number of places in code that generated names for different
resources semi-randomly. That made hard to verify if document has any unexpected
changes. There was some effort to improve consistency.
(Alexander Mankuta)
### Improved gradients
Gradients can have multiple stops to blend more than two colors
Previously, only two colors could be specified in a gradient: the start and end
colors. This change allows any number of colors to be specified, along with the
position between 0 and 1 as to where they should be displayed.
This change also comes with a change to the format of the `fill_gradient` and
`stroke_gradient` methods. You can continue to use the old method parameters
and only specify two colors, or use the new keyword arguments to specify
arbitrary stops.
As a bonus, if you use the new method style, `apply_transformations` is set true
automatically.
(Roger Nesbitt, [#902](https://github.com/prawnpdf/prawn/issues/984))
### Supported Rubies has changed
* Removed MRI 2.0, JRuby 1.7, and Rubinius support
* Added MRI 2.4 and JRuby 9k
### Catch unexpected manual changes
For a long time changes to manual were hard to spot because it was a manual
process. There was no way to know for sure if the manual has changed or not.
Now manual changes are caught during build.
(Alexander Mankuta, [#949](https://github.com/prawnpdf/prawn/pull/949))
### Validate colors passed in as strings must be valid hexadecimal
Colors that were passed with a # would previously be misrepresented. Now
any colors passed in as a string must be valid hexadecimal or they will
raise an error.
(Tom Prats, [#807](https://github.com/prawnpdf/prawn/issues/807), [#869](https://github.com/prawnpdf/prawn/issues/869))
### Don't raise CannotFit when first fragment in array is a zero-width space
When determining what formatted text will fit within a box that has a fixed
width, don't raise a CannotFit error prematurely if the line begins with a
zero-width fragment and the next fragment exceeds the width.
Before finishing a line, the line is marked as not having more than one word
if the accumulated width of the line is zero. This is a clear indication that
the fragments previously visited did not produce any content (e.g., a
zero-width space).
(Dan Allen, [#984](https://github.com/prawnpdf/prawn/issues/984))
## PrawnPDF 2.1.0 -- 2016-02-29
### Added support for PNG images with indexed transparency
......@@ -14,6 +124,22 @@ Fix a few issues with code style that were triggering warnings in IRB when run i
(Jesse Doyle, [#914](https://github.com/prawnpdf/prawn/pull/914))
### Gradients can have multiple stops to blend more than two colors
Previously, only two colors could be specified in a gradient: the start
and end colors. This change allows any number of colors to be specified,
along with the position between 0 and 1 as to where they should be displayed.
This change also comes with a change to the format of the `fill_gradient`
and `stroke_gradient` methods. You can continue to use the old method
parameters and only specify two colors, or use the new keyword arguments
to specify arbitrary stops.
As a bonus, if you use the new method style, `apply_transformations` is
set true automatically (see below).
(Roger Nesbitt)
### Gradients applied inside transformations are now correctly positioned
PDF gradients/patterns take coordinates in the coordinate space of the
......
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at conduct@prawnpdf.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
All contributors must agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md)
1. Bug reports are welcome, but please make sure to include a minimal code sample that
shows your problem. In most cases, we'll need you to give us an example that we
can actually run, so include any necessary sample data. A screenshot
......
source "https://rubygems.org"
source 'https://rubygems.org'
gemspec
if ENV["CI"]
platforms :rbx do
gem "rubysl-singleton", "~> 2.0"
gem "rubysl-digest", "~> 2.0"
gem "rubysl-enumerator", "~> 2.0"
end
end
This diff is collapsed.
require "bundler"
require 'bundler'
Bundler.setup
require 'rake'
......@@ -7,43 +7,33 @@ require 'yard'
require 'rubygems/package_task'
require 'rubocop/rake_task'
task :default => [:spec, :rubocop]
task default: [:spec, :rubocop]
desc "Run all rspec files"
RSpec::Core::RakeTask.new("spec") do |c|
c.rspec_opts = "-t ~unresolved"
end
desc "Show library's code statistics"
task :stats do
require 'code_statistics/code_statistics'
puts CodeStatistics::CodeStatistics.new(
[
["Prawn", "lib"],
["Specs", "spec"]
]
).to_s
desc 'Run all rspec files'
RSpec::Core::RakeTask.new('spec') do |c|
c.rspec_opts = '-t ~unresolved'
end
YARD::Rake::YardocTask.new do |t|
t.options = ['--output-dir', 'doc/html']
end
task :docs => :yard
task docs: :yard
desc "Generate the 'Prawn by Example' manual"
task :manual do
puts "Building manual..."
require File.expand_path(File.join(File.dirname(__FILE__), %w[manual contents]))
puts "The Prawn manual is available at manual.pdf. Happy Prawning!"
puts 'Building manual...'
require File.expand_path(File.join(__dir__, %w[manual contents]))
prawn_manual_document.render_file('manual.pdf')
puts 'The Prawn manual is available at manual.pdf. Happy Prawning!'
end
spec = Gem::Specification.load "prawn.gemspec"
spec = Gem::Specification.load 'prawn.gemspec'
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
desc "Run a console with Prawn loaded"
desc 'Run a console with Prawn loaded'
task :console do
require 'irb'
require 'irb/completion'
......
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"
require 'prawn'
require 'benchmark'
N = 2000
Benchmark.bmbm do |x|
x.report("AFM text") do
Prawn::Document.new {
x.report('AFM text') do
Prawn::Document.new do
N.times do
(1..5).each do |i|
draw_text "Hello Prawn", :at => [200, i * 100]
draw_text 'Hello Prawn', at: [200, i * 100]
end
start_new_page
end
}.render
end.render
end
end
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"
require "benchmark"
require 'prawn'
require 'benchmark'
N = 100
Benchmark.bmbm do |x|
x.report("PNG Type 6") do
x.report('PNG Type 6') do
N.times do
Prawn::Document.new do
image "#{Prawn::DATADIR}/images/dice.png"
end.render_file("dice.pdf")
end.render_file('dice.pdf')
end
end
end
# encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require "prawn"