Closed ghost closed 7 years ago
I think this is a path order issue. In Terminal rvm
makes sure it is the first path in the list, so it will be found first. BUT I think when run from the workflow, rvm
cannot set itself up and therefore /usr/local/bin
takes precedence.
Actually I had not yet set up scrivomatic to deal with rvm
, as I had switched from rvm
to rbenv
some time ago. I think to fix this I will update scrivomatic to check for rvm
explicitly and add it to the path earlier than /usr/local/bin and it should fix it.
The one annoying thing about rvm
is that the path to the binary have the ruby version hard-coded (perhaps why I switched to rbenv
), so there may not be an easy way for me to add the path unless I parse the rvm configuration file somehow? I'll have a look at this over the weekend...
@talazem can you see if there is an rvm
command that returns the "active" path. Otherwise I can probably just first check if there is a .rvm folder, then do a which ruby
, then parse that path as the probable path to pandocomatic. But if rvm
has a command that returns the current active path it would be easier...
If I understand your request, beyond using which ruby
or which rvm
:
rvm info
inspects the entire ruby environment for a specified RVM installed ruby. In my case, it returned the following:
ruby-2.4.0:
system:
uname: "Darwin TAMBPr-7534996.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 22:01:05 PDT 2017; root:xnu-4570.1.46~3/RELEASE_X86_64 x86_64"
name: "OSX"
version: "10.13"
architecture: "x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)"
zsh: "/bin/zsh => zsh 5.3 (x86_64-apple-darwin17.0)"
remote path: "osx/10.13/x86_64"
rvm:
version: "rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]"
updated: "21 days 21 hours 36 minutes 27 seconds ago"
path: "$HOME/.rvm"
autolibs: "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."
ruby:
interpreter: "ruby"
version: "2.4.0p0"
date: "2016-12-24"
platform: "x86_64-darwin17"
patchlevel: "2016-12-24 revision 57164"
full_version: "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin17]"
homes:
gem: "$HOME/.rvm/gems/ruby-2.4.0"
ruby: "$HOME/.rvm/rubies/ruby-2.4.0"
binaries:
ruby: "$HOME/.rvm/rubies/ruby-2.4.0/bin/ruby"
irb: "$HOME/.rvm/rubies/ruby-2.4.0/bin/irb"
gem: "$HOME/.rvm/rubies/ruby-2.4.0/bin/gem"
rake: "$HOME/.rvm/rubies/ruby-2.4.0/bin/rake"
environment:
PATH: "$HOME/.rvm/gems/ruby-2.4.0/bin:$HOME/.rvm/gems/ruby-2.4.0@global/bin:$HOME/.rvm/rubies/ruby-2.4.0/bin:/usr/local/bin:$HOME/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.cabal/bin$HOME/context/tex/texmf-osx-64/bin:$HOME/context_old/tex/texmf-osx-64/bin:/library/tex/texbin:/usr/local/opt/sphinx-doc/bin:/usr/local/opt/ghc@8.0/bin:$HOME/.rvm/rubies/ruby-2.4.0/bin/:$HOME/.cabal/bin:$HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:$HOME/.rvm/bin"
GEM_HOME: "$HOME/.rvm/gems/ruby-2.4.0"
GEM_PATH: "$HOME/.rvm/gems/ruby-2.4.0:$HOME/.rvm/gems/ruby-2.4.0@global"
MY_RUBY_HOME: "$HOME/.rvm/rubies/ruby-2.4.0"
IRBRC: "$HOME/.rvm/rubies/ruby-2.4.0/.irbrc"
RUBYOPT: ""
gemset: ""
rvm list
shows the current default. In my case, it returned the following:rvm rubies
=* ruby-2.4.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I don't know if any of this helps.
OK, that's helpful at least to remember how rvm sets itself up. Will add rvm's active path in scrivomatic.
@talazem: try to redownload scrivomatic (V1.0.9) and see if that is now working?
Thank you. Now I got the following error:
=== Scrivomatic V1.0.9 Report @ 2017-09-15 17:18:45 +0100 ===
Running under Ruby 2.4.1
Working directory: $HOME/Desktop/scrivener-pandoc
====== Input Options: ======
#<struct Scrivomatic::OPT input="scrivener-pandoc.md", output=nil, to=nil, command="pandocomatic", envpath="/usr/local/bin/:/Library/TeX/texbin:$HOME/bin:/usr/local/bin", build=false, verbose=true>
====== Final ENV PATH: ======
/usr/local/bin/:/Library/TeX/texbin:$HOME/bin:/usr/local/bin:/Library/TeX/texbin:/usr/local/bin:$HOME/bin:$HOME/.pandoc:/usr/bin:/bin:/usr/sbin:/sbin
====== TOOL PATHS: ======
---pandoc: /usr/local/bin//pandoc | V: 1.19.2.1
---pandocomatic: /usr/local/bin//pandocomatic | V: Pandocomatic version 0.1.4.13
---ruby: /usr/local/bin//ruby | V: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex
Running: pandocomatic...
!!!---scrivomatic::runCommand() popen2e FAILED TO RUN /usr/local/bin//pandocomatic --debug scrivener-pandoc.md !!!
OK, I'll need to search explicitly for rvm...
Well, I installed rvm and think I got it to work. I have to say rvm is very difficult to work with outside of a login shell. For rbenv
you just add the shims path and it works. For rvm
I ended up adding the wrappers folder, I tried a more elegant solution but it nothing really worked. rvm
is not loaded when run outside of terminal and therefore you cannot use it define what path should be used, and gem binaries are kept in a different folder. Loading it doesn't work from inside ruby. Anyway, you may need to run rvm wrapper default --no-prefix
from terminal, but before you do that can you try the new scrivomatic (V1.0.10) first and see if it works, if not then run that command, then try again...
Anyway I get this running from Alfred:
=== ##################################################### ===
=== Scrivomatic V1.0.10 Report @ 2017-09-16 20:01:06 +0800 ===
Running under Ruby 2.4.1
Working directory: /Users/ian/Desktop/V4_mmd
====== Input Options: ======
#<struct Scrivomatic::OPT input="lu.md", output=nil, to=nil, command="pandocomatic", envpath="/Users/ian/.rvm/wrappers/default:/Library/TeX/texbin:/Users/ian/bin:/usr/local/bin", build=false, verbose=true, dry_run=false>
====== Final ENV PATH: ======
/Users/ian/.rvm/wrappers/default:/Library/TeX/texbin:/Users/ian/bin:/usr/local/bin:/Users/ian/.rvm/gems/ruby-2.4.1/bin:/Users/ian/.rvm/gems/ruby-2.4.1@global/bin:/Users/ian/.rvm/rubies/ruby-2.4.1/bin:/Users/ian/.rvm/bin:/Library/TeX/texbin:/usr/local/bin:/Users/ian/bin:/Users/ian/.pandoc:/usr/bin:/bin:/usr/sbin:/sbin
====== TOOL PATHS: ======
---pandoc: /Users/ian/bin/pandoc | V: 2.0
---pandocomatic: /Users/ian/.rvm/wrappers/default/pandocomatic | V: Pandocomatic version 0.1.4.17
---ruby: /Users/ian/.rvm/wrappers/default/ruby | V: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
---rbenv: /usr/local/bin/rbenv
---rvm: /Users/ian/.rvm/bin/rvm
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex
====== COMMAND OUTPUT: ======
:: Running: /Users/ian/.rvm/wrappers/default/pandocomatic --debug lu.md
::: pandoc --from=markdown \
::: --to=html5 \
::: --standalone \
::: --number-sections \
::: --section-divs \
::: --filter=/Users/ian/.pandoc/filters/removeHR \
::: --template=/Users/ian/.pandoc/templates/custom.html \
::: --css=/Users/ian/.pandoc/templates/custom.css \
::: --dpi=300 \
::: --toc-depth=4 \
::: --base-header-level=1
::: Pandocomatic needed 0.7 seconds to convert 'lu.md'.
:: exit status: pid 22884 exit 0
Ok, now I get this error, looking for pandoc-citeproc-preamble, which I don't get when running scrivomatic or pandocomatic from the command line:
=== ##################################################### ===
=== Scrivomatic V1.0.10 Report @ 2017-09-16 16:31:26 +0100 ===
Running under Ruby 2.4.0
Working directory: $HOME/Desktop/scrivener-pandoc
====== Input Options: ======
#<struct Scrivomatic::OPT input="scrivener-pandoc.md", output=nil, to=nil, command="pandocomatic", envpath="$HOME/.rvm/wrappers/default:/Library/TeX/texbin:$HOME/bin:/usr/local/bin", build=false, verbose=true, dry_run=false>
====== Final ENV PATH: ======
$HOME/.rvm/wrappers/default:/Library/TeX/texbin:$HOME/bin:/usr/local/bin:$HOME/.rvm/gems/ruby-2.4.0/bin:$HOME/.rvm/gems/ruby-2.4.0@global/bin:$HOME/.rvm/rubies/ruby-2.4.0/bin:$HOME/.rvm/bin:/Library/TeX/texbin:/usr/local/bin:$HOME/bin:$HOME/.pandoc:/usr/bin:/bin:/usr/sbin:/sbin
====== TOOL PATHS: ======
---pandoc: /usr/local/bin/pandoc | V: 1.19.2.1
---pandocomatic: $HOME/.rvm/wrappers/default/pandocomatic | V: Pandocomatic version 0.1.4.17
---ruby: $HOME/.rvm/wrappers/default/ruby | V: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin17]
---rvm: $HOME/.rvm/bin/rvm
---python: /usr/bin/python
---xelatex: /Library/TeX/texbin/xelatex
====== COMMAND OUTPUT: ======
:: Running: $HOME/.rvm/wrappers/default/pandocomatic --debug scrivener-pandoc.md
::: pandoc --filter=$HOME/.pandoc/filters/removeHR \
::: --filter=$HOME/.pandoc/filters/authorRemoveHash \
::: --filter=$HOME/.pandoc/filters/pandoc-word-pagebreak \
::: --filter=/usr/local/bin/pandoc-crossref \
::: --filter=/usr/local/bin/pandoc-citeproc \
::: --filter=$HOME/.pandoc/pandoc-citeproc-preamble \
::: --from=markdown \
::: --to=docx \
::: --standalone \
::: --dpi=300 \
::: --reference-docx=$HOME/.pandoc/templates/reference.docx \
::: --number-sections \
::: --bibliography=$HOME/.pandoc/Bibliography.bib \
::: --csl=$HOME/.pandoc/csl/chicago-note-bibliography.csl \
::: --output=./scrivener-pandoc.docx
::: Error running pandoc => error while running:
:::
::: pandoc --filter=$HOME/.pandoc/filters/removeHR \
::: --filter=$HOME/.pandoc/filters/authorRemoveHash \
::: --filter=$HOME/.pandoc/filters/pandoc-word-pagebreak \
::: --filter=/usr/local/bin/pandoc-crossref \
::: --filter=/usr/local/bin/pandoc-citeproc \
::: --filter=$HOME/.pandoc/pandoc-citeproc-preamble \
::: --from=markdown \
::: --to=docx \
::: --standalone \
::: --dpi=300 \
::: --reference-docx=$HOME/.pandoc/templates/reference.docx \
::: --number-sections \
::: --bibliography=$HOME/.pandoc/Bibliography.bib \
::: --csl=$HOME/.pandoc/csl/chicago-note-bibliography.csl \
::: --output=./scrivener-pandoc.docx
:::
::: Pandoc responded with:
:::
::: pandoc: Error running filter $HOME/.pandoc/pandoc-citeproc-preamble:
::: Could not find executable '$HOME/.pandoc/pandoc-citeproc-preamble'.
:::
:: exit status: pid 15618 exit 243!!!---scrivomatic::runCommand() popen2e FAILED TO RUN $HOME/.rvm/wrappers/default/pandocomatic --debug scrivener-pandoc.md !!!
BTW, it appears my pandoc-citeproc-preamble is installed under $HOME/.cabal/bin.
I have added the .cabal/bin folder to the setup path too, does that work?
Success!
On 17 Sep 2017, at 04:42, Ian notifications@github.com wrote:
I have added the .cabal/bin folder to the setup path too, does that work?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks for testing!
I installed Scrivomatic, and it worked fine. I then installed the workflow, but here I am getting an error. It seems that the workflow is looking for Pandocomatic in
/Library/TeX/texbin:$HOME/bin:/usr/local/bin
, as evidenced by its citing V: Pandocomatic version 0.1.4.13. I have updated to 0.1.4.17, which is found instead at$HOME/.rvm/rubies/ruby-2.4.0/bin/
.I added that to the export Path in the script, but to no avail. Running Scrivomatic from the terminal continues to work. Am I missing something or is this a bug?