From 92e42236f57e4e8183172a49edc02c38eee5b87e Mon Sep 17 00:00:00 2001 From: Bart Kamphorst Date: Mon, 17 Sep 2018 22:41:31 +0200 Subject: [PATCH] Add --versions flag to the gollum binary that outputs the version numbers of auxiliary gems. Resolves #1022. --- bin/gollum | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bin/gollum b/bin/gollum index 93f3c857..9216fd89 100755 --- a/bin/gollum +++ b/bin/gollum @@ -176,8 +176,27 @@ MSG end opts.on("--version", "Display the current version of Gollum.") do puts "Gollum " + Gollum::VERSION + end + opts.on("--versions", "Display the current version of Gollum and auxiliary gems.") do + puts "Gollum " + Gollum::VERSION + puts "Running on: #{RUBY_PLATFORM} with Ruby version #{RUBY_VERSION}" + puts "Using:" + loaded_gemspecs = Gem.loaded_specs + gollum_gems = ['gollum-lib', 'gollum-rjgit_adapter', 'rjgit', 'gollum-grit_adapter', 'grit', 'gollum-rugged_adapter', 'rugged'] + puts Gem.loaded_specs.select{|name, spec| gollum_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"} + puts "With the following renderers:" + renderer_gems = ['kramdown', 'RedCloth', 'org-ruby', 'creole', 'asciidoctor', 'wikicloth'] + renderer_gems.each do |renderer| + begin + require renderer + rescue LoadError + end + end + puts Gem.loaded_specs.select{|name, spec| renderer_gems.include?(name)}.map {|name, spec| "#{name} #{spec.version}"} + exit 0 end + opts.separator "" end