Skip to content

Commit

Permalink
issue #26 replace files erb to haml
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur Özgür ÖZKAN committed May 9, 2013
1 parent 853260b commit ebff69d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
5 changes: 5 additions & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ def replace_gemfile
copy_file 'Gemfile_new', 'Gemfile'
end

# Internal: Replace erb files with html files
def replace_erb_with_haml
remove_file 'app/views/layouts/application.html.erb'
template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', :force => true
end
end
end
17 changes: 12 additions & 5 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ class AppGenerator < Rails::Generators::AppGenerator
# Internal: Finish template
def finish_template
invoke :customization
invoke :customize_gemfile
super
end

# Internal: Customization template
def customization
invoke :customize_gemfile
invoke :remove_files_we_dont_need
invoke :replace_files
end

# Internal: Customize gemfile
def customize_gemfile
build :replace_gemfile
bundle_command 'install --binstubs=bin/stubs'
end

# Internal: Remove files don't need
Expand All @@ -35,10 +42,10 @@ def remove_files_we_dont_need
build :remove_readme_rdoc
end

# Internal: Customize gemfile
def customize_gemfile
build :replace_gemfile
bundle_command 'install --binstubs=bin/stubs'
# Internal: Replace files
def replace_files
say 'Replace files'
build :replace_erb_with_haml
end

# Internal: Let's not: We'll bundle manually at the right spot.
Expand Down
2 changes: 2 additions & 0 deletions templates/Gemfile_new
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem "haml", "~> 4.0.2"
gem "haml-rails", "~> 0.4"

group :doc do
gem 'sdoc', require: false
Expand Down
9 changes: 9 additions & 0 deletions templates/app/views/layouts/application.html.haml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!!!
%html
%head
%title <%= app_name %>
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= javascript_include_tag "application", "data-turbolinks-track" => true
= csrf_meta_tags
%body
= yield

0 comments on commit ebff69d

Please sign in to comment.