mn2pdf 1.25 → 1.30

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: 6a7608665ad367e57f59456d047d3bc66540c26fb7e3a4b999c8c12378b8a08b
4
- data.tar.gz: 0b586808298389164e4a62e16d268f56791e8e4aebc7bc8477fc03ff8bb434aa
3
+ metadata.gz: c3597f17edc0cc3bc820cf7ef4aa940aeedd425f11fc707445ff3b5a2e5fc027
4
+ data.tar.gz: 67311e8ad232674120735a0b3cd7b2d3a2706c6c444e35cf912a45ff984444b1
5
5
  SHA512:
6
- metadata.gz: ee2a8efd34497b8a9f9c3743829899fa620933d10727dd1f46b42de652248d6fef0f7b10cbfa2d6a5e768821bb1dc7149bfdf279f3237d959adf960288242856
7
- data.tar.gz: 9c07ace9be5398662e0eea6af619afe4a40ad7a2b8a64aa190981c52a643f9fadf1ffd7e6f90e3a59a534115f74c5eaec0e4515102cffeb46056ca8c7a94fb84
6
+ metadata.gz: be190dac599fd284d57395b560ef0dab8c03b07a8a46c7b1542a696c3f7ebab170ed45924561ee8612120ea79f197a4def8d6195439134ab3e5fbf440cd78920
7
+ data.tar.gz: a9e29610b4fea012b0a3cbf72554516128cefdb106c3b4b467b36345420761408c726e499de89490b884c6b8cae853e2ad5bb4469c3a29d2163414a9c6f0d4b7
@@ -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 }}
@@ -20,7 +20,6 @@ jobs:
20
20
  env:
21
21
  MN2PDF_TAG: ${{ github.event.client_payload.ref }}
22
22
  run: |
23
- echo "::set-env name=MN2PDF_VERSION::${MN2PDF_TAG#*/v}"
24
23
  echo MN2PDF_VERSION=${MN2PDF_TAG#*/v} >> ${GITHUB_ENV}
25
24
  - name: Use Ruby
26
25
  uses: actions/setup-ruby@v1
@@ -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.25'
2
+ VERSION = '1.30'
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.25'
4
+ version: '1.30'
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: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-04-13 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
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
56
  version: '0'
56
57
  requirements: []
57
58
  rubygems_version: 3.0.3
58
- signing_key:
59
+ signing_key:
59
60
  specification_version: 4
60
61
  summary: mn2pdf converts Metanorma XML into PDF.
61
62
  test_files: []