Skip to content

Commit ebff69d

Browse files
author
Onur Özgür ÖZKAN
committed
issue #26 replace files erb to haml
1 parent 853260b commit ebff69d

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

lib/cybele/app_builder.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@ def replace_gemfile
2626
copy_file 'Gemfile_new', 'Gemfile'
2727
end
2828

29+
# Internal: Replace erb files with html files
30+
def replace_erb_with_haml
31+
remove_file 'app/views/layouts/application.html.erb'
32+
template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', :force => true
33+
end
2934
end
3035
end

lib/cybele/generators/app_generator.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ class AppGenerator < Rails::Generators::AppGenerator
1919
# Internal: Finish template
2020
def finish_template
2121
invoke :customization
22-
invoke :customize_gemfile
2322
super
2423
end
2524

2625
# Internal: Customization template
2726
def customization
27+
invoke :customize_gemfile
2828
invoke :remove_files_we_dont_need
29+
invoke :replace_files
30+
end
31+
32+
# Internal: Customize gemfile
33+
def customize_gemfile
34+
build :replace_gemfile
35+
bundle_command 'install --binstubs=bin/stubs'
2936
end
3037

3138
# Internal: Remove files don't need
@@ -35,10 +42,10 @@ def remove_files_we_dont_need
3542
build :remove_readme_rdoc
3643
end
3744

38-
# Internal: Customize gemfile
39-
def customize_gemfile
40-
build :replace_gemfile
41-
bundle_command 'install --binstubs=bin/stubs'
45+
# Internal: Replace files
46+
def replace_files
47+
say 'Replace files'
48+
build :replace_erb_with_haml
4249
end
4350

4451
# Internal: Let's not: We'll bundle manually at the right spot.

templates/Gemfile_new

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ gem 'uglifier', '>= 1.3.0'
77
gem 'coffee-rails', '~> 4.0.0'
88
gem 'jquery-rails'
99
gem 'turbolinks'
10+
gem "haml", "~> 4.0.2"
11+
gem "haml-rails", "~> 0.4"
1012

1113
group :doc do
1214
gem 'sdoc', require: false
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!!!
2+
%html
3+
%head
4+
%title <%= app_name %>
5+
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
6+
= javascript_include_tag "application", "data-turbolinks-track" => true
7+
= csrf_meta_tags
8+
%body
9+
= yield

0 commit comments

Comments
 (0)