paperback 0.0.3 → 0.0.5

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.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/tests.yml +46 -0
  3. data/.rubocop-disables.yml +26 -12
  4. data/CHANGELOG.md +21 -0
  5. data/README.md +27 -6
  6. data/bin/paperback +4 -0
  7. data/lib/paperback/cli.rb +38 -2
  8. data/lib/paperback/document.rb +134 -17
  9. data/lib/paperback/preparer.rb +107 -29
  10. data/lib/paperback/version.rb +2 -1
  11. data/lib/paperback.rb +12 -0
  12. data/paperback.gemspec +10 -7
  13. data/sorbet/config +3 -0
  14. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  15. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  16. data/sorbet/rbi/gems/chunky_png@1.4.0.rbi +4498 -0
  17. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  18. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
  19. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  20. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  21. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  22. data/sorbet/rbi/gems/parser@3.2.0.0.rbi +6963 -0
  23. data/sorbet/rbi/gems/pdf-core@0.4.0.rbi +1682 -0
  24. data/sorbet/rbi/gems/prawn@1.3.0.rbi +5567 -0
  25. data/sorbet/rbi/gems/pry@0.14.1.rbi +9990 -0
  26. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +408 -0
  27. data/sorbet/rbi/gems/rake@13.0.6.rbi +3023 -0
  28. data/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
  29. data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +3481 -0
  30. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4717 -0
  31. data/sorbet/rbi/gems/rqrcode@0.10.1.rbi +617 -0
  32. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10791 -0
  33. data/sorbet/rbi/gems/rspec-expectations@3.12.1.rbi +8106 -0
  34. data/sorbet/rbi/gems/rspec-mocks@3.12.1.rbi +5305 -0
  35. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
  36. data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
  37. data/sorbet/rbi/gems/rubocop-ast@1.24.1.rbi +6617 -0
  38. data/sorbet/rbi/gems/rubocop@0.93.1.rbi +40848 -0
  39. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1234 -0
  40. data/sorbet/rbi/gems/sixword@0.4.0.rbi +536 -0
  41. data/sorbet/rbi/gems/spoom@1.1.15.rbi +2383 -0
  42. data/sorbet/rbi/gems/subprocess@1.5.6.rbi +391 -0
  43. data/sorbet/rbi/gems/tapioca@0.10.5.rbi +3207 -0
  44. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  45. data/sorbet/rbi/gems/ttfunk@1.4.0.rbi +1951 -0
  46. data/sorbet/rbi/gems/unicode-display_width@1.8.0.rbi +40 -0
  47. data/sorbet/rbi/gems/unparser@0.6.7.rbi +4524 -0
  48. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2555 -0
  49. data/sorbet/rbi/gems/yard-sorbet@0.8.0.rbi +441 -0
  50. data/sorbet/rbi/gems/yard@0.9.28.rbi +17816 -0
  51. data/sorbet/tapioca/config.yml +13 -0
  52. data/sorbet/tapioca/require.rb +4 -0
  53. data/spec/functional/paperback/cli_spec.rb +195 -0
  54. data/spec/spec_helper.rb +1 -0
  55. data/spec/unit/paperback_spec.rb +1 -0
  56. metadata +91 -7
@@ -0,0 +1,391 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `subprocess` gem.
5
+ # Please instead update this file by running `bin/tapioca gem subprocess`.
6
+
7
+ # typed: strong
8
+
9
+ # A Ruby clone of Python's subprocess module.
10
+ #
11
+ # @see http://docs.python.org/2/library/subprocess.html
12
+ #
13
+ # source://subprocess//lib/subprocess/version.rb#1
14
+ # THIS FILE IS AUTOGENERATED. DO NOT EDIT.
15
+ # To regenerate from YARD comments:
16
+ # bundle exec rake sord
17
+ module Subprocess
18
+ class << self
19
+ # Call and wait for the return of a given process.
20
+ #
21
+ # @note If you call this function with `:stdout => PIPE` or `:stderr => PIPE`,
22
+ # this function will block indefinitely as soon as the OS's pipe buffer
23
+ # fills up, as neither file descriptor will be read from. To avoid this, use
24
+ # {Process#communicate} from a passed block.
25
+ # @param cmd [Array<String>] See {Process#initialize}
26
+ # @param opts [Hash] See {Process#initialize}
27
+ # @return [::Process::Status] The exit status of the process
28
+ # @see Process#initialize
29
+ # @yield [process] See {Process#initialize}
30
+ # @yieldparam process [Process] See {Process#initialize}
31
+ #
32
+ # source://subprocess//lib/subprocess.rb#45
33
+ def call(cmd, opts = T.unsafe(nil), &blk); end
34
+
35
+ # Like {Subprocess::call}, except raise a {NonZeroExit} if the process did not
36
+ # terminate successfully.
37
+ #
38
+ # @example Grep a file for a string
39
+ # Subprocess.check_call(%W{grep -q llama ~/favorite_animals})
40
+ # @example Communicate with a child process
41
+ # Subprocess.check_call(%W{sendmail -t}, :stdin => Subprocess::PIPE) do |p|
42
+ # p.communicate <<-EMAIL
43
+ # From: alpaca@example.com
44
+ # To: llama@example.com
45
+ # Subject: I am so fluffy.
46
+ #
47
+ # SO FLUFFY!
48
+ # http://upload.wikimedia.org/wikipedia/commons/3/3e/Unshorn_alpaca_grazing.jpg
49
+ # EMAIL
50
+ # end
51
+ # @note If you call this function with `:stdout => PIPE` or `:stderr => PIPE`,
52
+ # this function will block indefinitely as soon as the OS's pipe buffer
53
+ # fills up, as neither file descriptor will be read from. To avoid this, use
54
+ # {Process#communicate} from a passed block.
55
+ # @param cmd [Array<String>] See {Process#initialize}
56
+ # @param opts [Hash] See {Process#initialize}
57
+ # @raise [NonZeroExit] if the process returned a non-zero exit status (i.e.,
58
+ # was terminated with an error or was killed by a signal)
59
+ # @return [::Process::Status] The exit status of the process
60
+ # @see Process#initialize
61
+ # @yield [process] See {Process#initialize}
62
+ # @yieldparam process [Process] See {Process#initialize}
63
+ #
64
+ # source://subprocess//lib/subprocess.rb#82
65
+ def check_call(cmd, opts = T.unsafe(nil), &blk); end
66
+
67
+ # Like {Subprocess::check_call}, but return the contents of `stdout`, much
68
+ # like {::Kernel#system}.
69
+ #
70
+ # @example Get the system load
71
+ # system_load = Subprocess.check_output(['uptime']).split(' ').last(3)
72
+ # @param cmd [Array<String>] See {Process#initialize}
73
+ # @param opts [Hash] See {Process#initialize}
74
+ # @raise [NonZeroExit] if the process returned a non-zero exit status (i.e.,
75
+ # was terminated with an error or was killed by a signal)
76
+ # @return [String] The contents of `stdout`
77
+ # @see Process#initialize
78
+ # @yield [process] See {Process#initialize}
79
+ # @yieldparam process [Process] See {Process#initialize}
80
+ #
81
+ # source://subprocess//lib/subprocess.rb#104
82
+ def check_output(cmd, opts = T.unsafe(nil), &blk); end
83
+
84
+ # An alias for `Process.new`. Mostly here to better emulate the Python API.
85
+ #
86
+ # @param cmd [Array<String>] See {Process#initialize}
87
+ # @param opts [Hash] See {Process#initialize}
88
+ # @return [Process] A process with the given arguments
89
+ # @see Process#initialize
90
+ # @yield [process] See {Process#initialize}
91
+ # @yieldparam process [Process] See {Process#initialize}
92
+ #
93
+ # source://subprocess//lib/subprocess.rb#26
94
+ def popen(cmd, opts = T.unsafe(nil), &blk); end
95
+
96
+ # Print a human readable interpretation of a process exit status.
97
+ #
98
+ # @param status [::Process::Status] The status returned by `waitpid2`.
99
+ # @param convert_high_exit [Boolean] Whether to convert exit statuses greater
100
+ # than 128 into the usual convention for exiting after trapping a signal.
101
+ # (e.g. many programs will exit with status 130 after receiving a SIGINT /
102
+ # signal 2.)
103
+ # @return [String] Text interpretation
104
+ #
105
+ # source://subprocess//lib/subprocess.rb#121
106
+ def status_to_s(status, convert_high_exit = T.unsafe(nil)); end
107
+ end
108
+ end
109
+
110
+ # Error class representing a timeout during a call to `communicate`
111
+ #
112
+ # source://subprocess//lib/subprocess.rb#188
113
+ class Subprocess::CommunicateTimeout < ::StandardError
114
+ # @param cmd [Array<String>]
115
+ # @param stdout [String]
116
+ # @param stderr [String]
117
+ # @return [CommunicateTimeout] a new instance of CommunicateTimeout
118
+ #
119
+ # source://subprocess//lib/subprocess.rb#197
120
+ def initialize(cmd, stdout, stderr); end
121
+
122
+ # @return [String] Content read from stderr before the timeout
123
+ #
124
+ # source://subprocess//lib/subprocess.rb#192
125
+ def stderr; end
126
+
127
+ # @return [String] Content read from stdout before the timeout
128
+ #
129
+ # source://subprocess//lib/subprocess.rb#189
130
+ def stdout; end
131
+ end
132
+
133
+ # Error class representing a process's abnormal exit.
134
+ #
135
+ # source://subprocess//lib/subprocess.rb#160
136
+ class Subprocess::NonZeroExit < ::StandardError
137
+ # Return an instance of {NonZeroExit}.
138
+ #
139
+ # @param cmd [Array<String>] The command that returned a non-zero status.
140
+ # @param status [::Process::Status] The status returned by `waitpid`.
141
+ # @return [NonZeroExit] a new instance of NonZeroExit
142
+ #
143
+ # source://subprocess//lib/subprocess.rb#170
144
+ def initialize(cmd, status); end
145
+
146
+ # @note This is intended only for use in user-facing error messages. In
147
+ # particular, no shell quoting of any sort is performed when
148
+ # constructing this string, meaning that blindly running it in a shell
149
+ # might have different semantics than the original command.
150
+ # @return [String] The command and arguments for the process that exited
151
+ # abnormally.
152
+ #
153
+ # source://subprocess//lib/subprocess.rb#161
154
+ def command; end
155
+
156
+ # @return [::Process::Status] The Ruby status object returned by `waitpid`
157
+ #
158
+ # source://subprocess//lib/subprocess.rb#164
159
+ def status; end
160
+ end
161
+
162
+ # An opaque constant that indicates that a pipe should be opened.
163
+ #
164
+ # source://subprocess//lib/subprocess.rb#12
165
+ Subprocess::PIPE = T.let(T.unsafe(nil), Integer)
166
+
167
+ # A child process. The preferred way of spawning a subprocess is through the
168
+ # functions on {Subprocess} (especially {Subprocess::check_call} and
169
+ # {Subprocess::check_output}).
170
+ #
171
+ # source://subprocess//lib/subprocess.rb#208
172
+ # A child process. The preferred way of spawning a subprocess is through the
173
+ # functions on {Subprocess} (especially {Subprocess::check_call} and
174
+ class Subprocess::Process
175
+ # Create a new process.
176
+ #
177
+ # @option opts
178
+ # @option opts
179
+ # @option opts
180
+ # @option opts
181
+ # @option opts
182
+ # @option opts
183
+ # @option opts
184
+ # @option opts
185
+ # @param cmd [Array<String>] The command to run and its arguments (in the
186
+ # style of an `argv` array). Unlike Python's subprocess module, `cmd`
187
+ # cannot be a String.
188
+ # @param opts [Hash] a customizable set of options
189
+ # @raise [ArgumentError]
190
+ # @return [Process] a new instance of Process
191
+ # @yield [process] Yields the just-spawned {Process} to the optional block.
192
+ # This occurs after all of {Process}'s error handling has been completed,
193
+ # and is a great place to call {Process#communicate}, especially when used
194
+ # in conjunction with {Subprocess::check_call}.
195
+ # @yieldparam process [Process] The process that was just spawned.
196
+ #
197
+ # source://subprocess//lib/subprocess.rb#268
198
+ def initialize(cmd, opts = T.unsafe(nil), &blk); end
199
+
200
+ # @return [Array<String>] The command this process was invoked with.
201
+ #
202
+ # source://subprocess//lib/subprocess.rb#219
203
+ def command; end
204
+
205
+ # Write the (optional) input to the process's `stdin` and read the contents of
206
+ # `stdout` and `stderr`. If a block is provided, stdout and stderr are yielded as they
207
+ # are read. Otherwise they are buffered in memory and returned when the process
208
+ # exits. Do this all using `IO::select`, so we don't deadlock due to full pipe
209
+ # buffers.
210
+ #
211
+ # This is only really useful if you set some of `:stdin`, `:stdout`, and
212
+ # `:stderr` to {Subprocess::PIPE}.
213
+ #
214
+ # @param input [String] A string to feed to the child's standard input.
215
+ # @param timeout_s [Numeric] Raise {Subprocess::CommunicateTimeout} if communicate
216
+ # does not finish after timeout_s seconds.
217
+ # @raise [ArgumentError]
218
+ # @return [Array(String, String), nil] An array of two elements: the data read from the
219
+ # child's standard output and standard error, respectively.
220
+ # Returns nil if a block is provided.
221
+ # @yieldparam stdout [String] Data read from stdout since the last yield
222
+ # @yieldparam stderr [String] Data read from stderr since the last yield
223
+ #
224
+ # source://subprocess//lib/subprocess.rb#428
225
+ def communicate(input = T.unsafe(nil), timeout_s = T.unsafe(nil)); end
226
+
227
+ # Do nonblocking reads from `fd`, appending all data read into `buf`.
228
+ #
229
+ # @param fd [IO] The file to read from.
230
+ # @param buf [String] A buffer to append the read data to.
231
+ # @return [true, false] Whether `fd` was closed due to an exceptional
232
+ # condition (`EOFError` or `EPIPE`).
233
+ #
234
+ # source://subprocess//lib/subprocess.rb#398
235
+ def drain_fd(fd, buf = T.unsafe(nil)); end
236
+
237
+ # @return [Integer] The process ID of the spawned process.
238
+ #
239
+ # source://subprocess//lib/subprocess.rb#222
240
+ def pid; end
241
+
242
+ # Poll the child, setting (and returning) its status. If the child has not
243
+ # terminated, return nil and exit immediately
244
+ #
245
+ # @return [::Process::Status, nil] The exit status of the process
246
+ #
247
+ # source://subprocess//lib/subprocess.rb#379
248
+ # Poll the child, setting (and returning) its status. If the child has not
249
+ # _@return_ — The exit status of the process
250
+ sig { returns(T.nilable(::Process::Status)) }
251
+ def poll; end
252
+
253
+ # Does exactly what it says on the box.
254
+ #
255
+ # @param signal [String, Symbol, Integer] The signal to send to the child
256
+ # process. Accepts all the same arguments as Ruby's built-in
257
+ # {::Process::kill}, for instance a string like "INT" or "SIGINT", or a
258
+ # signal number like 2.
259
+ # @return [Integer] See {::Process.kill}
260
+ # @see ::Process.kill
261
+ #
262
+ # source://subprocess//lib/subprocess.rb#535
263
+ def send_signal(signal); end
264
+
265
+ # @return [::Process::Status, nil] The exit status code of the process.
266
+ # Only set after the process has exited.
267
+ #
268
+ # source://subprocess//lib/subprocess.rb#226
269
+ def status; end
270
+
271
+ # @return [IO] The `IO` that is connected to this process's `stderr`.
272
+ #
273
+ # source://subprocess//lib/subprocess.rb#216
274
+ def stderr; end
275
+
276
+ # @return [IO] The `IO` that is connected to this process's `stdin`.
277
+ #
278
+ # source://subprocess//lib/subprocess.rb#210
279
+ def stdin; end
280
+
281
+ # @return [IO] The `IO` that is connected to this process's `stdout`.
282
+ #
283
+ # source://subprocess//lib/subprocess.rb#213
284
+ def stdout; end
285
+
286
+ # Sends `SIGTERM` to the process.
287
+ #
288
+ # @return [Integer] See {send_signal}
289
+ # @see send_signal
290
+ #
291
+ # source://subprocess//lib/subprocess.rb#544
292
+ # _@return_ — See {send_signal}
293
+ # _@see_ `send_signal`
294
+ sig { returns(Integer) }
295
+ def terminate; end
296
+
297
+ # Wait for the child to return, setting and returning the status of the
298
+ # child.
299
+ #
300
+ # @return [::Process::Status] The exit status of the process
301
+ #
302
+ # source://subprocess//lib/subprocess.rb#387
303
+ # Wait for the child to return, setting and returning the status of the
304
+ # _@return_ — The exit status of the process
305
+ sig { returns(::Process::Status) }
306
+ def wait; end
307
+
308
+ private
309
+
310
+ # The pair to parse_fd, returns whether or not the file descriptor was
311
+ # opened by us (and therefore should be closed by us).
312
+ #
313
+ # @param fd [IO, Integer, String, nil]
314
+ # @return [Boolean]
315
+ #
316
+ # source://subprocess//lib/subprocess.rb#581
317
+ def our_fd?(fd); end
318
+
319
+ # Return a pair of values (child, mine), which are how the given file
320
+ # descriptor should appear to the child and to this process, respectively.
321
+ # "mine" is only non-nil in the case of a pipe (in fact, we just return a
322
+ # list of length one, since ruby will unpack nils from missing list items).
323
+ #
324
+ # @param fd [IO, Integer, String, nil]
325
+ # @param mode [String]
326
+ # @return [Array<IO>]
327
+ #
328
+ # source://subprocess//lib/subprocess.rb#557
329
+ def parse_fd(fd, mode); end
330
+
331
+ # Call IO.select timing out at Time `timeout_at`. If `timeout_at` is nil, never times out.
332
+ #
333
+ # @param read_array [Array<IO>, nil]
334
+ # @param write_array [Array<IO>, nil]
335
+ # @param err_array [Array<IO>, nil]
336
+ # @param timeout_at [Integer, Float, nil]
337
+ # @return [Array<Array<IO>>, nil]
338
+ #
339
+ # source://subprocess//lib/subprocess.rb#597
340
+ def select_until(read_array, write_array, err_array, timeout_at); end
341
+
342
+ class << self
343
+ # @param pid [Integer]
344
+ # @return [void]
345
+ #
346
+ # source://subprocess//lib/subprocess.rb#687
347
+ def catching_sigchld(pid); end
348
+
349
+ # @return [void]
350
+ #
351
+ # source://subprocess//lib/subprocess.rb#616
352
+ sig { void }
353
+ def handle_sigchld; end
354
+
355
+ # @param pid [Integer]
356
+ # @param fd [IO]
357
+ # @return [void]
358
+ #
359
+ # source://subprocess//lib/subprocess.rb#657
360
+ def register_pid(pid, fd); end
361
+
362
+ # @param pid [Integer]
363
+ # @return [void]
364
+ #
365
+ # source://subprocess//lib/subprocess.rb#676
366
+ def unregister_pid(pid); end
367
+
368
+ # Wake up everyone. We can't tell who we should wake up without `wait`ing,
369
+ # and we want to let the process itself do that. In practice, we're not
370
+ # likely to have that many in-flight subprocesses, so this is probably not a
371
+ # big deal.
372
+ #
373
+ # @return [void]
374
+ #
375
+ # source://subprocess//lib/subprocess.rb#639
376
+ # Wake up everyone. We can't tell who we should wake up without `wait`ing,
377
+ # and we want to let the process itself do that. In practice, we're not
378
+ # likely to have that many in-flight subprocesses, so this is probably not a
379
+ sig { void }
380
+ def wakeup_sigchld; end
381
+ end
382
+ end
383
+
384
+ # An opaque constant that can be passed to the `:stderr` option that indicates
385
+ # that the standard error stream should be redirected to the standard output.
386
+ #
387
+ # source://subprocess//lib/subprocess.rb#15
388
+ Subprocess::STDOUT = T.let(T.unsafe(nil), Integer)
389
+
390
+ # source://subprocess//lib/subprocess/version.rb#2
391
+ Subprocess::VERSION = T.let(T.unsafe(nil), String)