mupdf 0.1.0 → 0.2.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: ad445c502c69e3143bf400a94e9c3e1935dce191e58f7585aa8fdd164ac8e744
4
- data.tar.gz: 84f2f037ab19c276d719bcc85b9dbc13dba28c4107e11b71702e55b31af3f788
3
+ metadata.gz: fcb2e83601972892c61f01d0a91ad66f53c1d1a1df766c45c469c19eb00de40f
4
+ data.tar.gz: aad84a0df2ba34f3b30d6a9d8972ac8d82ecdc676178921e14cd08056c16b462
5
5
  SHA512:
6
- metadata.gz: d5d322ac79969df1cbb4a454a9d0df8298a632727caf82b4b4d93515f650b53162e3031bfd0be30dbd93dd97e1b50ed15cf844f360c216916af6d7245456db7f
7
- data.tar.gz: 043c241a4c8cac55ac0597ccc46a9fb940bc8b62f5461d6fd6c66d9ebe8c6095300c2780ef8b52a00882b07ab87c26415739157ce4d597204f3ba2515dfb4d5c
6
+ metadata.gz: acab8e6d850da0af08debf29efce668cec344eea8f107d5a907c39852503d18a5605724af28aed3bdb4bfa7966866f9ca7cdb02101eafcb82c5945f74308121b
7
+ data.tar.gz: '08bbc69726f80f47888c5dc5dcfc76282f6b70f23199bacc2f3600103264cb011e46344e0f8ffa53877cd528f11f0e5a9d36947381c5c76a3fe6a22f6f338131'
data/README.md CHANGED
@@ -1 +1,19 @@
1
1
  # MuPDF
2
+
3
+ [![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ksylvest/mupdf/blob/main/LICENSE)
4
+ [![RubyGems](https://img.shields.io/gem/v/mupdf)](https://rubygems.org/gems/mupdf)
5
+ [![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/ksylvest/mupdf)
6
+ [![Yard](https://img.shields.io/badge/docs-site-blue.svg)](https://mupdf.ksylvest.com)
7
+ [![CircleCI](https://img.shields.io/circleci/build/github/ksylvest/mupdf)](https://circleci.com/gh/ksylvest/mupdf)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ gem install mupdf
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ruby
18
+ MuPDF.mutool('info', 'file.pdf')
19
+ ```
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MuPDF
4
+ # An error raised when an mutool command errors.
5
+ class CommandError < StandardError
6
+ # @param cmd [String]
7
+ # @param result [String]
8
+ # @param status [Process::Status]
9
+ def initialize(cmd:, result:, status:)
10
+ super("cmd=#{cmd.inspect} result=#{result.inspect} status=#{status.inspect}")
11
+ @cmd = cmd
12
+ @result = result
13
+ @status = status
14
+ end
15
+ end
16
+ end
data/lib/mupdf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuPDF
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/mupdf.rb CHANGED
@@ -1,11 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'open3'
3
4
  require 'zeitwerk'
4
5
 
5
6
  loader = Zeitwerk::Loader.for_gem
6
7
  loader.inflector.inflect 'mupdf' => 'MuPDF'
7
8
  loader.setup
8
9
 
10
+ # An interface to [MuPDF](https://mupdf.com/) for managing PDFs.
9
11
  module MuPDF
10
12
  class Error < StandardError; end
13
+
14
+ # @usage
15
+ # MuPDF.mutool('info', 'file.pdf')
16
+ #
17
+ # @param cmd [Array<String>] e.g. ['info', 'file.pdf']
18
+ # @raise [ToolError]
19
+ #
20
+ # @return [String]
21
+ def self.mutool(*cmd)
22
+ result, status = Open3.capture2e('mutool', *cmd)
23
+ raise CommandError.new(cmd:, result:, status:) unless status.success?
24
+
25
+ result
26
+ end
11
27
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mupdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2025-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: open3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: zeitwerk
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -36,6 +50,7 @@ files:
36
50
  - bin/console
37
51
  - bin/setup
38
52
  - lib/mupdf.rb
53
+ - lib/mupdf/command_error.rb
39
54
  - lib/mupdf/version.rb
40
55
  homepage: https://github.com/ksylvest/mupdf
41
56
  licenses:
@@ -43,10 +58,10 @@ licenses:
43
58
  metadata:
44
59
  rubygems_mfa_required: 'true'
45
60
  homepage_uri: https://github.com/ksylvest/mupdf
46
- source_code_uri: https://github.com/ksylvest/mupdf/tree/v0.1.0
47
- changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v0.1.0
61
+ source_code_uri: https://github.com/ksylvest/mupdf/tree/v0.2.0
62
+ changelog_uri: https://github.com/ksylvest/mupdf/releases/tag/v0.2.0
48
63
  documentation_uri: https://mupdf.ksylvest.com/
49
- post_install_message:
64
+ post_install_message:
50
65
  rdoc_options: []
51
66
  require_paths:
52
67
  - lib
@@ -61,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
76
  - !ruby/object:Gem::Version
62
77
  version: '0'
63
78
  requirements: []
64
- rubygems_version: 3.5.22
65
- signing_key:
79
+ rubygems_version: 3.5.23
80
+ signing_key:
66
81
  specification_version: 4
67
82
  summary: A library for interacting with MuPDF.
68
83
  test_files: []