Coder Social home page Coder Social logo

Comments (51)

nozpheratu avatar nozpheratu commented on September 26, 2024 16

For those using RVM on linux, try:

{
  "ruby": "~/.rvm/bin/rvm-auto-ruby"
}

from beautifyruby.

lizhangyuh avatar lizhangyuh commented on September 26, 2024 4

What worked for me:
1.Add ruby path to beautifyruby sublime user settings
2.Install htmlbeautifie in global gemset:

rvm use (version)@global     
gem install htmlbeautifier

from beautifyruby.

jsgv avatar jsgv commented on September 26, 2024 2

This worked for me

check which ruby version:
which ruby
and update the BeautifyRuby.sublime-settings around line 7:

"ruby": "/usr/bin/env ruby",

to the version you are using

"ruby": "/Users/(your username)/.rvm/rubies/ruby-(your version)/bin/ruby",

from beautifyruby.

stujo avatar stujo commented on September 26, 2024 2

Thanks for the tips! I had to do both to get it working

gem install htmlbeautifier
which ruby

Which gave -> /Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby

and then

{
  "ruby": "/Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby",
}

from beautifyruby.

raecoo avatar raecoo commented on September 26, 2024 1

Do it as following steps will works well both .rb and .html.erb files.

  1. gem install 'htmlbeautifier'
  2. add gem 'htmlbeautifier' to your project Gemfile.
  3. add "ruby": "~/.rbenv/versions/2.1.0/bin/ruby"(maybe RVM) to BeautifyRuby settings.

all done. enjoy it.

from beautifyruby.

CraigWilliams avatar CraigWilliams commented on September 26, 2024

Is that the path to ruby when you execute which ruby ?

from beautifyruby.

tamird avatar tamird commented on September 26, 2024

This exact issue happens to me when installed with package control in sublimetext 3. Moving the package out of package control (extracting the .sublime-package and moving the whole directory to packages) fixes the problem. Weird, huh?

from beautifyruby.

soupdiver avatar soupdiver commented on September 26, 2024

Thanks @tamird moving the folder manually under packages worked!

from beautifyruby.

nglx avatar nglx commented on September 26, 2024

Not working for me either. Is there a chance for a fix to work with package manager?

from beautifyruby.

gaurish avatar gaurish commented on September 26, 2024

I have the same issue. Installed via pkg control in sublimetext 3. And getting check interpreter settings error

from beautifyruby.

phortx avatar phortx commented on September 26, 2024

+1

from beautifyruby.

thaddeusgeek avatar thaddeusgeek commented on September 26, 2024

same with sublime3 and package control

as @tamird says, manually cloning the project to '~/Library/Application Support/Sublime Text 3/Packages' will solve the problem

from beautifyruby.

mscoutermarsh avatar mscoutermarsh commented on September 26, 2024

Same. install via package control in SB3 not working.

Had to manually copy it over.

from beautifyruby.

lifedever avatar lifedever commented on September 26, 2024

how do?

from beautifyruby.

ecbrodie avatar ecbrodie commented on September 26, 2024

I'm also having this issue. I use ST3 and rbenv. Getting the "check your ruby interpreter settings" error message every time. Any ideas?

from beautifyruby.

mscoutermarsh avatar mscoutermarsh commented on September 26, 2024

Do the manual installation.

Go into your packages directory.

git clone git://github.com/CraigWilliams/BeautifyRuby.git

from beautifyruby.

happypeter avatar happypeter commented on September 26, 2024

manual installation did not work for me. I am running st2

from beautifyruby.

zelig avatar zelig commented on September 26, 2024

#63 should fix this

from beautifyruby.

happypeter avatar happypeter commented on September 26, 2024

still not working for me, st2+ubuntu1204

from beautifyruby.

CraigWilliams avatar CraigWilliams commented on September 26, 2024

Is this still not working after @zelig's changes?

from beautifyruby.

happypeter avatar happypeter commented on September 26, 2024

@CraigWilliams not working for me

from beautifyruby.

zelig avatar zelig commented on September 26, 2024

if it is still not working. delete any manual install, and reinstall via package control.
under st2 there shouldn't be a problem

from beautifyruby.

happypeter avatar happypeter commented on September 26, 2024

@zelig NOT working for my ubuntu1204+st2, steps:

  • clean up all manual install stuff
  • install via package control
  • have my St user settings file like this:
{
    "ruby": "/home/peter/.rbenv/shims/ruby"
}

the error remained Error: invalid output. Check your ruby interpreter settings
when I was running this to a .html.erb file

from beautifyruby.

zelig avatar zelig commented on September 26, 2024

see README:

Erb html templates uses Paul Battley's htmlbeautifier gem. This (as well as rubygems) is assumed to be installed as seen by the ruby interpreter. Note that if you beautify and erb file but htmlbeautifier is not found, the error message is 'check your ruby interpreter settings', do not be misled.

from beautifyruby.

lerivin avatar lerivin commented on September 26, 2024

Updating the ruby version path worked for me. Thanks @jesusjjf

from beautifyruby.

zelig avatar zelig commented on September 26, 2024

RTFM :)

On 3 February 2014 05:20, Stuart Jones [email protected] wrote:

Thanks for the tips! I had to do both to get it working

gem install htmlbeautifier

which ruby

Which gave -> /Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby

and then

{
"ruby": "/Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby",}

Reply to this email directly or view it on GitHubhttps://github.com//issues/52#issuecomment-33925469
.

from beautifyruby.

egru avatar egru commented on September 26, 2024

So that fix still wasn't working for me. I narrowed it down to ruby being executed through sublime couldn't load the htmlbeautifier file. This can be seen in this error message:

/home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- htmlbeautifier (LoadError)
from /home/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/user/.config/sublime-text-3/Packages/BeautifyRuby/lib/erbbeautify.rb:1:in <main>'

It's weird, because I took the code from beautify_ruby.py and ran it from the command line and it worked just fine. So this has to be something weird with sublime.

Here's how I fixed it.

First I changed the require line in erbbeautifier.rb from
require 'htmlbeautifier'
to the absolute path of the ruby script
require '/home/user/.rvm/gems/ruby-2.1.0/gems/htmlbeautifier-0.0.9/lib/htmlbeautifier.rb'

I was then getting complaints from ruby about how it couldn't find the required files within htmlbeautifier.rb. I has able to fix this by changing require to require_relative for files within the same directory in htmlbeautifier.rb. With that I had to update all of the lib files with require_relative because they all reference files within the same directory.

So with all that I finally got it working. I'm sure there's probably some easier way to fix it though.

from beautifyruby.

jsmith0684 avatar jsmith0684 commented on September 26, 2024

I'm having problems using BeautifyRuby in Sublime Text 3 under Mac OS 10.7.5 with Ruby 2.1.0. I installed Ruby via RVM and have installed the htmlbeautifier gem. I can properly format .rb files but I get an error stating "Invalid output. Check your Ruby interpreter settings." when attempting to format html.erb files.

I tried egru's fix by requiring htmlbeautifer using the gem's path, but that did not work.

from beautifyruby.

mschewe avatar mschewe commented on September 26, 2024

I have the same problem as @jsmith0684.
I am using rbenv, Ruby 2.1.1, on ArchLinux, Sublime Text 2 Build 2221

gem install htmlbeautifier

rbenv which ruby
/home/mschewe/.rbenv/versions/2.1.1/bin/ruby
{
    "tab_or_space": "space",
    "ruby": "/home/mschewe/.rbenv/versions/2.1.1/bin/ruby",
    "file_patterns": [ "\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile" ],
    "html_erb_patterns": ["\\.html\\.erb"],
    "run_on_save": false,
    "save_on_beautify": false
}

Are there any solutions or suggestions to this problem?

from beautifyruby.

niyazpk avatar niyazpk commented on September 26, 2024

+1

from beautifyruby.

nozpheratu avatar nozpheratu commented on September 26, 2024

Broken for me as well on ST3, tried installing via package control and manually neither seem to work. Also installed the htmlbeutifier gem and updated my path to ruby through the package preferences.

from beautifyruby.

egru avatar egru commented on September 26, 2024

Here's what my erbbeautify.rb file looks like:

require '/home/user/.rvm/gems/ruby-2.1.0/gems/htmlbeautifier-0.0.9/lib/htmlbeautifier.rb'

def beautify(input, output)
  dest = ""
  beautifier = HtmlBeautifier::Beautifier.new(dest)
  begin
    beautifier.scan(input)
    dest << "\n"
  rescue
    dest = ""
  end
  output.write(dest)
end

beautify $stdin.read, $stdout

here's my htmlbeautifier.rb.

require_relative 'htmlbeautifier/beautifier'
require_relative 'htmlbeautifier/version'

within the htmlbeautifier directory there are five files. For beautifier.rb, builder.rb, and html_parser.rb, change require to require_relative in each for every dependency. Hope this helps.

from beautifyruby.

liranY avatar liranY commented on September 26, 2024

hi
i tried everything that was suggested here and it still prints the:
"invalid output. Check your ruby interpreter settings"
i am running sublime 2 on Ubuntu.
please help !

from beautifyruby.

j9recurses avatar j9recurses commented on September 26, 2024

Hi. I also get the error: "invalid output. Check your ruby interpreter settings". Every thing seems to be working for .rb files but not .erb files.

As suggested here, I tried installing htmlbeautifier into my global gem set as well as ergu's solution to manually change the erbbeautify.rb file. Nothing worked.

Any solution for this? I'd love to get this working for my .erb files!
I'm waay too lazy/don't want to format .erb files by hand to make them easy to read. ..My eyes are h- hurting--Please help! I'm on sublime 3 running ubuntu.

from beautifyruby.

b-m-f avatar b-m-f commented on September 26, 2024

I tried everything that was written here. Changed ruby path to path from which ruby and installed htmlbeautifier. Even tried everything with require_relative and direct path to htmlbeautify.

Still getting the same error message.

Ubunt 14.04 and sublime text 3

EDIT:

I found the problem for me.

After trying to beautify the document with htmlbeautifier i got the error code:

Outdented too far on line XX (RuntimeError)

I validated the HTML then and saw that I had a closing tag without an opening tag.

After I changed it everything worked.

If none of the above suggestions help, try validating your HTML code aswell.

from beautifyruby.

techhorn avatar techhorn commented on September 26, 2024

Hello, I'm getting the same problem on ST3. Tried pretty much everything suggested on this page, but I still get the same error. Any suggestions for Ubuntu 12.04 and ST3?

from beautifyruby.

onlinetocode avatar onlinetocode commented on September 26, 2024

thx @nozpheratu, this fixed the erb formatting error for me!

from beautifyruby.

x-ji avatar x-ji commented on September 26, 2024

Changing "ruby" to the absolute path worked for me. I'm using rbenv on Yosemite. Probably related to project-specific version settings.

from beautifyruby.

JohnZucker avatar JohnZucker commented on September 26, 2024

On MacOS 10.8.5 (running Darwin 12.5.0), I had a long time ago created the situation that I had made a 1.9..3 rvm installation which was interfered with by the ruby 1.8.7 installation underneath /System/Library/Frameworks.

This situation also gave rise to 'Invalid output. Check your ruby interpreter settings' as reported above, when installed by cloning from github into Sublime Text 3.

Fortunately, once I had tracked down the 1.9.3 location this was easy to correct by entering
{
"ruby": "~/.rvm/bin/ruby"
}
in ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/BeautifyRuby.sublime-settings

Thanks for all the suggestions above. Fortunately this one was quite easy to fix.

from beautifyruby.

JoshKesling avatar JoshKesling commented on September 26, 2024

Running ubuntu 14.04 LTS, Sublime Text 3, and Ruby 2.2.0. Ran into the same problem. I followed the steps @stujo gave.

In a nutshell:

  • Open your console.
  • Type gem install htmlbeautifier to install the required htmlbeautifier.
  • After that's installed, get your Ruby path and version by typing which ruby. That should return something similar to this: /Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby. Yours will give something different based on your install directory and version, just copy and paste...
  • In Sublime Text 3: Preferences > Package Settings > BeautifyRuby > Settings - Default add this line before the closing }: "ruby": "/Users/stu/.rvm/rubies/ruby-2.1.0/bin/ruby" but paste your path that you copied from the console inside the quotation marks.
  • Make sure to add a , to the end of the previous line before the one you added.

That got mine working. Thanks stujo.

from beautifyruby.

RONNCC avatar RONNCC commented on September 26, 2024

This still doesn't work for me? I'm not even using rvm so i'm just linking to /usr/bin/ruby... I have no problems with .rb files - just .html.erb files

from beautifyruby.

nozpheratu avatar nozpheratu commented on September 26, 2024

@RONNCC Did you install the htmlbeautifier gem as mentioned in the readme?

from beautifyruby.

RONNCC avatar RONNCC commented on September 26, 2024

Yup and I put my ruby path using where and I changed the requires to the
direct path of the htmlbeautifier as suggested above

On Mon, Mar 30, 2015, 12:18 PM nozpheratu [email protected] wrote:

@RONNCC https://github.com/RONNCC Did you install the
https://github.com/threedaymonk/htmlbeautifier http://htmlbeautifier
gem as mentioned in the readme?


Reply to this email directly or view it on GitHub
#52 (comment)
.

from beautifyruby.

RossKinsella avatar RossKinsella commented on September 26, 2024

Tried everything in this post and no luck.

What might be worth noting is I only get the error on saving .html.erb files.

I'm running:

  • OSX
  • Sublime 3
  • Installed from package manager
  • RVM
  • Ruby 2.12.

from beautifyruby.

RONNCC avatar RONNCC commented on September 26, 2024

^ exact same. I only get the error on .html.erb files as well

i'm using Sublime 3 in a Ubuntu 14.04 vm installed from package manager (and then manually) without an RVM and Ruby 2.2.1 i believe

from beautifyruby.

Corstiaan84 avatar Corstiaan84 commented on September 26, 2024

@Josh-Kes his instructions worked for me. Thanks

from beautifyruby.

bobzhen avatar bobzhen commented on September 26, 2024

@stujo Your solution works for me, thanks!!!

from beautifyruby.

prokizzle avatar prokizzle commented on September 26, 2024

I was using chruby, and I had updated my system ruby to 2.1.5 using postmodern's ruby-install. The above solutions did not work, without a little finesse.

What finally worked for me (even after changing the beautifyruby sublime user settings ruby path to /Users/prokizzle/.rubies/ruby-2.1.5/bin/ruby) was running:

/usr/bin/gem install htmlbeautifier

Now everything is great.

from beautifyruby.

krishnasrihari avatar krishnasrihari commented on September 26, 2024

Thanks @lizhangyuh, it works for me.

from beautifyruby.

ronzalo avatar ronzalo commented on September 26, 2024

with rbenv, this works for me
rbenv which ruby
"ruby": "/Users/gonzalomoreno/.rbenv/versions/2.0.0-p353/bin/ruby"

from beautifyruby.

ritaly avatar ritaly commented on September 26, 2024

Doesn't work. I still get the error on .html.erb files "Error: invalid output. Check your ruby interpreter settings"

  • Sublime Text 3
  • OSX (Sierra 10.12.6 )
  • htmlbeautifier - installed
  • "ruby": "/opt/rubies/ruby-2.4.1/bin/ruby"

I tired with installed from package manager & cloned (git clone git://github.com/CraigWilliams/BeautifyRuby.git)

from beautifyruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.