texd 0.3.2 → 0.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ee764a1a8120ae0b54ad110cfc3ba25a2ca921a5fd624c3fa5da036b2fb3c5d
4
- data.tar.gz: 54da08cc7ff4177e845afcfa384139935eaee421b14e5ec2827ef7a94f91a3ad
3
+ metadata.gz: f6bbbe0b3497e37a0c6aad0d14c4869642b3f515082a3527ce176f7a043b868d
4
+ data.tar.gz: 36dc2ada8433384db1e2e39534a9a43d54290e7189398942e92911e7b4801da3
5
5
  SHA512:
6
- metadata.gz: 57df5731df9356a484732266af41022dfe39fec86890e2f4983fac495827713d2f81a85e31318ff103f72c0dff5266d42c9c9f4bfcf7faf1014ed2c776ec2254
7
- data.tar.gz: 3f9e4d4d9f14a993099a509903d33e58f16756f55f9c647968c0f628ceeaed96ce76f1cea30244128919ccd89774ec60289c61eaded6a0e4608636374a53638d
6
+ metadata.gz: 1aadeb5f3c91bb5894d9c207a8f42e34ae359463f22921fc83299157c01b63bbcb7fe3f4ac466f982ae7571aa4081542ba33e6b631811aa48ca03db527af993a
7
+ data.tar.gz: b904d72f6f4630665f263a3d4a57ef1fe53e38f3ed46c162bb546bad33d7e555d3d6734e65148e97111e1077279fcb9150998142d371c19cad969b5bfe5c3e64
data/.rubocop.yml CHANGED
@@ -154,6 +154,10 @@ Metrics/BlockLength:
154
154
  - spec/**/*.rb
155
155
  - config/**/*.rb
156
156
 
157
+ Metrics/ClassLength:
158
+ Exclude:
159
+ - lib/texd/config.rb
160
+
157
161
  Metrics/ModuleLength:
158
162
  CountComments: false # count full line comments?
159
163
 
@@ -325,3 +329,18 @@ Style/TrailingCommaInArrayLiteral:
325
329
  Style/TrailingCommaInHashLiteral:
326
330
  EnforcedStyleForMultiline: comma
327
331
 
332
+ ## RSpec Cops - https://docs.rubocop.org/rubocop-rspec/cops_rspec.html
333
+
334
+ RSpec/ExampleLength:
335
+ Max: 10
336
+ CountAsOne: [array, hash, heredoc]
337
+
338
+ RSpec/ExpectActual:
339
+ Exclude:
340
+ - spec/lib/texd/lookup_context_spec.rb # creative use of expect(...) with custom matcher
341
+
342
+ RSpec/MultipleExpectations:
343
+ Max: 6
344
+
345
+ RSpec/NestedGroups:
346
+ Max: 5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
- ## [Unreleased]
1
+ ## Unreleased
2
2
 
3
- ## [0.1.0] - 2022-03-14
3
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.2...master)
4
4
 
5
- - Initial release
5
+ ## v0.4.2 - 2022-06-16
6
+
7
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.1...v0.4.2)
8
+
9
+ **Changes**
10
+
11
+ - fix deprecation warning ("constant ::UploadIO is deprecated")
12
+
13
+ ## v0.4.1 - 2022-06-16
14
+
15
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.1)
16
+
17
+ **Changes**
18
+
19
+ - add support for configurable error handling
20
+
21
+ ## v0.3.2 - 2022-03-28
22
+
23
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.2.2...v0.3.2)
24
+
25
+ **Changes**
26
+
27
+ - add support for Texd reference store
28
+ - add support for Basic Auth credentials
29
+
30
+ ## v0.2.2 - 2022-03-22
31
+
32
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.1.0...v0.2.2)
33
+
34
+ **Fixes**
35
+
36
+ - `escape` helper now handles nil values
37
+ - improve Ruby 3.x compatability
38
+
39
+ **Changes**
40
+
41
+ - state arguments for `Texd.render`/`Texd::Document.render` explicitly
42
+ (forbid no arbitrary arguments)
43
+ - refactor template locals
44
+
45
+ ## v0.1.0 - 2022-03-14
46
+
47
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/4562035e...v0.1.0)
48
+
49
+ - First public release
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- texd (0.3.2)
4
+ texd (0.4.2)
5
5
  multipart-post (~> 2.0)
6
6
  rails (>= 6.0, < 8)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.2.3)
12
- actionpack (= 7.0.2.3)
13
- activesupport (= 7.0.2.3)
11
+ actioncable (7.0.3)
12
+ actionpack (= 7.0.3)
13
+ activesupport (= 7.0.3)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.2.3)
17
- actionpack (= 7.0.2.3)
18
- activejob (= 7.0.2.3)
19
- activerecord (= 7.0.2.3)
20
- activestorage (= 7.0.2.3)
21
- activesupport (= 7.0.2.3)
16
+ actionmailbox (7.0.3)
17
+ actionpack (= 7.0.3)
18
+ activejob (= 7.0.3)
19
+ activerecord (= 7.0.3)
20
+ activestorage (= 7.0.3)
21
+ activesupport (= 7.0.3)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.2.3)
27
- actionpack (= 7.0.2.3)
28
- actionview (= 7.0.2.3)
29
- activejob (= 7.0.2.3)
30
- activesupport (= 7.0.2.3)
26
+ actionmailer (7.0.3)
27
+ actionpack (= 7.0.3)
28
+ actionview (= 7.0.3)
29
+ activejob (= 7.0.3)
30
+ activesupport (= 7.0.3)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.2.3)
37
- actionview (= 7.0.2.3)
38
- activesupport (= 7.0.2.3)
36
+ actionpack (7.0.3)
37
+ actionview (= 7.0.3)
38
+ activesupport (= 7.0.3)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.2.3)
44
- actionpack (= 7.0.2.3)
45
- activerecord (= 7.0.2.3)
46
- activestorage (= 7.0.2.3)
47
- activesupport (= 7.0.2.3)
43
+ actiontext (7.0.3)
44
+ actionpack (= 7.0.3)
45
+ activerecord (= 7.0.3)
46
+ activestorage (= 7.0.3)
47
+ activesupport (= 7.0.3)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.2.3)
51
- activesupport (= 7.0.2.3)
50
+ actionview (7.0.3)
51
+ activesupport (= 7.0.3)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.2.3)
57
- activesupport (= 7.0.2.3)
56
+ activejob (7.0.3)
57
+ activesupport (= 7.0.3)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.2.3)
60
- activesupport (= 7.0.2.3)
61
- activerecord (7.0.2.3)
62
- activemodel (= 7.0.2.3)
63
- activesupport (= 7.0.2.3)
64
- activestorage (7.0.2.3)
65
- actionpack (= 7.0.2.3)
66
- activejob (= 7.0.2.3)
67
- activerecord (= 7.0.2.3)
68
- activesupport (= 7.0.2.3)
59
+ activemodel (7.0.3)
60
+ activesupport (= 7.0.3)
61
+ activerecord (7.0.3)
62
+ activemodel (= 7.0.3)
63
+ activesupport (= 7.0.3)
64
+ activestorage (7.0.3)
65
+ actionpack (= 7.0.3)
66
+ activejob (= 7.0.3)
67
+ activerecord (= 7.0.3)
68
+ activesupport (= 7.0.3)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.2.3)
71
+ activesupport (7.0.3)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -77,7 +77,7 @@ GEM
77
77
  builder (3.2.4)
78
78
  byebug (11.1.3)
79
79
  coderay (1.1.3)
80
- combustion (1.3.5)
80
+ combustion (1.3.7)
81
81
  activesupport (>= 3.0.0)
82
82
  railties (>= 3.0.0)
83
83
  thor (>= 0.14.6)
@@ -90,8 +90,7 @@ GEM
90
90
  activesupport (>= 5.0)
91
91
  i18n (1.10.0)
92
92
  concurrent-ruby (~> 1.0)
93
- io-wait (0.2.1)
94
- loofah (2.15.0)
93
+ loofah (2.18.0)
95
94
  crass (~> 1.0.2)
96
95
  nokogiri (>= 1.5.9)
97
96
  mail (2.7.1)
@@ -99,8 +98,9 @@ GEM
99
98
  marcel (1.0.2)
100
99
  method_source (1.0.0)
101
100
  mini_mime (1.1.2)
102
- minitest (5.15.0)
103
- multipart-post (2.1.1)
101
+ mini_portile2 (2.8.0)
102
+ minitest (5.16.1)
103
+ multipart-post (2.2.3)
104
104
  net-imap (0.2.3)
105
105
  digest
106
106
  net-protocol
@@ -109,18 +109,20 @@ GEM
109
109
  digest
110
110
  net-protocol
111
111
  timeout
112
- net-protocol (0.1.2)
113
- io-wait
112
+ net-protocol (0.1.3)
114
113
  timeout
115
114
  net-smtp (0.3.1)
116
115
  digest
117
116
  net-protocol
118
117
  timeout
119
118
  nio4r (2.5.8)
120
- nokogiri (1.13.3-x86_64-linux)
119
+ nokogiri (1.13.6)
120
+ mini_portile2 (~> 2.8.0)
121
+ racc (~> 1.4)
122
+ nokogiri (1.13.6-x86_64-linux)
121
123
  racc (~> 1.4)
122
124
  parallel (1.22.1)
123
- parser (3.1.1.0)
125
+ parser (3.1.2.0)
124
126
  ast (~> 2.4.1)
125
127
  pry (0.13.1)
126
128
  coderay (~> 1.1)
@@ -129,38 +131,38 @@ GEM
129
131
  byebug (~> 11.0)
130
132
  pry (~> 0.13.0)
131
133
  racc (1.6.0)
132
- rack (2.2.3)
133
- rack-test (1.1.0)
134
- rack (>= 1.0, < 3)
135
- rails (7.0.2.3)
136
- actioncable (= 7.0.2.3)
137
- actionmailbox (= 7.0.2.3)
138
- actionmailer (= 7.0.2.3)
139
- actionpack (= 7.0.2.3)
140
- actiontext (= 7.0.2.3)
141
- actionview (= 7.0.2.3)
142
- activejob (= 7.0.2.3)
143
- activemodel (= 7.0.2.3)
144
- activerecord (= 7.0.2.3)
145
- activestorage (= 7.0.2.3)
146
- activesupport (= 7.0.2.3)
134
+ rack (2.2.3.1)
135
+ rack-test (2.0.1)
136
+ rack (>= 1.3)
137
+ rails (7.0.3)
138
+ actioncable (= 7.0.3)
139
+ actionmailbox (= 7.0.3)
140
+ actionmailer (= 7.0.3)
141
+ actionpack (= 7.0.3)
142
+ actiontext (= 7.0.3)
143
+ actionview (= 7.0.3)
144
+ activejob (= 7.0.3)
145
+ activemodel (= 7.0.3)
146
+ activerecord (= 7.0.3)
147
+ activestorage (= 7.0.3)
148
+ activesupport (= 7.0.3)
147
149
  bundler (>= 1.15.0)
148
- railties (= 7.0.2.3)
150
+ railties (= 7.0.3)
149
151
  rails-dom-testing (2.0.3)
150
152
  activesupport (>= 4.2.0)
151
153
  nokogiri (>= 1.6)
152
- rails-html-sanitizer (1.4.2)
154
+ rails-html-sanitizer (1.4.3)
153
155
  loofah (~> 2.3)
154
- railties (7.0.2.3)
155
- actionpack (= 7.0.2.3)
156
- activesupport (= 7.0.2.3)
156
+ railties (7.0.3)
157
+ actionpack (= 7.0.3)
158
+ activesupport (= 7.0.3)
157
159
  method_source
158
160
  rake (>= 12.2)
159
161
  thor (~> 1.0)
160
162
  zeitwerk (~> 2.5)
161
163
  rainbow (3.1.1)
162
164
  rake (13.0.6)
163
- regexp_parser (2.2.1)
165
+ regexp_parser (2.5.0)
164
166
  rexml (3.2.5)
165
167
  rspec (3.11.0)
166
168
  rspec-core (~> 3.11.0)
@@ -171,10 +173,10 @@ GEM
171
173
  rspec-expectations (3.11.0)
172
174
  diff-lcs (>= 1.2.0, < 2.0)
173
175
  rspec-support (~> 3.11.0)
174
- rspec-mocks (3.11.0)
176
+ rspec-mocks (3.11.1)
175
177
  diff-lcs (>= 1.2.0, < 2.0)
176
178
  rspec-support (~> 3.11.0)
177
- rspec-rails (5.1.1)
179
+ rspec-rails (5.1.2)
178
180
  actionpack (>= 5.2)
179
181
  activesupport (>= 5.2)
180
182
  railties (>= 5.2)
@@ -183,41 +185,42 @@ GEM
183
185
  rspec-mocks (~> 3.10)
184
186
  rspec-support (~> 3.10)
185
187
  rspec-support (3.11.0)
186
- rubocop (1.26.1)
188
+ rubocop (1.31.0)
187
189
  parallel (~> 1.10)
188
190
  parser (>= 3.1.0.0)
189
191
  rainbow (>= 2.2.2, < 4.0)
190
192
  regexp_parser (>= 1.8, < 3.0)
191
- rexml
192
- rubocop-ast (>= 1.16.0, < 2.0)
193
+ rexml (>= 3.2.5, < 4.0)
194
+ rubocop-ast (>= 1.18.0, < 2.0)
193
195
  ruby-progressbar (~> 1.7)
194
196
  unicode-display_width (>= 1.4.0, < 3.0)
195
- rubocop-ast (1.16.0)
197
+ rubocop-ast (1.18.0)
196
198
  parser (>= 3.1.1.0)
197
- rubocop-rails (2.14.2)
199
+ rubocop-rails (2.15.1)
198
200
  activesupport (>= 4.2.0)
199
201
  rack (>= 1.1)
200
202
  rubocop (>= 1.7.0, < 2.0)
201
203
  rubocop-rake (0.6.0)
202
204
  rubocop (~> 1.0)
203
- rubocop-rspec (2.9.0)
205
+ rubocop-rspec (2.11.1)
204
206
  rubocop (~> 1.19)
205
207
  ruby-progressbar (1.11.0)
206
- strscan (3.0.1)
208
+ strscan (3.0.3)
207
209
  thor (1.2.1)
208
- timeout (0.2.0)
210
+ timeout (0.3.0)
209
211
  tzinfo (2.0.4)
210
212
  concurrent-ruby (~> 1.0)
211
- unicode-display_width (2.1.0)
213
+ unicode-display_width (2.2.0)
212
214
  webrick (1.7.0)
213
215
  websocket-driver (0.7.5)
214
216
  websocket-extensions (>= 0.1.0)
215
217
  websocket-extensions (0.1.5)
216
- yard (0.9.27)
218
+ yard (0.9.28)
217
219
  webrick (~> 1.7.0)
218
- zeitwerk (2.5.4)
220
+ zeitwerk (2.6.0)
219
221
 
220
222
  PLATFORMS
223
+ ruby
221
224
  x86_64-linux
222
225
 
223
226
  DEPENDENCIES
data/Makefile CHANGED
@@ -36,7 +36,7 @@ update:
36
36
 
37
37
  .PHONY: rubocop
38
38
  rubocop:
39
- export BUNDLE_GEMFILE=Gemfile && bundle --quiet && bundle exec rake rubocop:auto_correct
39
+ export BUNDLE_GEMFILE=Gemfile && bundle --quiet && bundle exec rake rubocop:autocorrect
40
40
 
41
41
  .PHONY: docs
42
42
  docs:
@@ -44,8 +44,8 @@ docs:
44
44
 
45
45
  .PHONY: texd-docker
46
46
  texd-docker:
47
+ rm -rvf tmp/jobs tmp/refs
47
48
  mkdir -p tmp/jobs tmp/refs
48
- rm -vf tmp/jobs/* tmp/refs/*
49
49
  docker run --rm \
50
50
  --name texd-dev \
51
51
  -p 127.0.0.1:2201:2201 \
data/README.md CHANGED
@@ -21,7 +21,7 @@ Install the gem and add to the application's Gemfile by executing:
21
21
 
22
22
  ## Configuration
23
23
 
24
- Befor you can use texd, you need to tell it where your instance is located.
24
+ Before you can use texd, you need to tell it where your instance is located.
25
25
 
26
26
  By default, this gem reads the `TEXD_ENDPOINT` environment variable and falls
27
27
  back to `http://localhost:2201/render`, should it be empty.
@@ -38,15 +38,18 @@ end
38
38
 
39
39
  ```rb
40
40
  Texd.configure do |config|
41
- config.endpoint = ENV.fetch("TEXD_ENDPOINT", "http://localhost:2201/")
42
- config.open_timeout = ENV.fetch("TEXD_OPEN_TIMEOUT", 60)
43
- config.read_timeout = ENV.fetch("TEXD_READ_TIMEOUT", 180)
44
- config.write_timeout = ENV.fetch("TEXD_WRITE_TIMEOUT", 60)
45
- config.error_format = ENV.fetch("TEXD_ERRORS", "full")
46
- config.tex_engine = ENV["TEXD_ENGINE"]
47
- config.tex_image = ENV["TEXD_IMAGE"]
48
- config.helpers = []
49
- config.lookup_paths = [] # Rails.root.join("app/tex") is always inserted as first entry
41
+ config.endpoint = ENV.fetch("TEXD_ENDPOINT", "http://localhost:2201/")
42
+ config.open_timeout = ENV.fetch("TEXD_OPEN_TIMEOUT", 60)
43
+ config.read_timeout = ENV.fetch("TEXD_READ_TIMEOUT", 180)
44
+ config.write_timeout = ENV.fetch("TEXD_WRITE_TIMEOUT", 60)
45
+ config.error_format = ENV.fetch("TEXD_ERRORS", "full")
46
+ config.error_handler = ENV.fetch("TEXD_ERROR_HANDLER", "raise")
47
+ config.tex_engine = ENV["TEXD_ENGINE"]
48
+ config.tex_image = ENV["TEXD_IMAGE"]
49
+ config.helpers = []
50
+ config.lookup_paths = []
51
+ config.lookup_paths = [] # Rails.root.join("app/tex") is always prepended
52
+ config.ref_cache_size = 128
50
53
  end
51
54
  ```
52
55
 
@@ -174,6 +177,31 @@ All errors inherit from `Texd::Client::RenderError` and should have
174
177
  a `details` attribute (a Hash) containing the actual error returned
175
178
  from the server.
176
179
 
180
+ ## Global error reporting
181
+
182
+ texd can be configured with external error reporting, like Sentry.
183
+
184
+ This example sends the LaTeX compilation log and compiled main input `.tex`
185
+ file to Sentry:
186
+
187
+ ```ruby
188
+ Texd.configure do |config|
189
+ config.error_handler = ->(err, doc) {
190
+ Sentry.set_context "texd", {
191
+ details: err.details, # if config.error_format == "json"
192
+ logs: err.logs, # otherwise
193
+ }.compact
194
+ Sentry.capture_exception(err)
195
+
196
+ raise err # re-raise, so that your code can decide further actions
197
+ }
198
+ end
199
+ ```
200
+
201
+ `config.error_handler` must respond to `call`, and receives the error (an instance
202
+ of `Texd::Client::CompilationError`) and the document context (an instance of
203
+ `Texd::Document::Compilation`).
204
+
177
205
  ## Development
178
206
 
179
207
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
+ Bundler.require(:development)
4
5
 
5
6
  require "rspec/core/rake_task"
6
7
  RSpec::Core::RakeTask.new(:spec)
@@ -12,5 +13,5 @@ begin
12
13
  task default: %i[spec rubocop]
13
14
  rescue LoadError
14
15
  # we're likely running `make test`
15
- task default: :spec
16
+ task default: :spec # rubocop:disable Rake/DuplicateTask
16
17
  end