-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdefault-prototype.rb
78 lines (62 loc) · 1.87 KB
/
default-prototype.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
source_paths << File.dirname(__FILE__)
inject_into_file 'Gemfile', after: "source 'https://rubygems.org'\n" do
"ruby File.read '.ruby-version'\n\n"
end
file '.ruby-version', '2.1.0'
gem 'devise'
gem 'twitter-bootstrap-rails'
gem 'will_paginate-bootstrap'
gem 'will_paginate'
gem_group :production do
gem 'thin'
gem 'rails_12factor'
end
#run 'bundle install'
# Disable strong params
application 'config.action_controller.permit_all_parameters = true'
application 'config.action_controller.action_on_unpermitted_parameters = :raise'
# Read me
run 'rm README.rdoc'
file 'README.md', <<-README
## Template for rapid Rails prototypes
* Rails 4
* No tests / specs
* Bootstrap
README
# Bootstrap
generate "bootstrap:install", "static"
generate "bootstrap:layout", "application", "fluid"
copy_file 'prototype/application.html.erb', 'app/views/layouts/application.html.erb'
copy_file 'prototype/bootstrap_and_overrides.css', 'app/assets/stylesheets/bootstrap_and_overrides.css'
# Templates
file 'app/views/shared/_errors.html.erb', <<-ERRORS
<% if object.errors.any? %>
<div class="alert alert-error">
<a class="close" data-dismiss="alert">×</a>
<ul>
<% object.errors.full_messages.each do |msg| %>
<%= content_tag :li, msg %>
<% end %>
</ul>
</div>
<% end %>
ERRORS
# Authentication
generate "devise:install"
generate "devise User"
# Remove turbolinks
gsub_file 'Gemfile', <<-TURBO, ''
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
TURBO
gsub_file 'app/assets/javascripts/application.js', "//= require turbolinks\n", ''
# Clean database.yml
gsub_file 'config/database.yml', / username: \S+\n password:\n/, ''
if yes? 'Is postgres running?'
rake 'db:create db:migrate'
end
route 'root to: "application#show"'
# Git
git :init
git add: "."
git commit: "-a -m 'F1 Prototype'"