mn2pdf 1.28 → 1.29

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: 143b5e801666557e86807fa8e13ea84b046e0e1d89882ef26dc52cf35ea9391b
4
+ data.tar.gz: d249dba0fecdde0eac0ad7e2a1342a5f00b29125554ededd4be38f5c6168ba9b
5
5
  SHA512:
6
- metadata.gz: aa16f239b56af426ecf15bb11df97f55281691d5c025eb057483136ff1ecae9ecb563229004582760350ee70de9db7656615a0ddf8775ad189f9817157f43b74
7
- data.tar.gz: 04c5d61373e57a32f3ea28de138ed00134c18d980330042a0c53c23d767712bf87fb5db485b23dfa7ea07243dde5d8af4799744b1e0d2ecca68fd914d182d6be
6
+ metadata.gz: 0634edb8a030f927ddf220f528dc31d2747f5afcbda4ac340ed7d35824a05568247f27be5bd31fdddcdc65a5ab988266232f1364c669ddbcb27204ca5d06903a
7
+ data.tar.gz: bb0b1e822cde0ea63b05d339dd1000f6f05118c1d1503cc4cd4cf5f72e402183ed5ada4ae0896299d135c793b1040414154bae3ca50c980122b8ccb1dae67429
@@ -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", "-Xmx1024m", *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
+ [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.29'
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.29'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-21 00:00:00.000000000 Z
11
+ date: 2021-03-27 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