// This task will rename your files to the rails 2.0 format, using git mv. Add it to /lib/tasks/rails.rake
1
2 namespace 'views' do
3 desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder, and .haml to .html.haml'
4 task 'rename' do
5 Dir.glob('app/views/**/[^_]*.rhtml').each do |file|
6 puts `git mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
7 end
8
9 Dir.glob('app/views/**/[^_]*.rxml').each do |file|
10 puts `git mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`
11 end
12
13 Dir.glob('app/views/**/[^_]*.rjs').each do |file|
14 puts `git mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`
15 end
16 Dir.glob('app/views/**/[^_]*.haml').each do |file|
17 puts `git mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`
18 end
19 end
20 end