Giter VIP home page Giter VIP logo

erb2haml's Issues

Convert/replace specified files

Hi,

I think it would be nice to have a mode like this

$ rake haml:convert_erbs -- app/views/foo/bar.html.erb

You only give ERB paths you want to convert/replace.

Another mode where confirmation is required could be nice

$ rake haml:convert_erbs --confirm
Do you want to convert "foo/bar.html.erb" ? [Yn] Y
Do you want to convert "foo/baz.html.erb" ? [Yn] n

run erb2haml in lib/

Hi, is there a way to get the rake tasks to lookup the erb templates in Rails.root/lib/engine-name/app/views as well?

cheers, christian

Rails doesn't recognize the rake task.

Hi David, I couldn't use the rake task you've built. The output:

$ rake haml:convert_erbs
(in /home/jose/rails/survay)
rake aborted!
Don't know how to build task 'haml:convert_erbs' 

What should I do to make Rails recognize the task? Thanks.

Fails in windows environment.

Here's a stack trace:

C:\projects\Index>rake haml:replace_erbs --trace
** Invoke haml:replace_erbs (first_time)
** Execute haml:replace_erbs
rake aborted!
Errno::ENOENT: No such file or directory - which html2haml
C:/Ruby193/lib/ruby/gems/1.9.1/gems/erb2haml-0.1.5/lib/erb2haml/railties/erb2haml.rake:46:in ``'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/erb2haml-0.1.5/lib/erb2haml/railties/erb2haml.rake:46:inblock (2 levels) in <top (required)>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in`block in execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in`execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in`mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in`invoke'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in`block (2 levels) in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in`block in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in`top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in`standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in`<top (required)>'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in`

'
Tasks: TOP => haml:replace_erbs

The issue is that in line 46 of the erb2haml.rake file, it does this check:
if which html2haml.empty?

'which' is a linux (and I assume Mac) command. I replaced the 'which' with the windows semi-equivalent 'where' and it worked ok.

Thought you'd like to know that this is an issue.

Error on line 128: Invalid Windows-31J character

Hello.

I am Japanese user and when I run rake haml:convert_erbs, following errors are returned against some erb files.

Error on line 128: Invalid Windows-31J character "\xE6"

(error character is different for each case, such as "\xE6" or "\xE4")

I compiled some erb templates and partials including Japanese characters. But somehow some of them causes error and the others not.

Moreover some says that put a code Encoding.default_external = 'utf-8' to config.ru is efficient and the other says environmental variable LANG should be ja_JP.UTF-8. I've tried both of them but cannot see any improvement.

Could you guess why?

convert_erbs failed

I'm trying to use erb2haml to convert the ".rhtml" files in an old Rails application to HAML, but failed.
Below is the trace:

rake haml:convert_erbs --trace
(in C:/Users/chenfan/workspace/testRails)
** Invoke haml:convert_erbs (first_time)
** Execute haml:convert_erbs
rake aborted!
No such file or directory - which html2haml
C:/Ruby193/lib/ruby/gems/1.9.1/gems/erb2haml-0.1.2/lib/erb2haml/railties/erb2ham
l.rake:16:in ``'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/erb2haml-0.1.2/lib/erb2haml/railties/erb2ham
l.rake:16:inblock (2 levels) in <top (required)>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in`block
in execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in`execut
e'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block
in invoke_with_call_chain'
C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in`mon_synchronize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke
_with_call_chain'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in`invoke
'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
`invoke_task'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in`
block (2 levels) in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in`
block in top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
`standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in`
top_level'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `
block in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
`standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `
run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in`<top (required)
'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in `

'
Tasks: TOP => haml:convert_erbs

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.