Skip to content

No error checking in haml:erb2haml task #193

Open
@dirschn

Description

@dirschn

I ran the haml:erb2haml task after running gem install html2haml, and apparently html2haml didn't install properly. The task reported that it couldn't find it for each file, yet at the end it acted as though the task completed successfully and asked whether I wanted to delete the original files. I said yes, because this was an unimportant brand new project, and after the task was done all of my views were erased because none of the ones it said were generated actually were generated.

It seems like there could be some checking in the script to at least verify the expected files exist before reporting a success? I'd be happy to take a crack at it, but I'm a little surprised no one else has reported this yet.

rails haml:erb2haml 
--------------------------------------------------------------------------------
Generating HAML for app/views/default/pages/homepage.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/default/pages/show.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/default/shared/_navigation.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/layouts/application.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/layouts/default/application.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/layouts/mailer.html.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
Generating HAML for app/views/layouts/mailer.text.erb...
/home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:265:in `block in replace_bin_path': can't find executable html2haml for gem html2haml. html2haml is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
        from /home/nick/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.5.11/lib/bundler/rubygems_integration.rb:293:in `block in replace_bin_path'
        from /home/nick/.rbenv/versions/3.2.2/bin/html2haml:25:in `<main>'
--------------------------------------------------------------------------------
HAML generated for the following files:
        app/views/default/pages/homepage.html.erb
        app/views/default/pages/show.html.erb
        app/views/default/shared/_navigation.html.erb
        app/views/layouts/application.html.erb
        app/views/layouts/default/application.html.erb
        app/views/layouts/mailer.html.erb
        app/views/layouts/mailer.text.erb
--------------------------------------------------------------------------------
Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)
y
Deleting original .erb files.
--------------------------------------------------------------------------------
Task complete!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions