Skip to content

Commit

Permalink
Merge branch 'master' into fix-gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mitosch authored Sep 12, 2024
2 parents a339e1b + 23cff7f commit c7d2765
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 52 deletions.
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ require:
AllCops:
TargetRubyVersion: 2.5
NewCops: enable
Exclude:
- prawn-swiss_qr_bill.gemspec

# Prawn is descriptive and needs more branches (methods)
Metrics/AbcSize:
Expand All @@ -21,9 +23,11 @@ RSpec/ExampleLength:

# Unlimited block length for specs
Metrics/BlockLength:
IgnoredMethods: ['describe']
AllowedMethods: ['describe']

Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*'

RSpec/NoExpectationExample:
Enabled: false
98 changes: 59 additions & 39 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,79 +10,98 @@ PATH
GEM
remote: http://rubygems.org/
specs:
Ascii85 (1.1.0)
Ascii85 (1.1.1)
afm (0.2.2)
ast (2.4.2)
bigdecimal (3.1.8)
chunky_png (1.4.0)
concurrent-ruby (1.3.4)
diff-lcs (1.5.0)
docile (1.4.0)
hashery (2.1.2)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
matrix (0.4.2)
parallel (1.21.0)
parser (3.1.0.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
pdf-core (0.9.0)
pdf-reader (2.9.1)
racc
pdf-core (0.10.0)
pdf-reader (2.12.0)
Ascii85 (~> 1.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
ttfunk
prawn (2.4.0)
pdf-core (~> 0.9.0)
ttfunk (~> 1.7)
prawn (2.5.0)
matrix (~> 0.4)
pdf-core (~> 0.10.0)
ttfunk (~> 1.8)
racc (1.8.1)
rainbow (3.1.1)
regexp_parser (2.2.0)
rexml (3.2.5)
rqrcode (2.2.0)
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (1.25.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.15.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1)
parser (>= 3.0.1.1)
rubocop-performance (1.13.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rspec (2.8.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-performance (1.21.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.29.1)
rubocop (~> 1.61)
ruby-progressbar (1.13.0)
ruby-rc4 (0.1.5)
simplecov (0.21.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
ttfunk (1.7.0)
unicode-display_width (2.1.0)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
ttfunk (1.8.0)
bigdecimal (~> 3.1)
unicode-display_width (2.5.0)

PLATFORMS
x86_64-linux
Expand All @@ -93,9 +112,10 @@ DEPENDENCIES
rspec (~> 3.0)
rubocop (~> 1.0)
rubocop-performance (~> 1.5)
rubocop-rake (~> 0.6.0)
rubocop-rspec (~> 2.8)
simplecov (~> 0.16)
simplecov-cobertura (~> 2.0)

BUNDLED WITH
2.3.7
2.4.19
14 changes: 7 additions & 7 deletions lib/prawn/swiss_qr_bill/qr/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def initialize(fields = {}, options = {})

# set defaults
FIELDS.each_key do |field|
instance_variable_set("@#{field}", FIELDS[field].default)
instance_variable_set(:"@#{field}", FIELDS[field].default)
end

# set given
fields.each_key do |field|
instance_variable_set("@#{field}", fields[field])
instance_variable_set(:"@#{field}", fields[field])
end
end

Expand All @@ -90,7 +90,7 @@ def generate

stack = []
FIELDS.each_key do |k|
var = instance_variable_get("@#{k}")
var = instance_variable_get(:"@#{k}")

# TODO: fix possible wrong format if alt parameters (last one) is given
next if FIELDS[k][:skippable] && var.nil?
Expand All @@ -105,17 +105,17 @@ def generate

def process
FIELDS.each_key do |k|
var = instance_variable_get("@#{k}")
var = instance_variable_get(:"@#{k}")

instance_variable_set("@#{k}", FIELDS[k][:format].call(var)) if FIELDS[k][:format].is_a?(Proc)
instance_variable_set(:"@#{k}", FIELDS[k][:format].call(var)) if FIELDS[k][:format].is_a?(Proc)
end
end

def validate
FIELDS.each_key do |k|
next unless FIELDS[k][:validation]

var = instance_variable_get("@#{k}")
var = instance_variable_get(:"@#{k}")

call_validator(FIELDS[k][:validation], var)
end
Expand All @@ -133,7 +133,7 @@ def call_validator(validator, value)
validator.call(value)
# :nocov:
when Symbol
send("#{validator}_validator", value)
send(:"#{validator}_validator", value)
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/prawn/swiss_qr_bill/specifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class Specifications
height: Spec.new(nil, ->(v) { from_mm(v) }),
content_font_size: Spec.new,
content_font_leading: Spec.new(0),
content_font_style: Spec.new(:normal, ->(v) { v.to_sym }),
content_font_style: Spec.new(:normal, lambda(&:to_sym)),
label_font_size: Spec.new,
label_font_leading: Spec.new(0),
label_font_style: Spec.new(:bold, ->(v) { v.to_sym })
label_font_style: Spec.new(:bold, lambda(&:to_sym))
}.freeze

def initialize
Expand Down
1 change: 1 addition & 0 deletions prawn-swiss_qr_bill.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rubocop', '~> 1.0'
spec.add_development_dependency 'rubocop-performance', '~> 1.5'
spec.add_development_dependency 'rubocop-rspec', '~> 2.8'
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
spec.add_development_dependency 'simplecov', '~> 0.16'
spec.add_development_dependency 'simplecov-cobertura', '~> 2.0'

Expand Down
2 changes: 1 addition & 1 deletion spec/features/compatibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

describe '#swiss_qr_bill' do
context 'when one argument is given' do
it 'works' do
it 'works without arguments' do
document.swiss_qr_bill(bill_full)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/pdf_generation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

before do
FileUtils.rm(outfile) if File.exist?(outfile)
FileUtils.rm_f(outfile)
end

after do |spec|
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |f| require f }

# Ensure tmp dir
FileUtils.mkdir(TMP_DIR) unless Dir.exist?(TMP_DIR)
FileUtils.mkdir_p(TMP_DIR)

0 comments on commit c7d2765

Please sign in to comment.