module Gollum::MarkupRegisterUtils

Public Instance Methods

all_gems_available?(names) click to toggle source
# File lib/gollum-lib/markups.rb, line 14
def all_gems_available?(names)
  names.each do |name|
    return false unless gem_exists?(name)
  end
  true
end
executable_exists?(name) click to toggle source

Check if an executable exists. This implementation comes from stackoverflow question 2108727.

# File lib/gollum-lib/markups.rb, line 23
def executable_exists?(name)
  exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
  paths = ENV["PATH"].split(::File::PATH_SEPARATOR)
  paths.each do |path|
    exts.each do |ext|
      exe = Pathname(path) + "#{name}#{ext}"
      return true if exe.executable?
    end
  end
  return false
end
gem_exists?(name) click to toggle source

Check if a gem exists. This implementation requires Gem::Specificaton to be filled.

# File lib/gollum-lib/markups.rb, line 10
def gem_exists?(name)
  Gem::Specification.find {|spec| spec.name == name} != nil
end
using_pandoc?() click to toggle source

Whether the current markdown renderer is pandoc

# File lib/gollum-lib/markups.rb, line 36
def using_pandoc?
  GitHub::Markup::Markdown.implementation_name == 'pandoc-ruby'
end