mn2pdf 1.28 → 1.31.2

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: 7eba679b7b8ad90c8c92373dd64f68ef61303fd9e20e55b588c87d1b1c542060
4
- data.tar.gz: b72a86e5f9f7c212e1ad20e4c1e9cf89de862b09bdcdca903491fe5dd5a32f21
3
+ metadata.gz: b4cd0fe34c8b299b6b85c7218181a5f4052e82f8f05e425038507c432cd6f519
4
+ data.tar.gz: 010d84cd97d971c286ad1f04b2d39190d5beeba2efe265f666a27d1b91d016d0
5
5
  SHA512:
6
- metadata.gz: aa16f239b56af426ecf15bb11df97f55281691d5c025eb057483136ff1ecae9ecb563229004582760350ee70de9db7656615a0ddf8775ad189f9817157f43b74
7
- data.tar.gz: 04c5d61373e57a32f3ea28de138ed00134c18d980330042a0c53c23d767712bf87fb5db485b23dfa7ea07243dde5d8af4799744b1e0d2ecca68fd914d182d6be
6
+ metadata.gz: d30399339c21d65bb5329f5912260740d130e95f693888318b8acd35f66db71cc6f0bbd10a93f9482cfc83263366ba3b344f13f318c45e477cb056301d9040f2
7
+ data.tar.gz: d641d7aaa3f7ea9d7593858b693fbef01676b847980901a6d83282285b1e8aa82c2a91e22deb12d9f5c06b89de2bbf7a318163bc28b96c6cf2954812dad97813
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
@@ -16,48 +16,27 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
33
- - uses: actions/checkout@master
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
34
36
 
35
37
  - uses: ruby/setup-ruby@v1
36
38
  with:
37
39
  ruby-version: ${{ matrix.ruby }}
38
-
39
- - uses: actions/cache@v1
40
- with:
41
- path: vendor/bundle
42
- key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
- restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
-
45
- - run: bundle config set path 'vendor/bundle'
46
-
47
- - run: bundle install --jobs 4 --retry 3
40
+ bundler-cache: true
48
41
 
49
42
  - run: bundle exec rake
50
-
51
- notify:
52
- name: Trigger notify workflow
53
- needs: rake
54
- runs-on: ubuntu-latest
55
- steps:
56
- - name: Trigger notify workflow
57
- uses: Sibz/github-status-action@v1
58
- with:
59
- authToken: ${{ secrets.GITHUB_TOKEN }}
60
- context: 'tests-passed-successfully'
61
- description: 'Tests passed successfully'
62
- state: 'success'
63
- sha: ${{ github.event.pull_request.head.sha || github.sha }}
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
data/bin/mn2pdf.jar CHANGED
Binary file
data/lib/mn2pdf.rb CHANGED
@@ -1,36 +1,48 @@
1
- require 'open3'
2
- require 'mn2pdf/version'
1
+ require "open3"
2
+ require "rbconfig"
3
+ require "mn2pdf/version"
3
4
 
4
5
  module Mn2pdf
5
- MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__), '../bin/mn2pdf.jar')
6
+ MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__), "../bin/mn2pdf.jar")
7
+
8
+ def self.jvm_options
9
+ options = []
10
+
11
+ if RbConfig::CONFIG["host_os"].match?(/darwin|mac os/)
12
+ options << "-Dapple.awt.UIElement=true"
13
+ end
14
+
15
+ options
16
+ end
6
17
 
7
18
  def self.help
8
- cmd = ['java', '-jar', MN2PDF_JAR_PATH].join(' ')
9
- message, error_str, status = Open3.capture3(cmd)
19
+ cmd = ["java", *jvm_options, "-jar", MN2PDF_JAR_PATH].join(" ")
20
+ message, = Open3.capture3(cmd)
10
21
  message
11
22
  end
12
23
 
13
24
  def self.version
14
- cmd = ['java', '-jar', MN2PDF_JAR_PATH, '-v'].join(' ')
15
- message, error_str, status = Open3.capture3(cmd)
25
+ cmd = ["java", *jvm_options, "-jar", MN2PDF_JAR_PATH, "-v"].join(" ")
26
+ message, = Open3.capture3(cmd)
16
27
  message.strip
17
28
  end
18
29
 
19
30
  def self.convert(url_path, output_path, xsl_stylesheet, options = "")
20
31
  return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
21
32
 
22
- puts MN2PDF_JAR_PATH
23
- cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', MN2PDF_JAR_PATH, '--xml-file',
24
- url_path, '--xsl-file', xsl_stylesheet, '--pdf-file',
25
- output_path, options].join(' ')
33
+ cmd = ["java", "-Xss5m", "-Xmx2048m", *jvm_options,
34
+ "-jar", MN2PDF_JAR_PATH, "--xml-file", url_path,
35
+ "--xsl-file", xsl_stylesheet, "--pdf-file", output_path, options].join(" ")
26
36
 
27
37
  puts cmd
28
38
  stdout_str, error_str, status = Open3.capture3(cmd)
29
39
 
30
- unless status.success?
31
- # Strip default mn2pdf message
32
- stdout_str = stdout_str.gsub('Preparing...', '').strip
33
- raise [stdout_str, error_str].join(' ').strip
34
- end
40
+ raise prepare_error_msg(stdout_str, error_str) unless status.success?
41
+ end
42
+
43
+ def self.prepare_error_msg(stdout_str, error_str)
44
+ # Strip default mn2pdf message
45
+ stdout_str = stdout_str.gsub("Preparing...", "").strip
46
+ ["[mn2pdf] Fatal:", stdout_str, error_str].join(" ").strip
35
47
  end
36
48
  end
@@ -1,3 +1,3 @@
1
1
  module Mn2pdf
2
- VERSION = '1.28'
2
+ VERSION = "1.31.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mn2pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.28'
4
+ version: 1.31.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-21 00:00:00.000000000 Z
11
+ date: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  mn2pdf converts Metanorma XML into PDF.
@@ -25,6 +25,7 @@ files:
25
25
  - ".github/workflows/release.yml"
26
26
  - ".gitignore"
27
27
  - ".rspec"
28
+ - ".rubocop.yml"
28
29
  - CODE_OF_CONDUCT.md
29
30
  - Gemfile
30
31
  - README.adoc
@@ -39,7 +40,7 @@ homepage: https://github.com/metanorma/mn2pdf-ruby
39
40
  licenses:
40
41
  - BSD-2-Clause
41
42
  metadata: {}
42
- post_install_message:
43
+ post_install_message:
43
44
  rdoc_options: []
44
45
  require_paths:
45
46
  - lib
@@ -54,8 +55,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
55
  - !ruby/object:Gem::Version
55
56
  version: '0'
56
57
  requirements: []
57
- rubygems_version: 3.0.3
58
- signing_key:
58
+ rubygems_version: 3.1.4
59
+ signing_key:
59
60
  specification_version: 4
60
61
  summary: mn2pdf converts Metanorma XML into PDF.
61
62
  test_files: []