texd 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fde0921bb4b213505d16db41af06475dfb4915c0b1283e4e0ef74c956715bab5
4
- data.tar.gz: 6bc1878f34088d9ad32a8ac9a9c81819f20293153ed11148b2da8d190e9a4afc
3
+ metadata.gz: 7b96f50cf6e5741a667f9f0bdb41d6e781c50a6d1a67b4637f1c4e1e12a45176
4
+ data.tar.gz: 15028be97e8a7e86025998dc54cb8e502976dd3752bc88f68b55dac32309e4ed
5
5
  SHA512:
6
- metadata.gz: 3c6d63be3ffe9e11e9c0b98bc3466f07427014057291c8df551aa1ed49c3b5f4cf9e9e0583c96254fd7288193199598db6aabc17f92545e2de38f36004cbf6e0
7
- data.tar.gz: 919b674fd137f097d241170a54ae2746b150a76edd52aa373974234336d6884f3bd8e2820834d58a11f6f0131f6d63fc07b43f76faf971a182604a044cde7f10
6
+ metadata.gz: d5a1f0f363874f090a28ced8d90a13ebcab331b3410833304ea0f5273143668b8e89e227a94045547badf0fcdf6dd7690f565272501e72b0b13764c8e673c530
7
+ data.tar.gz: 513fc1c93cbcab5941eda498453f23914149314709b8d67738470a43f6c4fbc65cf0c636ab2148f8872155b2562e6df4f79f9c29a09b7052e92ca61f1fb3c0b9
data/.rubocop.yml CHANGED
@@ -329,3 +329,18 @@ Style/TrailingCommaInArrayLiteral:
329
329
  Style/TrailingCommaInHashLiteral:
330
330
  EnforcedStyleForMultiline: comma
331
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,10 +1,26 @@
1
1
  ## Unreleased
2
2
 
3
- [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.0...master)
3
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.5.0...master)
4
4
 
5
- ## v0.4.0
5
+ ## v0.5.0 - 2022-07-22
6
6
 
7
- [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.0)
7
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.2...v0.5.0)
8
+
9
+ **Changes**
10
+
11
+ - add support for inline files: `<%= texd_inline "contents\n", "filename.txt" %>`
12
+
13
+ ## v0.4.2 - 2022-06-16
14
+
15
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.4.1...v0.4.2)
16
+
17
+ **Changes**
18
+
19
+ - fix deprecation warning ("constant ::UploadIO is deprecated")
20
+
21
+ ## v0.4.1 - 2022-06-16
22
+
23
+ [Compare changes](https://github.com/digineo/texd-ruby/compare/v0.3.2...v0.4.1)
8
24
 
9
25
  **Changes**
10
26
 
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.5.0)
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.3)
12
- actionpack (= 7.0.3)
13
- activesupport (= 7.0.3)
11
+ actioncable (7.0.3.1)
12
+ actionpack (= 7.0.3.1)
13
+ activesupport (= 7.0.3.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
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)
16
+ actionmailbox (7.0.3.1)
17
+ actionpack (= 7.0.3.1)
18
+ activejob (= 7.0.3.1)
19
+ activerecord (= 7.0.3.1)
20
+ activestorage (= 7.0.3.1)
21
+ activesupport (= 7.0.3.1)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
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)
26
+ actionmailer (7.0.3.1)
27
+ actionpack (= 7.0.3.1)
28
+ actionview (= 7.0.3.1)
29
+ activejob (= 7.0.3.1)
30
+ activesupport (= 7.0.3.1)
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.3)
37
- actionview (= 7.0.3)
38
- activesupport (= 7.0.3)
36
+ actionpack (7.0.3.1)
37
+ actionview (= 7.0.3.1)
38
+ activesupport (= 7.0.3.1)
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.3)
44
- actionpack (= 7.0.3)
45
- activerecord (= 7.0.3)
46
- activestorage (= 7.0.3)
47
- activesupport (= 7.0.3)
43
+ actiontext (7.0.3.1)
44
+ actionpack (= 7.0.3.1)
45
+ activerecord (= 7.0.3.1)
46
+ activestorage (= 7.0.3.1)
47
+ activesupport (= 7.0.3.1)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.3)
51
- activesupport (= 7.0.3)
50
+ actionview (7.0.3.1)
51
+ activesupport (= 7.0.3.1)
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.3)
57
- activesupport (= 7.0.3)
56
+ activejob (7.0.3.1)
57
+ activesupport (= 7.0.3.1)
58
58
  globalid (>= 0.3.6)
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)
59
+ activemodel (7.0.3.1)
60
+ activesupport (= 7.0.3.1)
61
+ activerecord (7.0.3.1)
62
+ activemodel (= 7.0.3.1)
63
+ activesupport (= 7.0.3.1)
64
+ activestorage (7.0.3.1)
65
+ actionpack (= 7.0.3.1)
66
+ activejob (= 7.0.3.1)
67
+ activerecord (= 7.0.3.1)
68
+ activesupport (= 7.0.3.1)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.3)
71
+ activesupport (7.0.3.1)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -88,8 +88,9 @@ GEM
88
88
  erubi (1.10.0)
89
89
  globalid (1.0.0)
90
90
  activesupport (>= 5.0)
91
- i18n (1.10.0)
91
+ i18n (1.12.0)
92
92
  concurrent-ruby (~> 1.0)
93
+ json (2.6.2)
93
94
  loofah (2.18.0)
94
95
  crass (~> 1.0.2)
95
96
  nokogiri (>= 1.5.9)
@@ -99,7 +100,7 @@ GEM
99
100
  method_source (1.0.0)
100
101
  mini_mime (1.1.2)
101
102
  mini_portile2 (2.8.0)
102
- minitest (5.16.0)
103
+ minitest (5.16.2)
103
104
  multipart-post (2.2.3)
104
105
  net-imap (0.2.3)
105
106
  digest
@@ -116,10 +117,10 @@ GEM
116
117
  net-protocol
117
118
  timeout
118
119
  nio4r (2.5.8)
119
- nokogiri (1.13.6)
120
+ nokogiri (1.13.7)
120
121
  mini_portile2 (~> 2.8.0)
121
122
  racc (~> 1.4)
122
- nokogiri (1.13.6-x86_64-linux)
123
+ nokogiri (1.13.7-x86_64-linux)
123
124
  racc (~> 1.4)
124
125
  parallel (1.22.1)
125
126
  parser (3.1.2.0)
@@ -131,31 +132,31 @@ GEM
131
132
  byebug (~> 11.0)
132
133
  pry (~> 0.13.0)
133
134
  racc (1.6.0)
134
- rack (2.2.3.1)
135
- rack-test (1.1.0)
136
- rack (>= 1.0, < 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)
135
+ rack (2.2.4)
136
+ rack-test (2.0.2)
137
+ rack (>= 1.3)
138
+ rails (7.0.3.1)
139
+ actioncable (= 7.0.3.1)
140
+ actionmailbox (= 7.0.3.1)
141
+ actionmailer (= 7.0.3.1)
142
+ actionpack (= 7.0.3.1)
143
+ actiontext (= 7.0.3.1)
144
+ actionview (= 7.0.3.1)
145
+ activejob (= 7.0.3.1)
146
+ activemodel (= 7.0.3.1)
147
+ activerecord (= 7.0.3.1)
148
+ activestorage (= 7.0.3.1)
149
+ activesupport (= 7.0.3.1)
149
150
  bundler (>= 1.15.0)
150
- railties (= 7.0.3)
151
+ railties (= 7.0.3.1)
151
152
  rails-dom-testing (2.0.3)
152
153
  activesupport (>= 4.2.0)
153
154
  nokogiri (>= 1.6)
154
155
  rails-html-sanitizer (1.4.3)
155
156
  loofah (~> 2.3)
156
- railties (7.0.3)
157
- actionpack (= 7.0.3)
158
- activesupport (= 7.0.3)
157
+ railties (7.0.3.1)
158
+ actionpack (= 7.0.3.1)
159
+ activesupport (= 7.0.3.1)
159
160
  method_source
160
161
  rake (>= 12.2)
161
162
  thor (~> 1.0)
@@ -185,32 +186,33 @@ GEM
185
186
  rspec-mocks (~> 3.10)
186
187
  rspec-support (~> 3.10)
187
188
  rspec-support (3.11.0)
188
- rubocop (1.30.1)
189
+ rubocop (1.32.0)
190
+ json (~> 2.3)
189
191
  parallel (~> 1.10)
190
192
  parser (>= 3.1.0.0)
191
193
  rainbow (>= 2.2.2, < 4.0)
192
194
  regexp_parser (>= 1.8, < 3.0)
193
195
  rexml (>= 3.2.5, < 4.0)
194
- rubocop-ast (>= 1.18.0, < 2.0)
196
+ rubocop-ast (>= 1.19.1, < 2.0)
195
197
  ruby-progressbar (~> 1.7)
196
198
  unicode-display_width (>= 1.4.0, < 3.0)
197
- rubocop-ast (1.18.0)
199
+ rubocop-ast (1.19.1)
198
200
  parser (>= 3.1.1.0)
199
- rubocop-rails (2.15.0)
201
+ rubocop-rails (2.15.2)
200
202
  activesupport (>= 4.2.0)
201
203
  rack (>= 1.1)
202
204
  rubocop (>= 1.7.0, < 2.0)
203
205
  rubocop-rake (0.6.0)
204
206
  rubocop (~> 1.0)
205
- rubocop-rspec (2.11.1)
206
- rubocop (~> 1.19)
207
+ rubocop-rspec (2.12.1)
208
+ rubocop (~> 1.31)
207
209
  ruby-progressbar (1.11.0)
208
210
  strscan (3.0.3)
209
211
  thor (1.2.1)
210
212
  timeout (0.3.0)
211
- tzinfo (2.0.4)
213
+ tzinfo (2.0.5)
212
214
  concurrent-ruby (~> 1.0)
213
- unicode-display_width (2.1.0)
215
+ unicode-display_width (2.2.0)
214
216
  webrick (1.7.0)
215
217
  websocket-driver (0.7.5)
216
218
  websocket-extensions (>= 0.1.0)
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:
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
@@ -1,63 +1,63 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.5.0)
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 (6.0.5)
12
- actionpack (= 6.0.5)
11
+ actioncable (6.0.5.1)
12
+ actionpack (= 6.0.5.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
- actionmailbox (6.0.5)
16
- actionpack (= 6.0.5)
17
- activejob (= 6.0.5)
18
- activerecord (= 6.0.5)
19
- activestorage (= 6.0.5)
20
- activesupport (= 6.0.5)
15
+ actionmailbox (6.0.5.1)
16
+ actionpack (= 6.0.5.1)
17
+ activejob (= 6.0.5.1)
18
+ activerecord (= 6.0.5.1)
19
+ activestorage (= 6.0.5.1)
20
+ activesupport (= 6.0.5.1)
21
21
  mail (>= 2.7.1)
22
- actionmailer (6.0.5)
23
- actionpack (= 6.0.5)
24
- actionview (= 6.0.5)
25
- activejob (= 6.0.5)
22
+ actionmailer (6.0.5.1)
23
+ actionpack (= 6.0.5.1)
24
+ actionview (= 6.0.5.1)
25
+ activejob (= 6.0.5.1)
26
26
  mail (~> 2.5, >= 2.5.4)
27
27
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.5)
29
- actionview (= 6.0.5)
30
- activesupport (= 6.0.5)
28
+ actionpack (6.0.5.1)
29
+ actionview (= 6.0.5.1)
30
+ activesupport (= 6.0.5.1)
31
31
  rack (~> 2.0, >= 2.0.8)
32
32
  rack-test (>= 0.6.3)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
35
- actiontext (6.0.5)
36
- actionpack (= 6.0.5)
37
- activerecord (= 6.0.5)
38
- activestorage (= 6.0.5)
39
- activesupport (= 6.0.5)
35
+ actiontext (6.0.5.1)
36
+ actionpack (= 6.0.5.1)
37
+ activerecord (= 6.0.5.1)
38
+ activestorage (= 6.0.5.1)
39
+ activesupport (= 6.0.5.1)
40
40
  nokogiri (>= 1.8.5)
41
- actionview (6.0.5)
42
- activesupport (= 6.0.5)
41
+ actionview (6.0.5.1)
42
+ activesupport (= 6.0.5.1)
43
43
  builder (~> 3.1)
44
44
  erubi (~> 1.4)
45
45
  rails-dom-testing (~> 2.0)
46
46
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.5)
48
- activesupport (= 6.0.5)
47
+ activejob (6.0.5.1)
48
+ activesupport (= 6.0.5.1)
49
49
  globalid (>= 0.3.6)
50
- activemodel (6.0.5)
51
- activesupport (= 6.0.5)
52
- activerecord (6.0.5)
53
- activemodel (= 6.0.5)
54
- activesupport (= 6.0.5)
55
- activestorage (6.0.5)
56
- actionpack (= 6.0.5)
57
- activejob (= 6.0.5)
58
- activerecord (= 6.0.5)
50
+ activemodel (6.0.5.1)
51
+ activesupport (= 6.0.5.1)
52
+ activerecord (6.0.5.1)
53
+ activemodel (= 6.0.5.1)
54
+ activesupport (= 6.0.5.1)
55
+ activestorage (6.0.5.1)
56
+ actionpack (= 6.0.5.1)
57
+ activejob (= 6.0.5.1)
58
+ activerecord (= 6.0.5.1)
59
59
  marcel (~> 1.0)
60
- activesupport (6.0.5)
60
+ activesupport (6.0.5.1)
61
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
62
  i18n (>= 0.7, < 2)
63
63
  minitest (~> 5.1)
@@ -76,7 +76,7 @@ GEM
76
76
  erubi (1.10.0)
77
77
  globalid (1.0.0)
78
78
  activesupport (>= 5.0)
79
- i18n (1.10.0)
79
+ i18n (1.12.0)
80
80
  concurrent-ruby (~> 1.0)
81
81
  loofah (2.18.0)
82
82
  crass (~> 1.0.2)
@@ -87,13 +87,13 @@ GEM
87
87
  method_source (1.0.0)
88
88
  mini_mime (1.1.2)
89
89
  mini_portile2 (2.8.0)
90
- minitest (5.16.0)
90
+ minitest (5.16.2)
91
91
  multipart-post (2.2.3)
92
92
  nio4r (2.5.8)
93
- nokogiri (1.13.6)
93
+ nokogiri (1.13.7)
94
94
  mini_portile2 (~> 2.8.0)
95
95
  racc (~> 1.4)
96
- nokogiri (1.13.6-x86_64-linux)
96
+ nokogiri (1.13.7-x86_64-linux)
97
97
  racc (~> 1.4)
98
98
  pry (0.13.1)
99
99
  coderay (~> 1.1)
@@ -102,32 +102,32 @@ GEM
102
102
  byebug (~> 11.0)
103
103
  pry (~> 0.13.0)
104
104
  racc (1.6.0)
105
- rack (2.2.3.1)
106
- rack-test (1.1.0)
107
- rack (>= 1.0, < 3)
108
- rails (6.0.5)
109
- actioncable (= 6.0.5)
110
- actionmailbox (= 6.0.5)
111
- actionmailer (= 6.0.5)
112
- actionpack (= 6.0.5)
113
- actiontext (= 6.0.5)
114
- actionview (= 6.0.5)
115
- activejob (= 6.0.5)
116
- activemodel (= 6.0.5)
117
- activerecord (= 6.0.5)
118
- activestorage (= 6.0.5)
119
- activesupport (= 6.0.5)
105
+ rack (2.2.4)
106
+ rack-test (2.0.2)
107
+ rack (>= 1.3)
108
+ rails (6.0.5.1)
109
+ actioncable (= 6.0.5.1)
110
+ actionmailbox (= 6.0.5.1)
111
+ actionmailer (= 6.0.5.1)
112
+ actionpack (= 6.0.5.1)
113
+ actiontext (= 6.0.5.1)
114
+ actionview (= 6.0.5.1)
115
+ activejob (= 6.0.5.1)
116
+ activemodel (= 6.0.5.1)
117
+ activerecord (= 6.0.5.1)
118
+ activestorage (= 6.0.5.1)
119
+ activesupport (= 6.0.5.1)
120
120
  bundler (>= 1.3.0)
121
- railties (= 6.0.5)
121
+ railties (= 6.0.5.1)
122
122
  sprockets-rails (>= 2.0.0)
123
123
  rails-dom-testing (2.0.3)
124
124
  activesupport (>= 4.2.0)
125
125
  nokogiri (>= 1.6)
126
126
  rails-html-sanitizer (1.4.3)
127
127
  loofah (~> 2.3)
128
- railties (6.0.5)
129
- actionpack (= 6.0.5)
130
- activesupport (= 6.0.5)
128
+ railties (6.0.5.1)
129
+ actionpack (= 6.0.5.1)
130
+ activesupport (= 6.0.5.1)
131
131
  method_source
132
132
  rake (>= 0.8.7)
133
133
  thor (>= 0.20.3, < 2.0)
@@ -153,7 +153,7 @@ GEM
153
153
  rspec-mocks (~> 3.10)
154
154
  rspec-support (~> 3.10)
155
155
  rspec-support (3.11.0)
156
- sprockets (4.0.3)
156
+ sprockets (4.1.1)
157
157
  concurrent-ruby (~> 1.0)
158
158
  rack (> 1, < 3)
159
159
  sprockets-rails (3.4.2)
@@ -162,7 +162,7 @@ GEM
162
162
  sprockets (>= 3.0.0)
163
163
  thor (1.2.1)
164
164
  thread_safe (0.3.6)
165
- tzinfo (1.2.9)
165
+ tzinfo (1.2.10)
166
166
  thread_safe (~> 0.1)
167
167
  websocket-driver (0.7.5)
168
168
  websocket-extensions (>= 0.1.0)
@@ -1,67 +1,67 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.5.0)
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 (6.1.6)
12
- actionpack (= 6.1.6)
13
- activesupport (= 6.1.6)
11
+ actioncable (6.1.6.1)
12
+ actionpack (= 6.1.6.1)
13
+ activesupport (= 6.1.6.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.6)
17
- actionpack (= 6.1.6)
18
- activejob (= 6.1.6)
19
- activerecord (= 6.1.6)
20
- activestorage (= 6.1.6)
21
- activesupport (= 6.1.6)
16
+ actionmailbox (6.1.6.1)
17
+ actionpack (= 6.1.6.1)
18
+ activejob (= 6.1.6.1)
19
+ activerecord (= 6.1.6.1)
20
+ activestorage (= 6.1.6.1)
21
+ activesupport (= 6.1.6.1)
22
22
  mail (>= 2.7.1)
23
- actionmailer (6.1.6)
24
- actionpack (= 6.1.6)
25
- actionview (= 6.1.6)
26
- activejob (= 6.1.6)
27
- activesupport (= 6.1.6)
23
+ actionmailer (6.1.6.1)
24
+ actionpack (= 6.1.6.1)
25
+ actionview (= 6.1.6.1)
26
+ activejob (= 6.1.6.1)
27
+ activesupport (= 6.1.6.1)
28
28
  mail (~> 2.5, >= 2.5.4)
29
29
  rails-dom-testing (~> 2.0)
30
- actionpack (6.1.6)
31
- actionview (= 6.1.6)
32
- activesupport (= 6.1.6)
30
+ actionpack (6.1.6.1)
31
+ actionview (= 6.1.6.1)
32
+ activesupport (= 6.1.6.1)
33
33
  rack (~> 2.0, >= 2.0.9)
34
34
  rack-test (>= 0.6.3)
35
35
  rails-dom-testing (~> 2.0)
36
36
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.6)
38
- actionpack (= 6.1.6)
39
- activerecord (= 6.1.6)
40
- activestorage (= 6.1.6)
41
- activesupport (= 6.1.6)
37
+ actiontext (6.1.6.1)
38
+ actionpack (= 6.1.6.1)
39
+ activerecord (= 6.1.6.1)
40
+ activestorage (= 6.1.6.1)
41
+ activesupport (= 6.1.6.1)
42
42
  nokogiri (>= 1.8.5)
43
- actionview (6.1.6)
44
- activesupport (= 6.1.6)
43
+ actionview (6.1.6.1)
44
+ activesupport (= 6.1.6.1)
45
45
  builder (~> 3.1)
46
46
  erubi (~> 1.4)
47
47
  rails-dom-testing (~> 2.0)
48
48
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.6)
50
- activesupport (= 6.1.6)
49
+ activejob (6.1.6.1)
50
+ activesupport (= 6.1.6.1)
51
51
  globalid (>= 0.3.6)
52
- activemodel (6.1.6)
53
- activesupport (= 6.1.6)
54
- activerecord (6.1.6)
55
- activemodel (= 6.1.6)
56
- activesupport (= 6.1.6)
57
- activestorage (6.1.6)
58
- actionpack (= 6.1.6)
59
- activejob (= 6.1.6)
60
- activerecord (= 6.1.6)
61
- activesupport (= 6.1.6)
52
+ activemodel (6.1.6.1)
53
+ activesupport (= 6.1.6.1)
54
+ activerecord (6.1.6.1)
55
+ activemodel (= 6.1.6.1)
56
+ activesupport (= 6.1.6.1)
57
+ activestorage (6.1.6.1)
58
+ actionpack (= 6.1.6.1)
59
+ activejob (= 6.1.6.1)
60
+ activerecord (= 6.1.6.1)
61
+ activesupport (= 6.1.6.1)
62
62
  marcel (~> 1.0)
63
63
  mini_mime (>= 1.1.0)
64
- activesupport (6.1.6)
64
+ activesupport (6.1.6.1)
65
65
  concurrent-ruby (~> 1.0, >= 1.0.2)
66
66
  i18n (>= 1.6, < 2)
67
67
  minitest (>= 5.1)
@@ -80,7 +80,7 @@ GEM
80
80
  erubi (1.10.0)
81
81
  globalid (1.0.0)
82
82
  activesupport (>= 5.0)
83
- i18n (1.10.0)
83
+ i18n (1.12.0)
84
84
  concurrent-ruby (~> 1.0)
85
85
  loofah (2.18.0)
86
86
  crass (~> 1.0.2)
@@ -91,13 +91,13 @@ GEM
91
91
  method_source (1.0.0)
92
92
  mini_mime (1.1.2)
93
93
  mini_portile2 (2.8.0)
94
- minitest (5.16.0)
94
+ minitest (5.16.2)
95
95
  multipart-post (2.2.3)
96
96
  nio4r (2.5.8)
97
- nokogiri (1.13.6)
97
+ nokogiri (1.13.7)
98
98
  mini_portile2 (~> 2.8.0)
99
99
  racc (~> 1.4)
100
- nokogiri (1.13.6-x86_64-linux)
100
+ nokogiri (1.13.7-x86_64-linux)
101
101
  racc (~> 1.4)
102
102
  pry (0.13.1)
103
103
  coderay (~> 1.1)
@@ -106,32 +106,32 @@ GEM
106
106
  byebug (~> 11.0)
107
107
  pry (~> 0.13.0)
108
108
  racc (1.6.0)
109
- rack (2.2.3.1)
110
- rack-test (1.1.0)
111
- rack (>= 1.0, < 3)
112
- rails (6.1.6)
113
- actioncable (= 6.1.6)
114
- actionmailbox (= 6.1.6)
115
- actionmailer (= 6.1.6)
116
- actionpack (= 6.1.6)
117
- actiontext (= 6.1.6)
118
- actionview (= 6.1.6)
119
- activejob (= 6.1.6)
120
- activemodel (= 6.1.6)
121
- activerecord (= 6.1.6)
122
- activestorage (= 6.1.6)
123
- activesupport (= 6.1.6)
109
+ rack (2.2.4)
110
+ rack-test (2.0.2)
111
+ rack (>= 1.3)
112
+ rails (6.1.6.1)
113
+ actioncable (= 6.1.6.1)
114
+ actionmailbox (= 6.1.6.1)
115
+ actionmailer (= 6.1.6.1)
116
+ actionpack (= 6.1.6.1)
117
+ actiontext (= 6.1.6.1)
118
+ actionview (= 6.1.6.1)
119
+ activejob (= 6.1.6.1)
120
+ activemodel (= 6.1.6.1)
121
+ activerecord (= 6.1.6.1)
122
+ activestorage (= 6.1.6.1)
123
+ activesupport (= 6.1.6.1)
124
124
  bundler (>= 1.15.0)
125
- railties (= 6.1.6)
125
+ railties (= 6.1.6.1)
126
126
  sprockets-rails (>= 2.0.0)
127
127
  rails-dom-testing (2.0.3)
128
128
  activesupport (>= 4.2.0)
129
129
  nokogiri (>= 1.6)
130
130
  rails-html-sanitizer (1.4.3)
131
131
  loofah (~> 2.3)
132
- railties (6.1.6)
133
- actionpack (= 6.1.6)
134
- activesupport (= 6.1.6)
132
+ railties (6.1.6.1)
133
+ actionpack (= 6.1.6.1)
134
+ activesupport (= 6.1.6.1)
135
135
  method_source
136
136
  rake (>= 12.2)
137
137
  thor (~> 1.0)
@@ -157,7 +157,7 @@ GEM
157
157
  rspec-mocks (~> 3.10)
158
158
  rspec-support (~> 3.10)
159
159
  rspec-support (3.11.0)
160
- sprockets (4.0.3)
160
+ sprockets (4.1.1)
161
161
  concurrent-ruby (~> 1.0)
162
162
  rack (> 1, < 3)
163
163
  sprockets-rails (3.4.2)
@@ -165,7 +165,7 @@ GEM
165
165
  activesupport (>= 5.2)
166
166
  sprockets (>= 3.0.0)
167
167
  thor (1.2.1)
168
- tzinfo (2.0.4)
168
+ tzinfo (2.0.5)
169
169
  concurrent-ruby (~> 1.0)
170
170
  websocket-driver (0.7.5)
171
171
  websocket-extensions (>= 0.1.0)
@@ -1,74 +1,74 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- texd (0.4.0)
4
+ texd (0.5.0)
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.3)
12
- actionpack (= 7.0.3)
13
- activesupport (= 7.0.3)
11
+ actioncable (7.0.3.1)
12
+ actionpack (= 7.0.3.1)
13
+ activesupport (= 7.0.3.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
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)
16
+ actionmailbox (7.0.3.1)
17
+ actionpack (= 7.0.3.1)
18
+ activejob (= 7.0.3.1)
19
+ activerecord (= 7.0.3.1)
20
+ activestorage (= 7.0.3.1)
21
+ activesupport (= 7.0.3.1)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
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)
26
+ actionmailer (7.0.3.1)
27
+ actionpack (= 7.0.3.1)
28
+ actionview (= 7.0.3.1)
29
+ activejob (= 7.0.3.1)
30
+ activesupport (= 7.0.3.1)
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.3)
37
- actionview (= 7.0.3)
38
- activesupport (= 7.0.3)
36
+ actionpack (7.0.3.1)
37
+ actionview (= 7.0.3.1)
38
+ activesupport (= 7.0.3.1)
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.3)
44
- actionpack (= 7.0.3)
45
- activerecord (= 7.0.3)
46
- activestorage (= 7.0.3)
47
- activesupport (= 7.0.3)
43
+ actiontext (7.0.3.1)
44
+ actionpack (= 7.0.3.1)
45
+ activerecord (= 7.0.3.1)
46
+ activestorage (= 7.0.3.1)
47
+ activesupport (= 7.0.3.1)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.3)
51
- activesupport (= 7.0.3)
50
+ actionview (7.0.3.1)
51
+ activesupport (= 7.0.3.1)
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.3)
57
- activesupport (= 7.0.3)
56
+ activejob (7.0.3.1)
57
+ activesupport (= 7.0.3.1)
58
58
  globalid (>= 0.3.6)
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)
59
+ activemodel (7.0.3.1)
60
+ activesupport (= 7.0.3.1)
61
+ activerecord (7.0.3.1)
62
+ activemodel (= 7.0.3.1)
63
+ activesupport (= 7.0.3.1)
64
+ activestorage (7.0.3.1)
65
+ actionpack (= 7.0.3.1)
66
+ activejob (= 7.0.3.1)
67
+ activerecord (= 7.0.3.1)
68
+ activesupport (= 7.0.3.1)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.3)
71
+ activesupport (7.0.3.1)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
@@ -87,7 +87,7 @@ GEM
87
87
  erubi (1.10.0)
88
88
  globalid (1.0.0)
89
89
  activesupport (>= 5.0)
90
- i18n (1.10.0)
90
+ i18n (1.12.0)
91
91
  concurrent-ruby (~> 1.0)
92
92
  loofah (2.18.0)
93
93
  crass (~> 1.0.2)
@@ -98,7 +98,7 @@ GEM
98
98
  method_source (1.0.0)
99
99
  mini_mime (1.1.2)
100
100
  mini_portile2 (2.8.0)
101
- minitest (5.16.0)
101
+ minitest (5.16.2)
102
102
  multipart-post (2.2.3)
103
103
  net-imap (0.2.3)
104
104
  digest
@@ -115,10 +115,10 @@ GEM
115
115
  net-protocol
116
116
  timeout
117
117
  nio4r (2.5.8)
118
- nokogiri (1.13.6)
118
+ nokogiri (1.13.7)
119
119
  mini_portile2 (~> 2.8.0)
120
120
  racc (~> 1.4)
121
- nokogiri (1.13.6-x86_64-linux)
121
+ nokogiri (1.13.7-x86_64-linux)
122
122
  racc (~> 1.4)
123
123
  pry (0.13.1)
124
124
  coderay (~> 1.1)
@@ -127,31 +127,31 @@ GEM
127
127
  byebug (~> 11.0)
128
128
  pry (~> 0.13.0)
129
129
  racc (1.6.0)
130
- rack (2.2.3.1)
131
- rack-test (1.1.0)
132
- rack (>= 1.0, < 3)
133
- rails (7.0.3)
134
- actioncable (= 7.0.3)
135
- actionmailbox (= 7.0.3)
136
- actionmailer (= 7.0.3)
137
- actionpack (= 7.0.3)
138
- actiontext (= 7.0.3)
139
- actionview (= 7.0.3)
140
- activejob (= 7.0.3)
141
- activemodel (= 7.0.3)
142
- activerecord (= 7.0.3)
143
- activestorage (= 7.0.3)
144
- activesupport (= 7.0.3)
130
+ rack (2.2.4)
131
+ rack-test (2.0.2)
132
+ rack (>= 1.3)
133
+ rails (7.0.3.1)
134
+ actioncable (= 7.0.3.1)
135
+ actionmailbox (= 7.0.3.1)
136
+ actionmailer (= 7.0.3.1)
137
+ actionpack (= 7.0.3.1)
138
+ actiontext (= 7.0.3.1)
139
+ actionview (= 7.0.3.1)
140
+ activejob (= 7.0.3.1)
141
+ activemodel (= 7.0.3.1)
142
+ activerecord (= 7.0.3.1)
143
+ activestorage (= 7.0.3.1)
144
+ activesupport (= 7.0.3.1)
145
145
  bundler (>= 1.15.0)
146
- railties (= 7.0.3)
146
+ railties (= 7.0.3.1)
147
147
  rails-dom-testing (2.0.3)
148
148
  activesupport (>= 4.2.0)
149
149
  nokogiri (>= 1.6)
150
150
  rails-html-sanitizer (1.4.3)
151
151
  loofah (~> 2.3)
152
- railties (7.0.3)
153
- actionpack (= 7.0.3)
154
- activesupport (= 7.0.3)
152
+ railties (7.0.3.1)
153
+ actionpack (= 7.0.3.1)
154
+ activesupport (= 7.0.3.1)
155
155
  method_source
156
156
  rake (>= 12.2)
157
157
  thor (~> 1.0)
@@ -181,7 +181,7 @@ GEM
181
181
  strscan (3.0.3)
182
182
  thor (1.2.1)
183
183
  timeout (0.3.0)
184
- tzinfo (2.0.4)
184
+ tzinfo (2.0.5)
185
185
  concurrent-ruby (~> 1.0)
186
186
  websocket-driver (0.7.5)
187
187
  websocket-extensions (>= 0.1.0)
@@ -53,6 +53,33 @@ module Texd
53
53
  add(Attachment::File, path, rename)
54
54
  end
55
55
 
56
+ # Includes a file with the given `content` to the list. This is useful
57
+ # if you generate the content on-the-fly (like creating CSV data from
58
+ # database records), and don't want to save that content to disk first.
59
+ #
60
+ # In short, these examples should be mostly equivalent:
61
+ #
62
+ # # use a temporary file to write contents to, and attach that file:
63
+ # tmp = Tempfile.new ["foo", ".csv"]
64
+ # tmp.write @record.to_csv
65
+ # tmp.flush
66
+ # tmp.close
67
+ # text_attach tmp.name
68
+ #
69
+ # # skip writing to disk and inline the file:
70
+ # texd_inline @record.to_csv, "foo.csv"
71
+ #
72
+ # @param [<Type>] contents <description>
73
+ # @param [<Type>] path <description>
74
+ #
75
+ # @return [<Type>] <description>
76
+ def inline(contents, path)
77
+ att = Attachment::Dynamic.new(path, contents)
78
+
79
+ items[att.name] ||= att
80
+ items[att.name]
81
+ end
82
+
56
83
  # Adds a file reference with the given path to the list. Similar to #attach,
57
84
  # the file path must either be an absolute filename or be relative to
58
85
  # app/tex/ of the host application.
@@ -130,12 +157,33 @@ module Texd
130
157
  end
131
158
  end
132
159
 
160
+ # Computes the file name of a given path, and returns it with or without
161
+ # file extension.
162
+ #
163
+ # @param [String, Pathname] path A Pathname instance or just a plain file name.
164
+ # @param [Boolean] with_extension If true, returns the file path's basename
165
+ # unmodified, otherwise the file extension, including its ".", is removed.
166
+ # @return [String] File path with or without extension.
167
+ def self.name(path, with_extension = true) # rubocop:disable Style/OptionalBooleanParameter
168
+ basename = ::File.basename(path)
169
+ return basename if with_extension
170
+
171
+ dot = basename.rindex(".")
172
+ return basename if dot == 0 # file starts with "."
173
+
174
+ basename.slice(0, dot)
175
+ end
176
+
133
177
  Dynamic = Struct.new(:name, :contents) do
134
178
  def to_upload_io(**)
135
- UploadIO.new(StringIO.new(contents), nil, name).tap { |io|
179
+ Multipart::Post::UploadIO.new(StringIO.new(contents), nil, name).tap { |io|
136
180
  io.instance_variable_set :@original_filename, name
137
181
  }
138
182
  end
183
+
184
+ def name(with_extension = true) # rubocop:disable Style/OptionalBooleanParameter
185
+ Attachment.name(self[:name], with_extension)
186
+ end
139
187
  end
140
188
 
141
189
  class Base
@@ -164,20 +212,14 @@ module Texd
164
212
  # @param [Boolean] with_extension
165
213
  # @return [String] output file name
166
214
  def name(with_extension = true) # rubocop:disable Style/OptionalBooleanParameter
167
- basename = ::File.basename(@name)
168
- return basename if with_extension
169
-
170
- dot = basename.rindex(".")
171
- return basename if dot == 0 # file starts with "."
172
-
173
- basename.slice(0, dot)
215
+ Attachment.name(@name, with_extension)
174
216
  end
175
217
  end
176
218
 
177
219
  class File < Base
178
220
  # @api private
179
221
  def to_upload_io(**)
180
- UploadIO.new(absolute_path.open("rb"), nil, name).tap { |io|
222
+ Multipart::Post::UploadIO.new(absolute_path.open("rb"), nil, name).tap { |io|
181
223
  io.instance_variable_set :@original_filename, name
182
224
  }
183
225
  end
@@ -197,7 +239,7 @@ module Texd
197
239
  f = full ? absolute_path.open("rb") : StringIO.new(checksum)
198
240
  ct = full ? STORE_REF : USE_REF
199
241
 
200
- UploadIO.new(f, ct, name).tap { |io|
242
+ Multipart::Post::UploadIO.new(f, ct, name).tap { |io|
201
243
  io.instance_variable_set :@original_filename, name
202
244
  }
203
245
  end
data/lib/texd/config.rb CHANGED
@@ -82,7 +82,7 @@ module Texd
82
82
  #
83
83
  # Supported values are described in ERROR_FORMATS.
84
84
  #
85
- # The default is "full" and can be overriden by the `TEXD_WRITE_TIMEOUT`
85
+ # The default is "full" and can be overriden by the `TEXD_ERRORS`
86
86
  # environment variable.
87
87
  attr_reader :error_format
88
88
 
@@ -146,8 +146,8 @@ module Texd
146
146
  end
147
147
 
148
148
  def to_h
149
- DEFAULT_CONFIGURATION.keys.each_with_object({}) do |key, hash|
150
- hash[key] = public_send(key)
149
+ DEFAULT_CONFIGURATION.keys.index_with do |key|
150
+ public_send(key)
151
151
  end
152
152
  end
153
153
 
data/lib/texd/document.rb CHANGED
@@ -40,6 +40,12 @@ module Texd
40
40
  def to_upload_ios(missing_refs: Set.new)
41
41
  attachments.to_upload_ios(missing_refs)
42
42
  end
43
+
44
+ # Convenience accessor for the main input file.
45
+ # @returns [String] main input file contents
46
+ def main_input_contents
47
+ attachments.items.fetch(main_input_name).contents
48
+ end
43
49
  end
44
50
  end
45
51
  end
data/lib/texd/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Texd
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/texd.rb CHANGED
@@ -80,6 +80,10 @@ module Texd
80
80
  attachments.attach(path, rename).name(with_extension)
81
81
  end
82
82
 
83
+ define_method :texd_inline do |data, name, with_extension: true|
84
+ attachments.inline(data, name).name(with_extension)
85
+ end
86
+
83
87
  define_method :texd_reference do |path, rename: true, with_extension: true|
84
88
  attachments.reference(path, rename).name(with_extension)
85
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Menke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multipart-post
@@ -141,7 +141,7 @@ metadata:
141
141
  rubygems_mfa_required: 'true'
142
142
  homepage_uri: https://github.com/digineo/texd-ruby
143
143
  source_code_uri: https://github.com/digineo/texd-ruby
144
- changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.4.0/CHANGELOG.md
144
+ changelog_uri: https://github.com/digineo/texd-ruby/blob/v0.5.0/CHANGELOG.md
145
145
  post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths: