Module: MultiMarkdownCLI

Defined in:
lib/multimarkdown-cli.rb,
lib/multimarkdown-cli/tilt_plugin.rb

Defined Under Namespace

Classes: Parser, Template

Class Method Summary collapse

Class Method Details

._cli_installed?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/multimarkdown-cli.rb', line 5

def self._cli_installed?
  # from http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
  exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
  mmd_cmd_found = false
  ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "multimarkdown#{ext}")
      if File.executable? exe
        mmd_cmd_found = true
        break
      end
    end
  end
  mmd_cmd_found
end