mn2pdf 1.13 → 1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +38 -0
- data/.github/workflows/release-tag.yml +49 -0
- data/.github/workflows/release.yml +41 -0
- data/.github/workflows/ubuntu.yml +56 -0
- data/.github/workflows/windows.yml +40 -0
- data/.gitignore +1 -0
- data/README.adoc +15 -0
- data/Rakefile +5 -5
- data/bin/mn2pdf.jar +0 -0
- data/lib/mn2pdf.rb +13 -8
- data/lib/mn2pdf/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6343232473f90f834e415545cbb628fb41b09662abf3434a90ec9d857d9c12b
|
4
|
+
data.tar.gz: e366db442c3b35874764bb3857231fe5ee8e47936b6d1f46231eab4fcfaa78e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb54fbeec1867cb348240e69aca51407908e6d580d732eb6ba9bafb6ec1124c82d8348da388013f39f4bdd6cdc1a0a6529a78cf8353f165c813f64f98b4dca1f
|
7
|
+
data.tar.gz: 00bb9ed6c5b692371ec76280351a458f3e8d43b736e8c18a6a7be5d7a61c2831ac66034bf6642f5ad635863d01ae00369d57c58063c2f3cbd0aae96503a372b1
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: macos
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/ubuntu.yml
|
11
|
+
- .github/workflows/windows.yml
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test-macos:
|
15
|
+
name: Test on Ruby ${{ matrix.ruby }} macOS
|
16
|
+
runs-on: macos-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@master
|
28
|
+
- name: Use Ruby
|
29
|
+
uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- name: Update gems
|
33
|
+
run: |
|
34
|
+
sudo gem install bundler --force
|
35
|
+
bundle install --jobs 4 --retry 3
|
36
|
+
- name: Run specs
|
37
|
+
run: |
|
38
|
+
bundle exec rake
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: release-tag
|
2
|
+
|
3
|
+
on:
|
4
|
+
repository_dispatch:
|
5
|
+
types: [ metanorma/mn2pdf ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
tag_repo:
|
9
|
+
runs-on: ubuntu-18.04
|
10
|
+
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
- name: Add writable remote
|
14
|
+
run: |
|
15
|
+
git config --global user.name "metanorma-ci"
|
16
|
+
git config --global user.email "metanorma-ci@users.noreply.github.com"
|
17
|
+
git remote add github "https://metanorma-ci:${{ secrets.METANORMA_CI_PAT_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
|
18
|
+
git pull github ${GITHUB_REF} --ff-only
|
19
|
+
- name: Parse mn2pdf version
|
20
|
+
env:
|
21
|
+
MN2PDF_TAG: ${{ github.event.client_payload.ref }}
|
22
|
+
run: |
|
23
|
+
echo "::set-env name=MN2PDF_VERSION::${MN2PDF_TAG#*/v}"
|
24
|
+
- name: Use Ruby
|
25
|
+
uses: actions/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: '2.6'
|
28
|
+
architecture: 'x64'
|
29
|
+
- name: Update gems
|
30
|
+
run: |
|
31
|
+
gem install gem-release
|
32
|
+
gem install bundler
|
33
|
+
bundle install --jobs 4 --retry 3
|
34
|
+
- name: Update version
|
35
|
+
run: |
|
36
|
+
gem bump --version ${MN2PDF_VERSION} --no-commit
|
37
|
+
- name: Update mn2pdf.jar
|
38
|
+
run: |
|
39
|
+
rm -f bin/mn2pdf.jar
|
40
|
+
rake bin/mn2pdf.jar
|
41
|
+
- name: Run specs
|
42
|
+
run: |
|
43
|
+
bundle exec rake
|
44
|
+
- name: Push commit and tag
|
45
|
+
run: |
|
46
|
+
git add -u bin/mn2pdf.jar lib/mn2pdf/version.rb
|
47
|
+
git commit -m "Bump version to ${MN2PDF_VERSION}"
|
48
|
+
git tag v${MN2PDF_VERSION}
|
49
|
+
git push github HEAD:${GITHUB_REF} --tags
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-18.04
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v1
|
13
|
+
- name: Use Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: '2.6'
|
17
|
+
architecture: 'x64'
|
18
|
+
- name: Update gems
|
19
|
+
run: |
|
20
|
+
gem install bundler
|
21
|
+
bundle install --jobs 4 --retry 3
|
22
|
+
- name: Update mn2pdf.jar
|
23
|
+
run: |
|
24
|
+
rm -f bin/mn2pdf.jar
|
25
|
+
rake bin/mn2pdf.jar
|
26
|
+
- name: Run specs
|
27
|
+
run: |
|
28
|
+
bundle exec rake
|
29
|
+
- name: Publish to rubygems.org
|
30
|
+
env:
|
31
|
+
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
32
|
+
run: |
|
33
|
+
gem install gem-release
|
34
|
+
touch ~/.gem/credentials
|
35
|
+
cat > ~/.gem/credentials << EOF
|
36
|
+
---
|
37
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
38
|
+
EOF
|
39
|
+
chmod 0600 ~/.gem/credentials
|
40
|
+
git status
|
41
|
+
gem release
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: ubuntu
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
tags:
|
9
|
+
- '*'
|
10
|
+
pull_request:
|
11
|
+
paths-ignore:
|
12
|
+
- .github/workflows/macos.yml
|
13
|
+
- .github/workflows/windows.yml
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
test-linux:
|
17
|
+
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
continue-on-error: ${{ matrix.experimental }}
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
24
|
+
experimental: [false]
|
25
|
+
include:
|
26
|
+
- ruby: '2.7'
|
27
|
+
experimental: true
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@master
|
30
|
+
- name: Use Ruby
|
31
|
+
uses: actions/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
34
|
+
- name: Update gems
|
35
|
+
run: |
|
36
|
+
gem install bundler
|
37
|
+
bundle install --jobs 4 --retry 3
|
38
|
+
- name: Run specs
|
39
|
+
run: |
|
40
|
+
bundle exec rake
|
41
|
+
- name: Trigger repositories
|
42
|
+
if: matrix.ruby == '2.6'
|
43
|
+
env:
|
44
|
+
GH_USERNAME: metanorma-ci
|
45
|
+
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
46
|
+
run: |
|
47
|
+
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
48
|
+
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
49
|
+
CLIENT_PAYLOAD=$(cat <<EOF
|
50
|
+
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
51
|
+
EOF
|
52
|
+
)
|
53
|
+
for repo in $REPOS
|
54
|
+
do
|
55
|
+
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
56
|
+
done
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: windows
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/ubuntu.yml
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
test-windows:
|
15
|
+
name: Test on Ruby ${{ matrix.ruby }} Windows
|
16
|
+
runs-on: windows-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@master
|
28
|
+
- name: Use Ruby
|
29
|
+
uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- name: Update gems
|
33
|
+
shell: pwsh
|
34
|
+
run: |
|
35
|
+
gem install bundler
|
36
|
+
bundle config --local path vendor/bundle
|
37
|
+
bundle install --jobs 4 --retry 3
|
38
|
+
- name: Run specs
|
39
|
+
run: |
|
40
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/README.adoc
CHANGED
@@ -33,3 +33,18 @@ require 'mn2pdf'
|
|
33
33
|
Mn2pdf.convert(sample_xml_path, output_pdf_path, sample_xsl_path)
|
34
34
|
----
|
35
35
|
|
36
|
+
== Updating the gem
|
37
|
+
|
38
|
+
Update `lib/mn2pdf/version.rb` to the desired version of https://github.com/metanorma/mn2pdf[mn2pdf].
|
39
|
+
|
40
|
+
Run `rake` to download the `bin/mn2pdf.jar` file:
|
41
|
+
|
42
|
+
[source,ruby]
|
43
|
+
----
|
44
|
+
rm -f bin/mn2pdf.jar
|
45
|
+
rake bin/mn2pdf.jar
|
46
|
+
----
|
47
|
+
|
48
|
+
Then release the gem with `rake release`.
|
49
|
+
|
50
|
+
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require_relative 'lib/mn2pdf/version'
|
4
4
|
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
@@ -8,10 +8,10 @@ task :default => :spec
|
|
8
8
|
|
9
9
|
require 'open-uri'
|
10
10
|
|
11
|
-
file
|
11
|
+
file 'bin/mn2pdf.jar' do |file|
|
12
12
|
ver = Mn2pdf::VERSION
|
13
13
|
url = "https://github.com/metanorma/mn2pdf/releases/download/v#{ver}/mn2pdf-#{ver}.jar"
|
14
|
-
File.open(file.name,
|
14
|
+
File.open(file.name, 'wb') do |file|
|
15
15
|
file.write open(url).read
|
16
16
|
end
|
17
17
|
end
|
data/bin/mn2pdf.jar
CHANGED
Binary file
|
data/lib/mn2pdf.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'open3'
|
2
|
+
require 'mn2pdf/version'
|
3
3
|
|
4
4
|
module Mn2pdf
|
5
|
-
MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__),
|
5
|
+
MN2PDF_JAR_PATH = File.join(File.dirname(__FILE__), '../bin/mn2pdf.jar')
|
6
6
|
|
7
7
|
def self.help
|
8
|
-
cmd = [
|
8
|
+
cmd = ['java', '-jar', MN2PDF_JAR_PATH].join(' ')
|
9
9
|
message, error_str, status = Open3.capture3(cmd)
|
10
|
-
|
11
10
|
message
|
12
11
|
end
|
13
12
|
|
13
|
+
def self.version
|
14
|
+
cmd = ['java', '-jar', MN2PDF_JAR_PATH, '-v'].join(' ')
|
15
|
+
message, error_str, status = Open3.capture3(cmd)
|
16
|
+
message.strip
|
17
|
+
end
|
18
|
+
|
14
19
|
def self.convert(url_path, output_path, xsl_stylesheet)
|
15
20
|
return if url_path.nil? || output_path.nil? || xsl_stylesheet.nil?
|
16
21
|
|
17
22
|
puts MN2PDF_JAR_PATH
|
18
|
-
cmd = [
|
19
|
-
url_path,
|
20
|
-
output_path].join(
|
23
|
+
cmd = ['java', '-Xss5m', '-Xmx1024m', '-jar', MN2PDF_JAR_PATH, '--xml-file',
|
24
|
+
url_path, '--xsl-file', xsl_stylesheet, '--pdf-file',
|
25
|
+
output_path].join(' ')
|
21
26
|
|
22
27
|
puts cmd
|
23
28
|
_, error_str, status = Open3.capture3(cmd)
|
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.21'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
mn2pdf converts Metanorma XML into PDF.
|
@@ -20,6 +20,11 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
|
+
- ".github/workflows/macos.yml"
|
24
|
+
- ".github/workflows/release-tag.yml"
|
25
|
+
- ".github/workflows/release.yml"
|
26
|
+
- ".github/workflows/ubuntu.yml"
|
27
|
+
- ".github/workflows/windows.yml"
|
23
28
|
- ".gitignore"
|
24
29
|
- ".rspec"
|
25
30
|
- CODE_OF_CONDUCT.md
|