-
-
Save renatocarvalho/5147512 to your computer and use it in GitHub Desktop.
Rails App template to create a custom rails app. Just run on terminal:
rails new myrailsapp -T -m https://gist.github.com/renatocarvalho/5147512/raw/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_file 'Gemfile' | |
create_file 'Gemfile' | |
add_source "https://rubygems.org" | |
gem 'rails', '~> 3.2.12' | |
if yes?('PostgreSQL on development?') | |
gem 'pg' | |
create_file 'config/database.yml', force: true do | |
%Q{development: | |
adapter: postgresql | |
database: #{app_name}_development | |
host: localhost | |
user: postgres | |
password: | |
pool: 5 | |
timeout: 5000 | |
template: template0 | |
test: &test | |
adapter: postgresql | |
database: #{app_name}_test | |
host: localhost | |
user: postgres | |
password: | |
pool: 5 | |
timeout: 5000 | |
template: template0 | |
production: | |
adapter: postgresql | |
database: #{app_name}_production | |
host: localhost | |
user: postgres | |
password: | |
pool: 5 | |
timeout: 5000 | |
template: template0 | |
} | |
end | |
else | |
gem 'pg', group: :production | |
gem 'sqlite3', group: :development | |
end | |
if yes?('Install slim?') | |
gem 'slim', '~> 1.3.8' | |
gem 'slim-rails', '~> 1.1.1' | |
remove_file 'app/views/layouts/application.html.erb' | |
create_file 'app/views/layouts/application.slim' do | |
%Q{| <!doctype html> | |
/![if lt IE 7] <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="\#{{I18n.locale}}"> | |
/![if IE 7] <html class="no-js lt-ie9 lt-ie8" lang="\#{{I18n.locale}}"> | |
/![if IE 8] <html class="no-js lt-ie9" lang="\#{{I18n.locale}}"> | |
/! [if gt IE 8]><! | |
html.no-js lang="\#{{I18n.locale}}" | |
/! <![endif] | |
head | |
meta charset="utf-8" | |
meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" | |
- if @title.present? | |
title \#{{@title}} — Startaê Bootstrap | |
- else | |
title Startaê Bootstrap | |
- if @description.present? | |
meta name="description" content="\#{{@description}}" | |
- else | |
meta name="description" content="" | |
meta name="author" content="Startaê — http://startae.com.br" | |
== favicon_link_tag "favicon.png", type: 'image/x-icon' | |
== csrf_meta_tags | |
== render "layouts/facebook_metatags" | |
== stylesheet_link_tag 'application', media: 'all' | |
/[if lt IE 9] | |
== javascript_include_tag :'html5shiv-printshiv' | |
body class="\#{{@page_class}} \#{{@item_menu}}" | |
== render 'layouts/old_browser_warning' | |
== render "layouts/facebook_sdk" | |
== render "layouts/header" | |
== yield | |
== render "layouts/footer" | |
== javascript_include_tag 'application' | |
/[if (gte IE 6)&(lte IE 8)] | |
== javascript_include_tag 'http://s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js' | |
== javascript_include_tag :'selectivizr' | |
== render 'layouts/development' if Rails.env.development? | |
== render 'layouts/google_analytics' if Rails.env.production? | |
} | |
end | |
create_file 'app/views/layouts/_development.slim' do | |
%Q{javascript: | |
document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>') | |
} | |
end | |
create_file 'app/views/layouts/_google_analytics.slim' do | |
%Q{javascript: | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', "\#{ENV['GOOGLE_ANALYTICS_ID']}"]); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
} | |
end | |
create_file 'app/views/layouts/_header.slim' do | |
%Q{header#header role="banner" | |
#header-inner | |
#logo | |
a href="\#{{root_path}}" title="" NOME SITE | |
nav.nav-page role="navigation" | |
ul | |
li.active | |
== link_to("Item 1", "/", title: "Item 1") | |
li | |
== link_to("Item 2", "/", title: "Item 2") | |
nav.nav-user role="navigation" | |
ul | |
li.item-login | |
== link_to("Login", "/", title: "Login") | |
li.item-signup | |
== link_to("Cadastrar Empresa", "/", title: "Cadastrar Empresa") | |
} | |
end | |
create_file 'app/views/layouts/_footer.slim' do | |
%Q{footer#footer-page role="contentinfo" | |
#footer-page-inner | |
.site-links | |
ul | |
li | |
a href="/sobre" title="Sobre" Sobre | |
li | |
a href="http://blog.site.com" rel="external" target="_blank" title="Acesso nosso blog" Blog | |
li | |
a href="/termos" title="Termos" Termos | |
li | |
a href="/privacidade" title="Privacidade" Privacidade | |
li | |
== mail_to '[email protected]', 'Contato', encode: :javascript, replace_at: '_at_', replace_dot: '_dot_', subject: 'Contato pelo site' | |
.social-links | |
ul | |
li.twitter | |
a.ss-icon.ss-social-circle href="https://twitter.com/username" rel="external" target="_blank" title="Siga-nos no Twitter" twitter | |
li.facebook | |
a.ss-icon.ss-social-circle href="http://www.facebook.com/username" rel="external" target="_blank" title="Curta nossa página no Facebook" facebook | |
} | |
end | |
create_file 'app/views/layouts/_facebook_metatags.slim' do | |
%Q{ | |
- if @fb_image | |
meta property="og:image" content="\#{{@fb_image}}" | |
- else | |
meta property="og:image" content="http://www.startae.com.br\#{{asset_path('og-facebook.png')}}" | |
- if @fb_url | |
meta property="og:url" content="\#{{@fb_url}}" | |
- else | |
meta property="og:url" content="http://www.startae.com.br" | |
- if @fb_title | |
meta property="og:title" content="\#{{@fb_title}}" | |
- else | |
meta property="og:title" content="Startaê" | |
- if @fb_description | |
meta property="og:description" content="\#{{@fb_description}}" | |
- else | |
meta property="og:description" content="Descrição" | |
meta property="og:locale" content="pt_BR" | |
meta property="og:type" content="website" | |
meta content="698471633, 588036161, 603613350, 533503309" property="fb:admins" | |
} | |
end | |
create_file 'app/views/layouts/_old_browser_warning.slim' do | |
%Q{ | |
/[if lt IE7] | |
sass: | |
body | |
text-align: center | |
padding-bottom: 60px | |
margin: 0px | |
padding-left: 15px | |
padding-right: 15px | |
font-family: sans-serif | |
color: #222 | |
padding-top: 60px | |
#old-browser-dialog | |
border: #ccc 3px solid | |
margin: 0 auto 80px auto | |
max-width: 860px | |
background: #fff | |
.header | |
margin-top: 0 | |
background: url(/assets/old-browsers/icon-alert.png) no-repeat center top | |
padding-top: 120px | |
.innercol | |
padding-bottom: 20px | |
padding-left: 40px | |
padding-right: 40px | |
padding-top: 20px | |
.footer | |
margin-top: 50px | |
h1, h2, h3, h4, h5 | |
margin: 0px | |
h1 | |
line-height: 28px | |
margin-bottom: 10px | |
letter-spacing: -1px | |
color: #000 | |
font-size: 24px | |
h2 | |
line-height: 21px | |
margin: 0px auto | |
max-width: 600px | |
color: #333 | |
font-size: 15px | |
font-weight: normal | |
h5 | |
color: #666 | |
font-weight: normal | |
p | |
line-height: 21px | |
color: #666 | |
font-size: 14px | |
a | |
color: #477b96 | |
text-decoration: none | |
&:link, &:visited | |
color: #477b96 | |
text-decoration: none | |
&:hover | |
text-decoration: underline | |
&:visited | |
text-decoration: underline | |
ul.downloads | |
padding-bottom: 0px | |
list-style-type: none | |
margin: 40px 0px 20px | |
padding-left: 0px | |
padding-right: 0px | |
overflow: hidden | |
list-style-image: none | |
padding-top: 0px | |
li | |
text-align: center | |
width: 20% | |
float: left | |
div | |
border-left: #efefef 1px solid | |
padding-bottom: 0px | |
padding-left: 0px | |
padding-right: 0px | |
padding-top: 0px | |
&.first | |
border-left: medium none | |
h4 | |
margin: 0px 0px 2px | |
a | |
display: block | |
background: url(/assets/old-browsers/icons-browsers.png) no-repeat center top | |
padding-top: 76px | |
&#download_firefox a | |
background-position: center -144px | |
&#download_chrome a | |
background-position: center -288px | |
&#download_safari a | |
background-position: center -432px | |
&#download_chromeframe a | |
background-position: center -576px | |
#old-browser-dialog | |
.innercol | |
.header | |
h1 Por favor atualize seu navegador para usar este site | |
h2 Construímos este site com as últimas tecnologias. Isso deixa o site mais rápido e fácil de usar. Infelizmente o seu navegador não suporta estas tecnologias maravilhosas. Faça o download de um desses ótimos browsers abaixo e você estará no caminho certo: | |
ul.downloads | |
li | |
.first | |
h4#download_chromeframe | |
a title="Download Google Chrome Frame" href="http://www.google.com/chromeframe" <span>Chrome Frame</span> | |
h5 Para IE 6, 7, 8 | |
li | |
h4#download_ie | |
a title="Download Internet Explorer" href="http://www.microsoft.com/windows/internet-explorer/" <span>Internet Explorer</span> | |
h5 Versão 10+ | |
li | |
h4#download_firefox | |
a title="Download Mozilla Firefox" href="http://www.mozilla.com/firefox/" <span>Mozilla Firefox</span> | |
h5 Versão 10+ | |
li | |
h4#download_chrome | |
a title="Download Google Chrome" href="http://www.google.com/chrome/" <span>Google Chrome</span> | |
h5 Versão 10+ | |
li | |
h4#download_safari | |
a title="Download Apple Safari" href="http://www.apple.com/safari/" <span>Apple Safari</span> | |
h5 Versão 10+ | |
.footer | |
p Já atualizou seu navegador e ainda continua tendo problemas? <a href="mailto:quero@startae.com.br">Fale com a gente</a>. | |
} | |
end | |
create_file 'app/views/layouts/_facebook_sdk.slim' do | |
%Q{#fb-root | |
javascript: | |
(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1&appId=#{ENV['FACEBOOK_APP_ID']}"; | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
} | |
end | |
end | |
gem 'thin' | |
gem 'mini_magick' | |
gem 'carrierwave' | |
gem 'fog' | |
gem 'devise' | |
gem 'friendly_id' | |
gem 'simple_form' | |
if yes?('Install decorators?') | |
gem 'draper' | |
end | |
gem 'rufus-scheduler' | |
gem_group :assets do | |
gem 'compass-rails', '~> 1.0.3' | |
gem 'oily_png', '~> 1.1.0' | |
gem 'sass-rails', '~> 3.2.6' | |
gem 'susy', '~> 1.0.8' | |
gem 'coffee-rails', '~> 3.2.2' | |
gem 'uglifier', '~> 1.3.0' | |
gem 'font_assets', '~> 0.1.7' | |
gem 'jquery-rails', '~> 2.2.1' | |
gem "compass-normalize", "~> 1.4.3" | |
gem "selectivizr-rails", "~> 1.0.1" | |
gem 'html5shiv-rails', :git => 'git://github.com/startae/html5shiv-rails.git', :branch => 'master' | |
gem 'modernizr-rails' | |
end | |
gem_group :development do | |
gem 'foreman' | |
gem 'better_errors' | |
end | |
application do | |
%Q{ | |
config.i18n.default_locale = 'pt-BR' | |
config.time_zone = 'Brasilia' | |
config.generators.stylesheet_engine = :sass | |
config.assets.initialize_on_precompile = false | |
config.generators do |g| | |
g.assets false | |
g.helper false | |
g.view_specs false | |
g.helper_specs false | |
g.controller_specs false | |
end | |
} | |
end | |
insert_into_file 'config/environments/development.rb', "\n$stdout.sync = true", after: 'end' | |
application(nil, env: "development") do | |
%Q{ | |
Slim::Engine.set_default_options pretty: true, sort_attrs: false | |
Slim::Engine.set_default_options format: :html5 | |
Slim::Engine.set_default_options tabsize: 2 | |
config.action_mailer.default_url_options = { host: 'localhost:5000' } | |
} | |
end | |
initializer("heroku_wake_up.rb") do | |
%Q{ | |
require 'rufus/scheduler' | |
scheduler = Rufus::Scheduler.start_new | |
scheduler.every '10m' do | |
require "net/http" | |
require "uri" | |
url = 'http://example.com' | |
Net::HTTP.get_response(URI.parse(url)) | |
end | |
} | |
end | |
create_file 'Procfile', 'web: bundle exec rails server thin -p $PORT' | |
create_file 'config/initializers/carrierwave.rb' do | |
%Q{ | |
CarrierWave.configure do |config| | |
config.cache_dir = Rails.root.join 'tmp', 'uploads' | |
config.fog_credentials = { | |
provider: 'AWS', | |
aws_access_key_id: ENV['S3_KEY'], | |
aws_secret_access_key: ENV['S3_SECRET'], | |
region: ENV['S3_REGION'] | |
} | |
config.fog_directory = ENV['S3_BUCKET'] | |
config.storage = :fog | |
config.enable_processing = false if Rails.env.test? or Rails.env.cucumber? | |
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} | |
end | |
} | |
end | |
create_file '.env' do | |
%Q{ | |
GOOGLE_ANALYTICS_ID=UA-00000000-0 | |
FACEBOOK_APP_ID=000000000000000 | |
FACEBOOK_APP_SECRET=00000000000000000000000000000000 | |
S3_BUCKET=tmp | |
S3_KEY=tmp | |
S3_SECRET=tmp | |
S3_REGION=sa-east-1 | |
} | |
end | |
create_file 'config/locales/pt-br.yml' do | |
%Q{ | |
pt-BR: | |
date: | |
abbr_day_names: | |
- Dom | |
- Seg | |
- Ter | |
- Qua | |
- Qui | |
- Sex | |
- Sáb | |
abbr_month_names: | |
- | |
- Jan | |
- Fev | |
- Mar | |
- Abr | |
- Mai | |
- Jun | |
- Jul | |
- Ago | |
- Set | |
- Out | |
- Nov | |
- Dez | |
day_names: | |
- Domingo | |
- Segunda | |
- Terça | |
- Quarta | |
- Quinta | |
- Sexta | |
- Sábado | |
formats: | |
default: ! '%d/%m/%Y' | |
long: ! '%d de %B de %Y' | |
short: ! '%d de %B' | |
month_names: | |
- | |
- Janeiro | |
- Fevereiro | |
- Março | |
- Abril | |
- Maio | |
- Junho | |
- Julho | |
- Agosto | |
- Setembro | |
- Outubro | |
- Novembro | |
- Dezembro | |
order: | |
- :day | |
- :month | |
- :year | |
datetime: | |
distance_in_words: | |
about_x_hours: | |
one: aproximadamente 1 hora | |
other: aproximadamente %{count} horas | |
about_x_months: | |
one: aproximadamente 1 mês | |
other: aproximadamente %{count} meses | |
about_x_years: | |
one: aproximadamente 1 ano | |
other: aproximadamente %{count} anos | |
almost_x_years: | |
one: quase 1 ano | |
other: quase %{count} anos | |
half_a_minute: meio minuto | |
less_than_x_minutes: | |
one: menos de um minuto | |
other: menos de %{count} minutos | |
less_than_x_seconds: | |
one: menos de 1 segundo | |
other: menos de %{count} segundos | |
over_x_years: | |
one: mais de 1 ano | |
other: mais de %{count} anos | |
x_days: | |
one: 1 dia | |
other: ! '%{count} dias' | |
x_minutes: | |
one: 1 minuto | |
other: ! '%{count} minutos' | |
x_months: | |
one: 1 mês | |
other: ! '%{count} meses' | |
x_seconds: | |
one: 1 segundo | |
other: ! '%{count} segundos' | |
prompts: | |
day: Dia | |
hour: Hora | |
minute: Minuto | |
month: Mês | |
second: Segundo | |
year: Ano | |
errors: &errors | |
format: ! '%{attribute} %{message}' | |
messages: | |
accepted: deve ser aceito | |
blank: não pode ficar em branco | |
confirmation: não está de acordo com a confirmação | |
empty: não pode ficar vazio | |
equal_to: deve ser igual a %{count} | |
even: deve ser par | |
exclusion: não está disponível | |
greater_than: deve ser maior que %{count} | |
greater_than_or_equal_to: deve ser maior ou igual a %{count} | |
inclusion: não está incluído na lista | |
invalid: não é válido | |
less_than: deve ser menor que %{count} | |
less_than_or_equal_to: deve ser menor ou igual a %{count} | |
not_a_number: não é um número | |
not_an_integer: não é um número inteiro | |
odd: deve ser ímpar | |
record_invalid: ! 'A validação falhou: %{errors}' | |
taken: já está em uso | |
too_long: ! 'é muito longo (máximo: %{count} caracteres)' | |
too_short: ! 'é muito curto (mínimo: %{count} caracteres)' | |
wrong_length: não possui o tamanho esperado (%{count} caracteres) | |
template: | |
body: ! 'Por favor, verifique o(s) seguinte(s) campo(s):' | |
header: | |
one: ! 'Não foi possível gravar %{model}: 1 erro' | |
other: ! 'Não foi possível gravar %{model}: %{count} erros.' | |
helpers: | |
select: | |
prompt: Por favor selecione | |
submit: | |
create: Criar %{model} | |
submit: Salvar %{model} | |
update: Atualizar %{model} | |
number: | |
currency: | |
format: | |
delimiter: . | |
format: ! '%u %n' | |
precision: 2 | |
separator: ! ',' | |
significant: false | |
strip_insignificant_zeros: false | |
unit: R$ | |
format: | |
delimiter: . | |
precision: 3 | |
separator: ! ',' | |
significant: false | |
strip_insignificant_zeros: false | |
human: | |
decimal_units: | |
format: ! '%n %u' | |
units: | |
billion: | |
one: bilhão | |
other: bilhões | |
million: | |
one: milhão | |
other: milhões | |
quadrillion: | |
one: quatrilhão | |
other: quatrilhões | |
thousand: mil | |
trillion: | |
one: trilhão | |
other: trilhões | |
unit: '' | |
format: | |
delimiter: . | |
precision: 2 | |
significant: true | |
strip_insignificant_zeros: true | |
storage_units: | |
format: ! '%n %u' | |
units: | |
byte: | |
one: Byte | |
other: Bytes | |
gb: GB | |
kb: KB | |
mb: MB | |
tb: TB | |
percentage: | |
format: | |
delimiter: . | |
precision: | |
format: | |
delimiter: . | |
support: | |
array: | |
last_word_connector: ! ' e ' | |
two_words_connector: ! ' e ' | |
words_connector: ! ', ' | |
time: | |
am: '' | |
formats: | |
default: ! '%A, %d de %B de %Y, %H:%M h' | |
long: ! '%A, %d de %B de %Y, %H:%M h' | |
short: ! '%d/%m, %H:%M h' | |
pm: '' | |
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository | |
activemodel: | |
errors: | |
<<: *errors | |
activerecord: | |
models: | |
user: Usuário | |
attributes: | |
user: | |
password: Senha | |
errors: | |
<<: *errors | |
views: | |
pagination: | |
first: "« Primeira" | |
last: "Última »" | |
previous: "‹ Anterior" | |
next: "Próxima ›" | |
truncate: "..." | |
} | |
end | |
create_file 'config/locales/devise.pt-br.yml' do | |
%Q{ | |
pt-BR: | |
errors: | |
messages: | |
expired: 'expirou, por favor solicite um novo' | |
not_found: 'não encontrado' | |
already_confirmed: 'já foi confirmado, por favor tente fazer login' | |
not_locked: 'não estava bloqueado' | |
not_saved: | |
one: "1 erro impediu que %{resource} fosse salvo:" | |
other: "%{count} erros impediram que %{resource} fosse salvo:" | |
devise: | |
failure: | |
already_authenticated: 'Você já está logado.' | |
unauthenticated: 'Você precisa registrar-se ou fazer login para continuar.' | |
unconfirmed: 'Você deve confirmar sua conta antes de continuar.' | |
locked: 'Sua conta está bloqueada.' | |
invalid: 'E-mail e senha inválidos' | |
invalid_token: 'Token de autenticação inválido.' | |
timeout: 'A sua sessão expirou, por favor faça login novamente para continuar.' | |
inactive: 'A sua conta não foi ativada ainda.' | |
sessions: | |
signed_in: 'Autenticado com sucesso.' | |
signed_out: 'Logout feito com sucesso.' | |
passwords: | |
send_instructions: 'Você receberá um e-mail com instruções sobre como reinicializar sua senha em poucos minutos.' | |
updated: 'Sua senha foi alterada com sucesso. Você está logado agora.' | |
updated_not_active: 'Sua senha foi alterada com sucesso.' | |
send_paranoid_instructions: 'Caso seu e-mail esteja cadastrado, você receberá um link para recuperação de senha no seu e-mail em poucos minutos.' | |
no_token: 'Você não pode acessar esta página sem que seja a partir de um e-mail de reinicialização de senha. Se você chegou aqui através de um e-mail de reinicialização de senha, por favor verifique se você usou a URL completa que foi informada.' | |
confirmations: | |
send_instructions: 'Dentro de minutos você receberá um e-mail com instruções para confirmar a sua conta.' | |
send_paranoid_instructions: 'Caso seu e-mail exista em nossa base, você receberá um e-mail em poucos minutos com instruções sobre como confirmar sua conta.' | |
confirmed: 'Sua conta foi confirmada com sucesso. Você está logado.' | |
registrations: | |
signed_up: 'Bem-vindo! Você se registrou com sucesso.' | |
signed_up_but_unconfirmed: 'Uma mensagem com um link de confirmação foi enviado para o seu e-mail. Por favor, abra o link para ativar sua conta.' | |
signed_up_but_inactive: 'Você se cadastrou com sucesso. Porém, sua conta ainda não está ativada.' | |
signed_up_but_locked: 'Você se cadastrou com sucesso. Porém, sua conta está bloqueada.' | |
updated: 'Você atualizou sua conta com sucesso.' | |
update_needs_confirmation: 'Você atualizou sua conta com sucesso, mas nós precisamos verificar seu endereço de e-mail. Por favor, verifique seus e-mails e clique no link de confirmação para finalizar a criação da sua conta.' | |
destroyed: 'Até mais! Sua conta foi cancelada com sucesso. Esperamos vê-lo novamente em breve.' | |
unlocks: | |
send_instructions: 'Você receberá um e-mail em poucos minutos com instruções sobre como desbloquear sua conta.' | |
unlocked: 'Sua conta foi desbloqueada com sucesso. Por favor, faça login para continuar.' | |
send_paranoid_instructions: 'Caso sua e-mail exista em nossa base, você receberá um e-mail em poucos minutos com instruções sobre como desbloqueá-la.' | |
omniauth_callbacks: | |
success: "Autorizado com sucesso pela conta %{kind}." | |
failure: 'Não foi possível autorizar você através do %{kind} porque "%{reason}".' | |
mailer: | |
confirmation_instructions: | |
subject: 'Instruções para confirmação de conta' | |
reset_password_instructions: | |
subject: 'Instruções para reinicialização de senha' | |
unlock_instructions: | |
subject: 'Instruções para desbloqueio de conta' | |
} | |
end | |
create_file 'app/helpers/devise_helper.rb' do | |
%q{module DeviseHelper | |
def devise_error_messages!(user=nil) | |
user_resource = user.present? ? user : resource | |
return "" if user_resource.errors.empty? | |
messages = user_resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join | |
sentence = I18n.t("errors.messages.not_saved", | |
:count => user_resource.errors.count, | |
:resource => user_resource.class.model_name.human.downcase) | |
html = <<-HTML | |
<div id="error_explanation"> | |
<h2>#{sentence}</h2> | |
<ul>#{messages}</ul> | |
</div> | |
HTML | |
html.html_safe | |
end | |
def resource_name | |
:user | |
end | |
def resource | |
@resource ||= User.new | |
end | |
def devise_mapping | |
@devise_mapping ||= Devise.mappings[:user] | |
end | |
end | |
} | |
end | |
remove_file 'public/index.html' | |
remove_file 'app/assets/images/rails.png' | |
remove_file 'app/assets/javascripts/application.js' | |
remove_file 'app/assets/stylesheets/application.css' | |
create_file 'app/assets/javascripts/application.coffee' do | |
%Q{#= require jquery | |
#= require jquery_ujs | |
} | |
end | |
create_file 'app/assets/stylesheets/application.css.sass' do | |
%Q{@charset "utf-8" | |
@import 'compass' | |
} | |
end | |
create_file '.gitignore' do | |
%Q{.bundle | |
db/*.sqlite3 | |
log/*.log | |
tmp | |
.DS_Store | |
public/uploads | |
worklog | |
lib/.sass-cache/* | |
.sass-cache/* | |
.rvmrc | |
} | |
end | |
run('bundle') | |
generate('controller','home index') | |
route("root to: 'home#index'") | |
generate('controller','frontend index') | |
route("get 'frontend(/index)' => 'frontend#index'") | |
route("get 'frontend/:template' => 'frontend#show'") | |
rake("db:create") | |
git :init | |
git add: "-A" | |
git commit: "-m 'Creating the app'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment