Skip to content

I need to know what's PandocRuby's path to pandoc #40

@jmuheim

Description

@jmuheim

Hello

On my production server, the most current pandoc version is not the one in the standard path $ pandoc, but in $ /home/www-data/.local/bin/pandoc.

I managed to set PandocRuby to look at the correct place by setting it like so:

PandocRuby.pandoc_path = '/home/www-data/.local/bin/pandoc'

As I need to do some other stuff in my Rails app using Pandoc, I hoped that I could simply do something like this:

def pandoc_version
  matches = `#{PandocRuby.pandoc_path} -v`.match /\bpandoc ((\.?\d+)+)\b/
  pandoc_version = matches[1].to_f
end

But this results in:

undefined method `pandoc_path' for PandocRuby:Class

I managed to work around this now using a global variable:

PANDOC_PATH = '/home/www-data/.local/bin/pandoc'
PandocRuby.pandoc_path = PANDOC_PATH

So I can do:

def pandoc_version
  matches = `#{PANDOC_PATH} -v`.match /\bpandoc ((\.?\d+)+)\b/
  pandoc_version = matches[1].to_f
end

But I'm pretty sure there's an easier way to do this, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions