pejuko / coderay_bash

Simple bash scanner for highlighting with coderay.
coderay_bash
MIT License
9 stars 5 forks source link

Does not work from command line #4

Closed ghost closed 12 years ago

ghost commented 12 years ago

Maybe I am doing something wrong, but this is not working for me

$ gem list

*** LOCAL GEMS ***

coderay (1.0.5)
coderay_bash (1.0)

$ coderay -bash coderay.md
CodeRay::Scanners could not load plugin :bash; falling back to :text
pejuko commented 12 years ago

Plugins are registred with coderay after they are required. Standard installation does not know about coderay_bash plugin which is installed in another directory and to use bash scanner you need to require it manually. Therefore to use bash scanner from command line you need to run coderay command using ruby interpreter and pass all extra modules you have installed eg:

ruby -rcoderay_bash `which coderay` -bash my_script.sh
ghost commented 12 years ago

Hm well I was wanting to use this with Jekyll but it looks like that is not an option.

pejuko commented 12 years ago

Plug bash plugin into jekyll like ruby -rcoderay_bash jekyll does not work?

ghost commented 12 years ago

I got it to work with

ruby -Srcoderay_bash jekyll

Thank you sir!

ghost commented 12 years ago

I found a better option for me is to just patch Coderay

gem install coderay_bash
gem cleanup
cd /usr/lib/ruby/gems/1.8/gems/coderay_bash-*
cp -r lib ../coderay-*
cd -
# Jekyll can now find Bash!
jekyll
pejuko commented 12 years ago

In such situation I usually create my own starting script like run-jekyll and put all necessary there and then I don't have to remember copy bash plugin always new version of coderay is released.