Module: Gollum::MarkupRegisterUtils
- Defined in:
- lib/gollum-lib/markups.rb
Instance Method Summary collapse
- #all_gems_available?(names) ⇒ Boolean
-
#executable_exists?(name) ⇒ Boolean
Check if an executable exists.
-
#gem_exists?(name) ⇒ Boolean
Check if a gem exists.
-
#using_pandoc? ⇒ Boolean
Whether the current markdown renderer is pandoc.
Instance Method Details
#all_gems_available?(names) ⇒ Boolean
14 15 16 17 18 19 |
# 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) ⇒ Boolean
Check if an executable exists. This implementation comes from stackoverflow question 2108727.
23 24 25 26 27 28 29 30 31 32 33 |
# 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) ⇒ Boolean
Check if a gem exists. This implementation requires Gem::Specificaton to be filled.
10 11 12 |
# File 'lib/gollum-lib/markups.rb', line 10 def gem_exists?(name) Gem::Specification.find {|spec| spec.name == name} != nil end |
#using_pandoc? ⇒ Boolean
Whether the current markdown renderer is pandoc
36 37 38 |
# File 'lib/gollum-lib/markups.rb', line 36 def using_pandoc? GitHub::Markup::Markdown.implementation_name == 'pandoc-ruby' end |