metanorma 0.3.12 → 0.3.13

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: a3e99f6dcb3fe79eb0f8be74ff79c3bf461e64974992d0e56b5192bc0638970c
4
- data.tar.gz: 5559be01e614c1c54d2e2b2900642ef73528acdb03a8ae569bfa694de3f4cb7f
3
+ metadata.gz: 49d9fbd197f12d48e473b402e1f096cfa3715fb7460519488e48c79d0b47478e
4
+ data.tar.gz: 4761f5e9d7ee578078268c1597b2a91f2d66a5de913a9fce55ababde3336e254
5
5
  SHA512:
6
- metadata.gz: e5cd41cd491dd4518e1598b867dc48c7ee6973b1d5785c1b59107c777ac5970688595fd6d5d7761fd47ae56addccd64e2860a5483fe86deeba51caf9273e2803
7
- data.tar.gz: 132b2bcf455b7f02fda5325157b70a9bccee16957be76a2fbcd1e67225bef0e4f5135ff56bf559a354a6eaabf326a4d8da96d668ce6571218c235793cdec4a13
6
+ metadata.gz: c1695dc7f3bde1cc1e9a8cb0e0127de58ee8cb0d15549a56acc6508702c2553064936fca4b0e89ffed2a7fd30d6744b47a62724a1dfda1baaf90e875e2ccb409
7
+ data.tar.gz: 9be90059163824f997045b7b50039d203a91b485edfe7b76acfd69e6b4f708d0bcc2d9e7943ce25b40b6e41071663637918f6ae8ef70bade6388a06d097824a9
data/.gitignore CHANGED
@@ -7,5 +7,12 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
+ /.tmp.xml
11
+ /test.*
12
+ /a.*
13
+ /spec/assets/test*
14
+ /spec/assets/test/
15
+ /spec/assets/extract/
16
+
10
17
  # rspec failure tracking
11
18
  .rspec_status
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metanorma (0.3.12)
4
+ metanorma (0.3.13)
5
5
  asciidoctor
6
6
  htmlentities
7
7
 
data/bin/metanorma-pdf.js CHANGED
@@ -5,6 +5,7 @@ const puppeteer = require('puppeteer');
5
5
 
6
6
  const createPdf = async() => {
7
7
  let browser;
8
+ let exitCode = 0;
8
9
  try {
9
10
  browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
10
11
  const page = await browser.newPage();
@@ -14,12 +15,13 @@ const createPdf = async() => {
14
15
  format: 'A4'
15
16
  });
16
17
  } catch (err) {
17
- console.log(err.message);
18
+ console.error(err.message);
19
+ exitCode = 1
18
20
  } finally {
19
21
  if (browser) {
20
22
  browser.close();
21
23
  }
22
- process.exit();
24
+ process.exit(exitCode);
23
25
  }
24
26
  };
25
27
  createPdf();
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -52,8 +52,7 @@ module Metanorma
52
52
  end
53
53
  stdtype = options[:type].to_sym
54
54
  unless @registry.supported_backends.include? stdtype
55
- Util.log("[metanorma] Warning: #{stdtype} is not a default standard type.", :warning)
56
- Util.log("metanorma] Info: Attempting to load `metanorma-#{stdtype}` gem for standard type `#{stdtype}`.", :info)
55
+ Util.log("[metanorma] Info: Loading `metanorma-#{stdtype}` gem for standard type `#{stdtype}`.", :info)
57
56
  end
58
57
  begin
59
58
  require "metanorma-#{stdtype}"
@@ -1,14 +1,21 @@
1
+ require "open3"
2
+ require "pathname"
3
+
1
4
  module Metanorma
2
5
  module Output
3
6
  class Pdf < Base
4
7
 
5
8
  def convert(url_path, output_path)
6
9
  file_url = url_path
7
- file_url = "file://#{url_path}" if %r{^/}.match file_url
8
- file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://}.match file_url
9
- pdfjs = File.join(File.dirname(__FILE__), '../../../bin/metanorma-pdf.js')
10
- ENV['NODE_PATH'] ||= `npm root --quiet -g`.strip
11
- system "node #{pdfjs} #{file_url} #{output_path}"
10
+ file_url = "file://#{url_path}" if Pathname.new(file_url).absolute?
11
+ file_url = "file://#{Dir.pwd}/#{url_path}" unless %r{^file://} =~ file_url
12
+ pdfjs = File.join(File.dirname(__FILE__), "../../../bin/metanorma-pdf.js")
13
+
14
+ node_path = ENV["NODE_PATH"] || `npm root --quiet -g`.strip
15
+ node_cmd = ["node", pdfjs, file_url, output_path].join(" ")
16
+
17
+ _, error_str, status = Open3.capture3({ "NODE_PATH" => node_path }, node_cmd)
18
+ raise error_str unless status.success?
12
19
  end
13
20
  end
14
21
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "0.3.12"
2
+ VERSION = "0.3.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2019-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -162,6 +162,7 @@ files:
162
162
  - bin/console
163
163
  - bin/metanorma-pdf.js
164
164
  - bin/rasterize.js
165
+ - bin/rspec
165
166
  - bin/setup
166
167
  - lib/metanorma.rb
167
168
  - lib/metanorma/asciidoctor_extensions.rb
@@ -200,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
201
  version: '0'
201
202
  requirements: []
202
203
  rubyforge_project:
203
- rubygems_version: 2.7.7
204
+ rubygems_version: 2.7.6
204
205
  signing_key:
205
206
  specification_version: 4
206
207
  summary: Metanorma is the standard of standards; the metanorma gem allows you to create