asciidoctor / asciidoctor-confluence

Push Asciidoctor file to Confluence
https://rubygems.org/gems/asciidoctor-confluence
MIT License
82 stars 28 forks source link

Option --version Fails #19

Open znerd opened 5 years ago

znerd commented 5 years ago

Steps to reproduce:

  1. docker run --rm asciidoctor/docker-asciidoctor asciidoctor-confluence --version
  2. echo $?

Expected results:

  1. Version is printed in step 1.
  2. No error is printed in step 1.
  3. Exit code 0 in step 2.

Actual results:

  1. OK: Version is indeed printed in step 1.
  2. NOK: After the version output comes an error.
  3. NOK Exit code is 1.

Output:

$ docker run --rm asciidoctor/docker-asciidoctor asciidoctor-confluence --version
Unable to find image 'asciidoctor/docker-asciidoctor:latest' locally
latest: Pulling from asciidoctor/docker-asciidoctor
c67f3896b22c: Pull complete
94e0a328a61c: Pull complete
4eb7dbe1cbfa: Pull complete
5267350f46f2: Pull complete
23aa78cbccb9: Pull complete
Digest: sha256:d1e01a3d819e4c55514a6499c3c3af6a4b9f7fbc814430d8d803b91f6c819391
Status: Downloaded newer image for asciidoctor/docker-asciidoctor:latest
Asciidoctor-confluence v0.0.2
Asciidoctor 1.5.7.1 [https://asciidoctor.org]
Runtime Environment (ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux-musl]) (lc:UTF-8 fs:UTF-8 in:UTF-8 ex:UTF-8)

/usr/lib/ruby/gems/2.4.0/gems/asciidoctor-confluence-0.0.2/bin/asciidoctor-confluence:7:in `exit': no implicit conversion from nil to integer (TypeError)
    from /usr/lib/ruby/gems/2.4.0/gems/asciidoctor-confluence-0.0.2/bin/asciidoctor-confluence:7:in `<top (required)>'
    from /usr/bin/asciidoctor-confluence:23:in `load'
    from /usr/bin/asciidoctor-confluence:23:in `<main>'
$ echo $?
1
znerd commented 5 years ago

The problem might be in this piece of code in invoker.rb:

def self.invoke_helper_or_version(args)
  helpers = %w(-h --help -V --version)
  args.size == 1 && helpers.include?(args[0])
end