Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BeautifyRuby works for .rb and not for .erb files

I am using ST2 on OSX 10.9.1. I have htmlbeautifier gem installed.I installed BeautifyRuby using Package Control. I have set the ruby path and file patterns in the Default Settings of BeautifyRuby as follows :

{
"tab_or_space": "space",
"ruby": "/Users/(username)/.rvm/rubies/ruby-2.1.0/bin/ruby",
"file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile"],
"html_erb_patterns": ["\\.html\\.erb"],
"run_on_save": true,
"save_on_beautify": false
}

For me BeautifyRuby works for only files with extension .rb and not for files with extension .erb.

When i try to beautify a .erb file i get the following error :

"error: invalid output. check your ruby interpreter settings"

I also tried the same thing with manual installation of BeautifyRuby directly from git. Still gives me the same result.

like image 782
Kirti Thorat Avatar asked Jan 07 '14 17:01

Kirti Thorat


2 Answers

If using rvm:

1- In your BeautifyRuby.sublime-settings

"ruby": "/Users/(user)/.rvm/rubies/ruby-(version)/bin/ruby"

2- Install htmlbeautifie in global gemset.

rvm use (version)@global     
gem install htmlbeautifier

This'll fix your problem..

like image 83
Azzurrio Avatar answered Nov 02 '22 20:11

Azzurrio


I was facing the same issue and I was able to resolve the issue by installing an older version of htmlbeautifier gem:

gem uninstall htmlbeautifier
gem install htmlbeautifier -v 0.0.12

It seems latest version of htmlbeautifier is not compatible with BeautifyRuby.

like image 44
Pranav Prakash Avatar answered Nov 02 '22 20:11

Pranav Prakash