mn2pdf 1.26 → 1.31

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: 3d4992fb7f1bf56ed05ef2fd4cd01104d915ec39aaadbcf992aea4ec71d80fa4
4
- data.tar.gz: d02d96499f94ba9f0d33e104b174b85a68fb46915dcd22cc7c4188ca5be04000
3
+ metadata.gz: 55ea33d8683ee2cef108879b9011b34a85f71bd1a190f3cfb02f2303b94cf42a
4
+ data.tar.gz: be56956b7b502f51fe481db6acd4466dcfcdbf3902b5bdea4d1f903b2b4ce7e3
5
5
  SHA512:
6
- metadata.gz: ab900102792ef9bd74fe6399916dfb772ef4fb9f7324e1e07164b1c6bb8db962b01fda5e18384f780e429596ab3c41cdbff25f11b1f5ed29b58ea7362bd9abfa
7
- data.tar.gz: b04335a1d24b951244b0016a09e6f637ef5c0dd4b0a882745dbd4ebd2964a28fc85c582da69f1ade5ad7930018cea1203d6806fbee28c645b38737ac2bfcb1f8
6
+ metadata.gz: b92fea3d06801a57b7ea61a1acd27c0ab63b3b06227e7c131beeb23f3b69d2bbac8b569369f16ea58b9ce1f4395584a9294bf711033e270d5082e3b515b5ae3a
7
+ data.tar.gz: 12061e8ee977178c83314e6598847b7a8d3c0f9356834f235c454e4e9a5a332b38dc57394dee9eaf3ab42eb4e77e4d9e67f70de5bdd9c977baed411c242da45f
@@ -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 }}
@@ -31,12 +31,10 @@ jobs:
31
31
  RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
32
32
  run: |
33
33
  gem install gem-release
34
- touch ~/.gem/credentials
35
34
  cat > ~/.gem/credentials << EOF
36
35
  ---
37
36
  :rubygems_api_key: ${RUBYGEMS_API_KEY}
38
37
  EOF
39
38
  chmod 0600 ~/.gem/credentials
40
- git status
41
39
  gem release
42
40
 
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.26'
2
+ VERSION = '1.31'
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.26'
4
+ version: '1.31'
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-01-16 00:00:00.000000000 Z
11
+ date: 2021-04-19 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
@@ -54,7 +55,7 @@ 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
+ rubygems_version: 3.0.3.1
58
59
  signing_key:
59
60
  specification_version: 4
60
61
  summary: mn2pdf converts Metanorma XML into PDF.