-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.rb
182 lines (165 loc) · 4.05 KB
/
template.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# Default gems
gem 'pg'
gem 'therubyracer', platforms: :ruby
gem 'devise', '~> 3.2.4'
gem 'simple_form', '~> 3.1.0.rc1'
gem 'inherited_resources', '~> 1.5.0'
gem 'kaminari', '~> 0.16.1'
gem 'puma', '~> 2.8.2'
gem 'dotenv-deployment', '~> 0.0.2'
gem 'draper', '~> 1.3.0'
sidekiq_installed = false
if yes?('Need background jobs?')
gem 'sinatra', :require => nil
gem 'sidekiq', '~> 3.1.4'
sidekiq_installed = true
if yes?('Need to limit backgound job queue workers?')
gem 'sidekiq-limit_fetch', '~> 2.2.4'
end
end
cancancan_installed = false
if yes?('Need access levels for users?')
gem 'cancancan', '~> 1.8.2'
cancancan_installed = true
end
gem_group :development do
gem 'spring-commands-rspec'
gem 'better_errors'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'rails_layout'
gem 'capistrano', '~> 3.1'
gem 'capistrano-bundler', '>= 1.1.0', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', '~> 1.1', require: false
gem 'capistrano-runit', require: false, github: 'dotpromo/capistrano-runit'
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'guard-bundler', require: false
gem 'terminal-notifier-guard', require: false
gem 'guard-rubocop', require: false
end
gem_group :development, :test do
gem 'annotate', '>=2.6.0'
gem 'ci_reporter', '~> 1.9.0'
gem 'pry-rails'
gem 'dotenv-rails'
gem 'rubocop', require: false
gem 'reek', require: false
gem 'cane', require: false
end
gem_group :test do
gem 'capybara'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'ffaker'
gem 'database_cleaner'
gem 'email_spec'
if sidekiq_installed
gem 'rspec-sidekiq', '~> 1.0.0'
gem 'fakeredis', '~> 0.4.3'
end
gem 'simplecov', require: false, github: 'colszowka/simplecov'
gem 'delorean', '~> 2.1.0'
gem 'shoulda-matchers', '~> 2.6.1'
gem 'brakeman', require: false
end
run 'bundle exec guard init'
run "sed -i \"guard :rspec do\" \"guard :rspec, cmd: 'spring rspec -f doc' do\" Guardfile"
run 'rails g cancan:ability' if cancancan_installed
run 'rails g annotate:install'
run 'bundle exec spring binstub rspec'
run 'rails g kaminari:config'
run 'rails g devise:install'
run 'rails g devise:views'
run 'rails g layout:install'
run 'rails g layout:devise'
run 'rails g simple_form:install --bootstrap'
run 'cap install'
file 'Capfile', <<-CODE
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/runit'
require 'capistrano/runit/sidekiq'
require 'capistrano/runit/puma'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
CODE
file '.gitignore', <<-CODE
/.bundle
/db/*.sqlite3
/db/*.sqlite3-journal
/log/*.log
/tmp
database.yml
doc/
*.swp
*~
.project
.idea
.DS_Store
.coverage
CODE
file '.simplecov', <<-CODE
unless ENV['DISABLE_COVERAGE']
SimpleCov.merge_timeout 12000
SimpleCov.start 'rails' do
add_filter 'app/admin'
add_group "Decorators", "app/decorators"
end
end
CODE
file '.rubocop.yml', <<-CODE
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'bin/**/*'
- 'config/**/*'
- 'script/**/*'
- 'spec/**/*'
Documentation:
Enabled: false
Style/LineLength:
Max: 99
Style/SignalException:
EnforcedStyle: only_raise
SupportedStyles:
- only_raise
Style/MethodLength:
Max: 15
CODE
file 'Rakefile', <<-CODE
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
# Code quality metrics
if %w(development test).include? Rails.env
# rubocop
require 'rubocop/rake_task'
RuboCop::RakeTask.new
task(:default).clear
# reek
require 'reek/rake/task'
Reek::Rake::Task.new do |t|
t.fail_on_error = false
end
# cane
require 'cane/rake_task'
Cane::RakeTask.new do |cane|
cane.abc_max = 15
cane.no_style = false
cane.no_doc = true
cane.style_measure = 99
end
# replace default rake task
task default: [:spec, :rubocop, :reek, :cane]
end
CODE
git :init
git add: '.'
git commit: %Q{ -m 'Initial commit' }