threedaymonk / htmlbeautifier

A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
MIT License
325 stars 59 forks source link

Gives a `No such file or directory` and `block in <top (required)>` errors when executed #20

Closed THPubs closed 9 years ago

THPubs commented 9 years ago

When trying to beautify my files like this htmlbeautifier rb.html.erb rb2.html.erb, it gives the following error :

    /home/pubudu/.rvm/gems/ruby-2.2.0/gems/htmlbeautifier-1.0.0/bin/htmlbeautifier:30:in `read': No such file or directory @ rb_sysopen - rb2.html.erb (Errno::ENOENT)
        from /home/pubudu/.rvm/gems/ruby-2.2.0/gems/htmlbeautifier-1.0.0/bin/htmlbeautifier:30:in `block in <top (required)>'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/gems/htmlbeautifier-1.0.0/bin/htmlbeautifier:29:in `each'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/gems/htmlbeautifier-1.0.0/bin/htmlbeautifier:29:in `<top (required)>'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/bin/htmlbeautifier:23:in `load'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/bin/htmlbeautifier:23:in `<main>'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
        from /home/pubudu/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
threedaymonk commented 9 years ago

The tool has two modes of use. The first is from standard input to standard output, which looks like what you're trying to do:

$ htmlbeautifier < source > destination

The second is to modify each file in place:

$ htmlbeautifier file1 file2 file3

It does look like this could be better explained in the --help output, so I'll improve that.

threedaymonk commented 9 years ago

I've released version 1.0.1 with improved help output.