Skip to content

Instantly share code, notes, and snippets.

@halan
Created December 6, 2011 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halan/1436487 to your computer and use it in GitHub Desktop.
Save halan/1436487 to your computer and use it in GitHub Desktop.
gem 'devise'
gem 'kaminari'
gem 'haml'
gem 'capybara', :group => [:development, :test]
gem 'rspec-rails', :group => [:development, :test]
gem 'haml-rails', :group => [:development, :test]
gem 'hpricot', :group => [:development, :test]
gem 'ruby_parser', :group => [:development, :test]
gem 'web-app-theme', :group => [:development, :test]
run 'bundle install'
generate 'controller', 'home index'
remove_file 'public/index.html'
gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
rake 'db:create'
@project_name = ask 'How call this project?'
generate "web_app_theme:theme --engine=haml --app-name=\"#{@project_name}\""
remove_file 'app/views/layouts/application.html.erb'
gsub_file 'app/views/layouts/application.html.haml', /= javascript_include_tag :defaults, :cache => true/, '= javascript_include_tag :defaults'
generate "web_app_theme:themed home --themed-type=text --engine=haml"
run 'mv app/views/home/show.html.haml app/views/home/index.html.haml'
generate 'web_app_theme:assets'
generate 'devise:install'
generate 'devise user'
application do <<-RUBY
config.to_prepare do
Devise::SessionsController.layout "sign"
Devise::RegistrationsController.layout "sign"
end
RUBY
end
generate "web_app_theme:theme sign --layout-type=sign --engine=haml --app-name=\"#{@project_filename}\""
generate 'devise:views'
rake 'db:migrate'
remove_file 'app/views/devise/sessions/new.html.erb'
create_file 'app/views/devise/sessions/new.html.haml' do <<-RUBY
%h1 #{@project_name}
.block#block-login
%h2 Sign in
.content.login
.flash
- flash.each do |type, message|
%div{ :class => "message \#{type}" }
%p= message
= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => "form login" }) do |f|
.group.wat-cf
.left= f.label :email, :class => "label right"
.right= f.text_field :email, :class => "text_field"
.group.wat-cf
.left= f.label :password, :class => "label right"
.right= f.password_field :password, :class => "text_field"
- if devise_mapping.rememberable?
.group.wat-cf
.right
= f.check_box :remember_me, :class => "checkbox"
= f.label :remember_me, :class => "checkbox"
.group.wat-cf
.right
%button.button{ :type => "submit" }
= image_tag "web-app-theme/icons/key.png"
Login
= render :partial => "devise/shared/links"
RUBY
end
remove_file 'app/views/devise/registrations/new.html.erb'
create_file 'app/views/devise/registrations/new.html.erb' do <<-RUBY
%h1 #{@project_name}
.block#block-signup
%h2 Sign up
.content
.flash
- flash.each do |type, message|
%div{ :class => "message \#{type}" }
%p= message
= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => "form" }) do |f|
.group
= f.label :email, :class => "label"
= f.text_field :email, :class => "text_field"
%span.description Ex. test@example.com
.group
= f.label :password, :class => "label"
= f.password_field :password, :class => "text_field"
%span.description must be at least 6 characters
.group
= f.label :password_confirmation, "Re-enter Password", :class => "label"
= f.password_field :password_confirmation, :class => "text_field"
.group.navform.wat-cf
%button.button{ :type => "submit" }
= image_tag "web-app-theme/icons/tick.png"
Sign up
= render :partial => "devise/shared/links"
RUBY
end
git :init
git :add => '.'
git :commit => "-m Commit inicial"
@halan
Copy link
Author

halan commented Dec 9, 2011

usage:

rails new project_name -t standard_template.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment