webtranslateit-payday 1.7.3 → 2.0.0

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/lib/payday.rb CHANGED
@@ -8,14 +8,14 @@ loader.setup
8
8
  require 'active_support/core_ext/object/blank' # For Object#blank? method
9
9
  require 'bigdecimal'
10
10
  require 'date'
11
+ require 'json'
11
12
  require 'money'
12
- require 'prawn'
13
- require 'prawn/table'
14
- require 'prawn-svg'
13
+ require 'typst'
15
14
  require 'time'
16
15
 
17
- # Load translations from the locale folder
18
- I18n.load_path.concat(Dir[File.join('config', 'locales', '*.yml')])
16
+ # Load our own translations. This has to resolve against the gem rather than the working
17
+ # directory, or the locales only load when the process happens to be running from the gem root.
18
+ I18n.load_path.concat(Dir[File.expand_path('../config/locales/*.yml', __dir__)])
19
19
 
20
20
  module Payday
21
21
  end
data/payday.gemspec CHANGED
@@ -2,26 +2,29 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'webtranslateit-payday'
5
- s.version = '1.7.3'
6
- s.required_ruby_version = '>= 3.1'
5
+ s.version = '2.0.0'
6
+ s.required_ruby_version = '>= 3.2'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Alan Johnson', 'Edouard Briere']
9
9
  s.email = ['edouard@webtranslateit.com']
10
10
  s.homepage = 'https://github.com/webtranslateit/payday'
11
11
  s.summary = 'A simple library for rendering invoices.'
12
- s.description = 'Payday is a library for rendering invoices to pdf.'
12
+ s.description = 'Payday is a library for rendering invoices to pdf, using Typst.'
13
13
  s.license = 'MIT'
14
14
 
15
15
  s.add_dependency 'activesupport', '>= 7', '< 9'
16
16
  s.add_dependency 'i18n', '~> 1.12', '< 2'
17
17
  s.add_dependency 'money', '>= 6.16', '< 8.0'
18
- s.add_dependency 'prawn', '~> 2.4', '< 3'
19
- s.add_dependency 'prawn-svg', '~> 0.32', '< 1'
20
- s.add_dependency 'prawn-table', '~> 0.2', '< 1'
21
18
  s.add_dependency 'rqrcode', '>= 2', '< 4'
19
+ s.add_dependency 'typst', '~> 0.15'
22
20
  s.add_dependency 'zeitwerk', '~> 2.6', '< 3'
23
21
 
24
- s.files = `git ls-files`.split("\n")
22
+ # Only what the gem needs at run time, plus the docs. The spec suite carries several
23
+ # hundred kilobytes of reference PDFs that nobody installing this wants.
24
+ root_files = %w[README.md CHANGELOG.md payday.gemspec].freeze
25
+ s.files = `git ls-files -z`.split("\x0").select do |path|
26
+ path.start_with?('lib/', 'config/locales/', 'fonts/') || root_files.include?(path)
27
+ end
25
28
  s.require_paths = ['lib']
26
29
  s.metadata['rubygems_mfa_required'] = 'true'
27
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webtranslateit-payday
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Johnson
@@ -71,85 +71,39 @@ dependencies:
71
71
  - !ruby/object:Gem::Version
72
72
  version: '8.0'
73
73
  - !ruby/object:Gem::Dependency
74
- name: prawn
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '2.4'
80
- - - "<"
81
- - !ruby/object:Gem::Version
82
- version: '3'
83
- type: :runtime
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '2.4'
90
- - - "<"
91
- - !ruby/object:Gem::Version
92
- version: '3'
93
- - !ruby/object:Gem::Dependency
94
- name: prawn-svg
74
+ name: rqrcode
95
75
  requirement: !ruby/object:Gem::Requirement
96
76
  requirements:
97
- - - "~>"
77
+ - - ">="
98
78
  - !ruby/object:Gem::Version
99
- version: '0.32'
79
+ version: '2'
100
80
  - - "<"
101
81
  - !ruby/object:Gem::Version
102
- version: '1'
82
+ version: '4'
103
83
  type: :runtime
104
84
  prerelease: false
105
85
  version_requirements: !ruby/object:Gem::Requirement
106
86
  requirements:
107
- - - "~>"
87
+ - - ">="
108
88
  - !ruby/object:Gem::Version
109
- version: '0.32'
89
+ version: '2'
110
90
  - - "<"
111
91
  - !ruby/object:Gem::Version
112
- version: '1'
92
+ version: '4'
113
93
  - !ruby/object:Gem::Dependency
114
- name: prawn-table
94
+ name: typst
115
95
  requirement: !ruby/object:Gem::Requirement
116
96
  requirements:
117
97
  - - "~>"
118
98
  - !ruby/object:Gem::Version
119
- version: '0.2'
120
- - - "<"
121
- - !ruby/object:Gem::Version
122
- version: '1'
99
+ version: '0.15'
123
100
  type: :runtime
124
101
  prerelease: false
125
102
  version_requirements: !ruby/object:Gem::Requirement
126
103
  requirements:
127
104
  - - "~>"
128
105
  - !ruby/object:Gem::Version
129
- version: '0.2'
130
- - - "<"
131
- - !ruby/object:Gem::Version
132
- version: '1'
133
- - !ruby/object:Gem::Dependency
134
- name: rqrcode
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- version: '2'
140
- - - "<"
141
- - !ruby/object:Gem::Version
142
- version: '4'
143
- type: :runtime
144
- prerelease: false
145
- version_requirements: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- version: '2'
150
- - - "<"
151
- - !ruby/object:Gem::Version
152
- version: '4'
106
+ version: '0.15'
153
107
  - !ruby/object:Gem::Dependency
154
108
  name: zeitwerk
155
109
  requirement: !ruby/object:Gem::Requirement
@@ -170,27 +124,15 @@ dependencies:
170
124
  - - "<"
171
125
  - !ruby/object:Gem::Version
172
126
  version: '3'
173
- description: Payday is a library for rendering invoices to pdf.
127
+ description: Payday is a library for rendering invoices to pdf, using Typst.
174
128
  email:
175
129
  - edouard@webtranslateit.com
176
130
  executables: []
177
131
  extensions: []
178
132
  extra_rdoc_files: []
179
133
  files:
180
- - ".gitattributes"
181
- - ".github/dependabot.yml"
182
- - ".github/release-drafter.yml"
183
- - ".github/workflows/ci.yml"
184
- - ".github/workflows/release-drafter.yml"
185
- - ".gitignore"
186
- - ".rubocop.yml"
187
- - ".rubocop_todo.yml"
188
134
  - CHANGELOG.md
189
- - Gemfile
190
- - Gemfile.lock
191
- - Guardfile
192
135
  - README.md
193
- - Rakefile
194
136
  - config/locales/payday.de.yml
195
137
  - config/locales/payday.en.yml
196
138
  - config/locales/payday.es.yml
@@ -205,25 +147,18 @@ files:
205
147
  - lib/generators/payday/setup/templates/line_item.rb
206
148
  - lib/generators/payday/setup/templates/migration.rb
207
149
  - lib/payday.rb
150
+ - lib/payday/assets/default_logo.png
208
151
  - lib/payday/config.rb
209
152
  - lib/payday/invoice.rb
153
+ - lib/payday/invoice_presenter.rb
210
154
  - lib/payday/invoiceable.rb
211
155
  - lib/payday/line_item.rb
212
156
  - lib/payday/line_itemable.rb
157
+ - lib/payday/markup.rb
213
158
  - lib/payday/pdf_renderer.rb
159
+ - lib/payday/qr_code.rb
160
+ - lib/payday/templates/invoice.typ
214
161
  - payday.gemspec
215
- - spec/assets/default_logo.png
216
- - spec/assets/example_invoice_with_qr.pdf
217
- - spec/assets/svg.pdf
218
- - spec/assets/testing.pdf
219
- - spec/assets/testing_es.pdf
220
- - spec/assets/testing_predefined_amount.pdf
221
- - spec/assets/tiger.svg
222
- - spec/invoice_spec.rb
223
- - spec/line_item_spec.rb
224
- - spec/pdf_renderer_spec.rb
225
- - spec/spec_helper.rb
226
- - spec/support/asset_matchers.rb
227
162
  homepage: https://github.com/webtranslateit/payday
228
163
  licenses:
229
164
  - MIT
@@ -236,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
236
171
  requirements:
237
172
  - - ">="
238
173
  - !ruby/object:Gem::Version
239
- version: '3.1'
174
+ version: '3.2'
240
175
  required_rubygems_version: !ruby/object:Gem::Requirement
241
176
  requirements:
242
177
  - - ">="
data/.gitattributes DELETED
@@ -1 +0,0 @@
1
- *.pdf binary
@@ -1,28 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "bundler" # See documentation for possible values
9
- directory: "/" # Location of package manifests
10
- schedule:
11
- interval: "weekly"
12
- day: "monday"
13
- time: "04:00"
14
- reviewers:
15
- - edouard
16
- assignees:
17
- - edouard
18
-
19
- - package-ecosystem: github-actions
20
- directory: "/"
21
- schedule:
22
- interval: weekly
23
- day: monday
24
- time: "04:00"
25
- reviewers:
26
- - edouard
27
- assignees:
28
- - edouard
@@ -1,36 +0,0 @@
1
- name-template: '$RESOLVED_VERSION 🌈'
2
- tag-template: '$RESOLVED_VERSION'
3
- categories:
4
- - title: '🚀 Features'
5
- labels:
6
- - 'feature'
7
- - 'enhancement'
8
- - title: '🐛 Bug Fixes'
9
- labels:
10
- - 'bug'
11
- - 'design'
12
- - 'performance'
13
- - title: '🧰 Maintenance'
14
- labels:
15
- - 'admin'
16
- - 'refactoring'
17
- - 'dependencies'
18
- - 'github_actions'
19
- - 'tests'
20
- change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
21
- change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
22
- version-resolver:
23
- major:
24
- labels:
25
- - 'major'
26
- minor:
27
- labels:
28
- - 'minor'
29
- patch:
30
- labels:
31
- - 'patch'
32
- default: patch
33
- template: |
34
- ## Changes
35
-
36
- $CHANGES
@@ -1,47 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on: push
11
-
12
- jobs:
13
- test:
14
- runs-on: ubuntu-latest
15
- strategy:
16
- matrix:
17
- ruby-version: ['3.2', '3.3', '3.4']
18
-
19
- steps:
20
- - uses: actions/checkout@v6
21
- - name: Set up Ruby
22
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
23
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
24
- uses: ruby/setup-ruby@v1
25
- with:
26
- ruby-version: ${{ matrix.ruby-version }}
27
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
28
- - name: Run tests
29
- run: bundle exec rspec
30
-
31
- linters:
32
- name: Linters
33
- runs-on: ubuntu-latest
34
- timeout-minutes: 10
35
-
36
- steps:
37
- - name: Checkout repository
38
- uses: actions/checkout@v6
39
-
40
- - name: Install ruby and gems
41
- uses: ruby/setup-ruby@v1
42
- with:
43
- ruby-version: 3.3.6 # Use .ruby-version file instead of duplicating here and in Gemfile?
44
- bundler-cache: true
45
-
46
- - name: Run ruby linter
47
- run: bundle exec rubocop --format github
@@ -1,29 +0,0 @@
1
- name: Release Drafter
2
-
3
- on:
4
- push:
5
- # branches to consider in the event; optional, defaults to all
6
- branches:
7
- - main
8
- # pull_request event is required only for autolabeler
9
- pull_request:
10
- # Only following types are handled by the action, but one can default to all as well
11
- types: [opened, reopened, synchronize]
12
-
13
- jobs:
14
- update_release_draft:
15
- runs-on: ubuntu-latest
16
- steps:
17
- # (Optional) GitHub Enterprise requires GHE_HOST variable set
18
- #- name: Set GHE_HOST
19
- # run: |
20
- # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
21
-
22
- # Drafts your next Release notes as Pull Requests are merged into "master"
23
- - uses: release-drafter/release-drafter@v6
24
- # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
25
- # with:
26
- # config-name: my-config.yml
27
- # disable-autolabeler: true
28
- env:
29
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- tmp/
2
- doc/
3
- .yardoc/
4
- *.gem
5
- .bundle
6
- pkg/*
7
- bin/
8
- .rubocop-http*
data/.rubocop.yml DELETED
@@ -1,16 +0,0 @@
1
- plugins:
2
- - rubocop-performance
3
- - rubocop-rspec
4
-
5
- inherit_from:
6
- - https://raw.githubusercontent.com/webtranslateit/webtranslateit/main/.rubocop_common.yml
7
- - .rubocop_todo.yml
8
-
9
- AllCops:
10
- TargetRubyVersion: 3.1
11
- Exclude:
12
- - lib/generators/**/*
13
-
14
- inherit_mode:
15
- merge:
16
- - Exclude
data/.rubocop_todo.yml DELETED
File without changes
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'guard'
8
- gem 'guard-rspec'
9
- gem 'guard-rubocop'
10
- gem 'matrix'
11
- gem 'rspec', '~> 3.13.2'
12
- gem 'rubocop'
13
- gem 'rubocop-performance'
14
- gem 'rubocop-rspec'
data/Gemfile.lock DELETED
@@ -1,191 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- webtranslateit-payday (1.7.3)
5
- activesupport (>= 7, < 9)
6
- i18n (~> 1.12, < 2)
7
- money (>= 6.16, < 8.0)
8
- prawn (~> 2.4, < 3)
9
- prawn-svg (~> 0.32, < 1)
10
- prawn-table (~> 0.2, < 1)
11
- rqrcode (>= 2, < 4)
12
- zeitwerk (~> 2.6, < 3)
13
-
14
- GEM
15
- remote: https://rubygems.org/
16
- specs:
17
- activesupport (7.2.3)
18
- base64
19
- benchmark (>= 0.3)
20
- bigdecimal
21
- concurrent-ruby (~> 1.0, >= 1.3.1)
22
- connection_pool (>= 2.2.5)
23
- drb
24
- i18n (>= 1.6, < 2)
25
- logger (>= 1.4.2)
26
- minitest (>= 5.1)
27
- securerandom (>= 0.3)
28
- tzinfo (~> 2.0, >= 2.0.5)
29
- addressable (2.8.7)
30
- public_suffix (>= 2.0.2, < 7.0)
31
- ast (2.4.3)
32
- base64 (0.3.0)
33
- benchmark (0.5.0)
34
- bigdecimal (3.3.1)
35
- chunky_png (1.4.0)
36
- coderay (1.1.3)
37
- concurrent-ruby (1.3.6)
38
- connection_pool (2.5.4)
39
- css_parser (1.21.1)
40
- addressable
41
- diff-lcs (1.6.2)
42
- drb (2.2.3)
43
- ffi (1.17.3-arm64-darwin)
44
- ffi (1.17.3-x86_64-darwin)
45
- ffi (1.17.3-x86_64-linux-gnu)
46
- formatador (1.2.3)
47
- reline
48
- guard (2.20.1)
49
- formatador (>= 0.2.4)
50
- listen (>= 2.7, < 4.0)
51
- logger (~> 1.6)
52
- lumberjack (>= 1.0.12, < 2.0)
53
- nenv (~> 0.1)
54
- notiffany (~> 0.0)
55
- pry (>= 0.13.0)
56
- shellany (~> 0.0)
57
- thor (>= 0.18.1)
58
- guard-compat (1.2.1)
59
- guard-rspec (4.7.3)
60
- guard (~> 2.1)
61
- guard-compat (~> 1.1)
62
- rspec (>= 2.99.0, < 4.0)
63
- guard-rubocop (1.5.0)
64
- guard (~> 2.0)
65
- rubocop (< 2.0)
66
- i18n (1.14.8)
67
- concurrent-ruby (~> 1.0)
68
- io-console (0.8.2)
69
- json (2.18.1)
70
- language_server-protocol (3.17.0.5)
71
- lint_roller (1.1.0)
72
- listen (3.10.0)
73
- logger
74
- rb-fsevent (~> 0.10, >= 0.10.3)
75
- rb-inotify (~> 0.9, >= 0.9.10)
76
- logger (1.7.0)
77
- lumberjack (1.4.2)
78
- matrix (0.4.3)
79
- method_source (1.1.0)
80
- minitest (5.26.0)
81
- money (7.0.2)
82
- bigdecimal
83
- i18n (~> 1.9)
84
- nenv (0.3.0)
85
- notiffany (0.1.3)
86
- nenv (~> 0.1)
87
- shellany (~> 0.0)
88
- parallel (1.27.0)
89
- parser (3.3.10.1)
90
- ast (~> 2.4.1)
91
- racc
92
- pdf-core (0.10.0)
93
- prawn (2.5.0)
94
- matrix (~> 0.4)
95
- pdf-core (~> 0.10.0)
96
- ttfunk (~> 1.8)
97
- prawn-svg (0.38.1)
98
- css_parser (~> 1.6)
99
- matrix (~> 0.4.2)
100
- prawn (>= 0.11.1, < 3)
101
- rexml (>= 3.4.2, < 4)
102
- prawn-table (0.2.2)
103
- prawn (>= 1.3.0, < 3.0.0)
104
- prism (1.9.0)
105
- pry (0.16.0)
106
- coderay (~> 1.1)
107
- method_source (~> 1.0)
108
- reline (>= 0.6.0)
109
- public_suffix (6.0.2)
110
- racc (1.8.1)
111
- rainbow (3.1.1)
112
- rb-fsevent (0.11.2)
113
- rb-inotify (0.11.1)
114
- ffi (~> 1.0)
115
- regexp_parser (2.11.3)
116
- reline (0.6.3)
117
- io-console (~> 0.5)
118
- rexml (3.4.4)
119
- rqrcode (3.1.1)
120
- chunky_png (~> 1.0)
121
- rqrcode_core (~> 2.0)
122
- rqrcode_core (2.0.1)
123
- rspec (3.13.2)
124
- rspec-core (~> 3.13.0)
125
- rspec-expectations (~> 3.13.0)
126
- rspec-mocks (~> 3.13.0)
127
- rspec-core (3.13.6)
128
- rspec-support (~> 3.13.0)
129
- rspec-expectations (3.13.5)
130
- diff-lcs (>= 1.2.0, < 2.0)
131
- rspec-support (~> 3.13.0)
132
- rspec-mocks (3.13.6)
133
- diff-lcs (>= 1.2.0, < 2.0)
134
- rspec-support (~> 3.13.0)
135
- rspec-support (3.13.6)
136
- rubocop (1.84.2)
137
- json (~> 2.3)
138
- language_server-protocol (~> 3.17.0.2)
139
- lint_roller (~> 1.1.0)
140
- parallel (~> 1.10)
141
- parser (>= 3.3.0.2)
142
- rainbow (>= 2.2.2, < 4.0)
143
- regexp_parser (>= 2.9.3, < 3.0)
144
- rubocop-ast (>= 1.49.0, < 2.0)
145
- ruby-progressbar (~> 1.7)
146
- unicode-display_width (>= 2.4.0, < 4.0)
147
- rubocop-ast (1.49.0)
148
- parser (>= 3.3.7.2)
149
- prism (~> 1.7)
150
- rubocop-performance (1.26.1)
151
- lint_roller (~> 1.1)
152
- rubocop (>= 1.75.0, < 2.0)
153
- rubocop-ast (>= 1.47.1, < 2.0)
154
- rubocop-rspec (3.9.0)
155
- lint_roller (~> 1.1)
156
- rubocop (~> 1.81)
157
- ruby-progressbar (1.13.0)
158
- securerandom (0.4.1)
159
- shellany (0.0.1)
160
- thor (1.5.0)
161
- ttfunk (1.8.0)
162
- bigdecimal (~> 3.1)
163
- tzinfo (2.0.6)
164
- concurrent-ruby (~> 1.0)
165
- unicode-display_width (3.2.0)
166
- unicode-emoji (~> 4.1)
167
- unicode-emoji (4.2.0)
168
- zeitwerk (2.7.1)
169
-
170
- PLATFORMS
171
- arm64-darwin-21
172
- arm64-darwin-22
173
- arm64-darwin-23
174
- arm64-darwin-24
175
- arm64-darwin-25
176
- x86_64-darwin-21
177
- x86_64-linux
178
-
179
- DEPENDENCIES
180
- guard
181
- guard-rspec
182
- guard-rubocop
183
- matrix
184
- rspec (~> 3.13.2)
185
- rubocop
186
- rubocop-performance
187
- rubocop-rspec
188
- webtranslateit-payday!
189
-
190
- BUNDLED WITH
191
- 2.6.2
data/Guardfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- guard :rspec, cmd: 'bundle exec rspec --color --format progress' do
4
- watch(%r{^spec/.+_spec\.rb$})
5
- watch('spec/spec_helper.rb') { 'spec' }
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- end
8
-
9
- guard :rubocop do
10
- watch(/.+\.rb$/)
11
- watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
12
- end
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler'
4
-
5
- require 'rake'
6
- require 'rake/testtask'
7
-
8
- task default: :test
9
-
10
- Bundler::GemHelper.install_tasks
11
-
12
- Rake::TestTask.new do |t|
13
- t.test_files = FileList['test/**/*_test.rb']
14
- end