Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jmuheim opened this issue Aug 10, 2020 · 0 comments
Open

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

jmuheim opened this issue Aug 10, 2020 · 0 comments

Comments

@jmuheim
Copy link

jmuheim commented Aug 10, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant