mn2pdf 1.28 → 1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +9 -30
- data/.rubocop.yml +6 -0
- data/bin/mn2pdf.jar +0 -0
- data/lib/mn2pdf.rb +28 -16
- data/lib/mn2pdf/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 143b5e801666557e86807fa8e13ea84b046e0e1d89882ef26dc52cf35ea9391b
|
4
|
+
data.tar.gz: d249dba0fecdde0eac0ad7e2a1342a5f00b29125554ededd4be38f5c6168ba9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0634edb8a030f927ddf220f528dc31d2747f5afcbda4ac340ed7d35824a05568247f27be5bd31fdddcdc65a5ab988266232f1364c669ddbcb27204ca5d06903a
|
7
|
+
data.tar.gz: bb0b1e822cde0ea63b05d339dd1000f6f05118c1d1503cc4cd4cf5f72e402183ed5ada4ae0896299d135c793b1040414154bae3ca50c980122b8ccb1dae67429
|
data/.github/workflows/rake.yml
CHANGED
@@ -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: '
|
23
|
+
- ruby: '3.0'
|
24
24
|
os: 'ubuntu-latest'
|
25
25
|
experimental: true
|
26
|
-
- ruby: '
|
26
|
+
- ruby: '3.0'
|
27
27
|
os: 'windows-latest'
|
28
28
|
experimental: true
|
29
|
-
- ruby: '
|
29
|
+
- ruby: '3.0'
|
30
30
|
os: 'macos-latest'
|
31
31
|
experimental: true
|
32
32
|
steps:
|
33
|
-
- uses: actions/checkout@
|
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
|
2
|
-
require
|
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__),
|
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 = [
|
9
|
-
message,
|
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 = [
|
15
|
-
message,
|
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
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
data/lib/mn2pdf/version.rb
CHANGED
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.
|
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-
|
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
|