orats 0.9.7 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.rubocop.yml +24 -0
- data/.travis.yml +9 -0
- data/README.md +103 -194
- data/bin/orats +2 -5
- data/lib/orats/cli.rb +6 -67
- data/lib/orats/cli_help/destroy +11 -0
- data/lib/orats/cli_help/new +2 -26
- data/lib/orats/commands/new.rb +127 -0
- data/lib/orats/common.rb +0 -29
- data/lib/orats/templates/base/.dockerignore +5 -0
- data/lib/orats/templates/base/.gitignore +22 -0
- data/lib/orats/templates/base/.rubocop.yml +29 -0
- data/lib/orats/templates/base/Dockerfile +102 -0
- data/lib/orats/templates/base/Gemfile +69 -0
- data/lib/orats/templates/base/Gemfile.lock +205 -0
- data/lib/orats/templates/base/README.md +24 -0
- data/lib/orats/templates/base/Rakefile +7 -0
- data/lib/orats/templates/base/app/assets/config/manifest.js +3 -0
- data/lib/orats/templates/base/app/assets/images/.keep +0 -0
- data/lib/orats/templates/base/app/assets/javascripts/application.js +33 -0
- data/lib/orats/templates/base/app/assets/javascripts/cable.js +14 -0
- data/lib/orats/templates/base/app/assets/javascripts/channels/.keep +0 -0
- data/lib/orats/templates/base/app/assets/stylesheets/application.scss +89 -0
- data/lib/orats/templates/base/app/channels/application_cable/channel.rb +4 -0
- data/lib/orats/templates/base/app/channels/application_cable/connection.rb +4 -0
- data/lib/orats/templates/base/app/controllers/application_controller.rb +3 -0
- data/lib/orats/templates/base/app/controllers/concerns/.keep +0 -0
- data/lib/orats/templates/base/app/controllers/pages_controller.rb +4 -0
- data/lib/orats/templates/base/app/helpers/application_helper.rb +31 -0
- data/lib/orats/templates/base/app/helpers/pages_helper.rb +2 -0
- data/lib/orats/templates/base/app/jobs/application_job.rb +2 -0
- data/lib/orats/templates/base/app/mailers/application_mailer.rb +4 -0
- data/lib/orats/templates/base/app/models/application_record.rb +3 -0
- data/lib/orats/templates/base/app/models/concerns/.keep +0 -0
- data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_flash.html.erb +1 -1
- data/lib/orats/templates/base/app/views/layouts/_footer.html.erb +3 -0
- data/lib/orats/templates/{includes/new/rails/app/views/layouts/_google_analytics_snippet.html.erb → base/app/views/layouts/_google_analytics.html.erb} +5 -9
- data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_navigation.html.erb +5 -4
- data/lib/orats/templates/base/app/views/layouts/application.html.erb +48 -0
- data/lib/orats/templates/base/app/views/layouts/mailer.html.erb +13 -0
- data/lib/orats/templates/base/app/views/layouts/mailer.text.erb +1 -0
- data/lib/orats/templates/base/app/views/pages/home.html.erb +46 -0
- data/lib/orats/templates/base/bin/bundle +3 -0
- data/lib/orats/templates/base/bin/rails +4 -0
- data/lib/orats/templates/base/bin/rake +4 -0
- data/lib/orats/templates/base/bin/setup +34 -0
- data/lib/orats/templates/base/bin/update +29 -0
- data/lib/orats/templates/base/cable/config.ru +4 -0
- data/lib/orats/templates/base/config.ru +5 -0
- data/lib/orats/templates/base/config/application.rb +71 -0
- data/lib/orats/templates/base/config/boot.rb +3 -0
- data/lib/orats/templates/base/config/cable.yml +14 -0
- data/lib/orats/templates/base/config/database.yml +13 -0
- data/lib/orats/templates/base/config/environment.rb +5 -0
- data/lib/orats/templates/base/config/environments/development.rb +49 -0
- data/lib/orats/templates/base/config/environments/production.rb +56 -0
- data/lib/orats/templates/base/config/environments/staging.rb +6 -0
- data/lib/orats/templates/base/config/environments/test.rb +40 -0
- data/lib/orats/templates/base/config/initializers/application_controller_renderer.rb +6 -0
- data/lib/orats/templates/base/config/initializers/assets.rb +12 -0
- data/lib/orats/templates/base/config/initializers/backtrace_silencers.rb +9 -0
- data/lib/orats/templates/base/config/initializers/cookies_serializer.rb +5 -0
- data/lib/orats/templates/base/config/initializers/filter_parameter_logging.rb +4 -0
- data/lib/orats/templates/base/config/initializers/inflections.rb +16 -0
- data/lib/orats/templates/base/config/initializers/mime_types.rb +4 -0
- data/lib/orats/templates/base/config/initializers/new_framework_defaults.rb +27 -0
- data/lib/orats/templates/base/config/initializers/session_store.rb +4 -0
- data/lib/orats/templates/{includes/new/rails → base}/config/initializers/sidekiq.rb +1 -4
- data/lib/orats/templates/base/config/initializers/timeout.rb +1 -0
- data/lib/orats/templates/base/config/initializers/wrap_parameters.rb +15 -0
- data/lib/orats/templates/base/config/locales/en.yml +23 -0
- data/lib/orats/templates/base/config/puma.rb +60 -0
- data/lib/orats/templates/base/config/routes.rb +3 -0
- data/lib/orats/templates/{includes/new/rails → base}/config/secrets.yml +3 -2
- data/lib/orats/templates/base/config/sidekiq.yml.erb +5 -0
- data/lib/orats/templates/base/config/spring.rb +6 -0
- data/lib/orats/templates/base/db/seeds.rb +9 -0
- data/lib/orats/templates/base/docker-compose.yml +59 -0
- data/lib/orats/templates/base/lib/assets/.keep +0 -0
- data/lib/orats/templates/base/lib/tasks/.keep +0 -0
- data/lib/orats/templates/base/log/.keep +0 -0
- data/lib/orats/templates/base/public/404.html +67 -0
- data/lib/orats/templates/base/public/422.html +67 -0
- data/lib/orats/templates/base/public/500.html +66 -0
- data/lib/orats/templates/base/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/orats/templates/base/public/apple-touch-icon.png +0 -0
- data/lib/orats/templates/base/public/favicon.ico +0 -0
- data/lib/orats/templates/base/public/robots.txt +5 -0
- data/lib/orats/templates/base/test/controllers/.keep +0 -0
- data/lib/orats/templates/base/test/controllers/pages_controller_test.rb +9 -0
- data/lib/orats/templates/base/test/fixtures/.keep +0 -0
- data/lib/orats/templates/base/test/fixtures/files/.keep +0 -0
- data/lib/orats/templates/base/test/helpers/.keep +0 -0
- data/lib/orats/templates/base/test/integration/.keep +0 -0
- data/lib/orats/templates/base/test/mailers/.keep +0 -0
- data/lib/orats/templates/base/test/models/.keep +0 -0
- data/lib/orats/templates/base/test/test_helper.rb +11 -0
- data/lib/orats/templates/base/tmp/.keep +0 -0
- data/lib/orats/templates/base/vendor/assets/javascripts/.keep +0 -0
- data/lib/orats/templates/base/vendor/assets/stylesheets/.keep +0 -0
- data/lib/orats/ui.rb +5 -5
- data/lib/orats/util.rb +14 -0
- data/lib/orats/version.rb +1 -1
- data/orats.gemspec +3 -2
- data/test/integration/cli_test.rb +43 -65
- data/test/test_helper.rb +9 -58
- metadata +114 -66
- data/lib/orats/argv_adjust.rb +0 -61
- data/lib/orats/cli_help/nuke +0 -19
- data/lib/orats/commands/new/exec.rb +0 -59
- data/lib/orats/commands/new/rails.rb +0 -215
- data/lib/orats/commands/new/server.rb +0 -67
- data/lib/orats/commands/nuke.rb +0 -108
- data/lib/orats/postgres.rb +0 -92
- data/lib/orats/process.rb +0 -35
- data/lib/orats/redis.rb +0 -25
- data/lib/orats/shell.rb +0 -12
- data/lib/orats/templates/auth.rb +0 -394
- data/lib/orats/templates/base.rb +0 -546
- data/lib/orats/templates/includes/common/.gitignore +0 -6
- data/lib/orats/templates/includes/common/LICENSE +0 -22
- data/lib/orats/templates/includes/new/rails/.env +0 -59
- data/lib/orats/templates/includes/new/rails/Gemfile +0 -48
- data/lib/orats/templates/includes/new/rails/Procfile +0 -3
- data/lib/orats/templates/includes/new/rails/README.md +0 -3
- data/lib/orats/templates/includes/new/rails/app/assets/favicon/favicon_base.png +0 -0
- data/lib/orats/templates/includes/new/rails/app/helpers/application_helper.rb +0 -53
- data/lib/orats/templates/includes/new/rails/app/models/account.rb +0 -40
- data/lib/orats/templates/includes/new/rails/app/views/devise/confirmations/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/reset_password_instructions.html.erb +0 -10
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/unlock_instructions.html.erb +0 -8
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/edit.html.erb +0 -28
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/edit.html.erb +0 -51
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/new.html.erb +0 -31
- data/lib/orats/templates/includes/new/rails/app/views/devise/sessions/new.html.erb +0 -39
- data/lib/orats/templates/includes/new/rails/app/views/devise/shared/_links.html.erb +0 -38
- data/lib/orats/templates/includes/new/rails/app/views/devise/unlocks/new.html.erb +0 -26
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_comments_snippet.html.erb +0 -19
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_count_snippet.html.erb +0 -12
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_footer.html.erb +0 -2
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_auth.html.erb +0 -15
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_links.html.erb +0 -3
- data/lib/orats/templates/includes/new/rails/app/views/layouts/application.html.erb +0 -47
- data/lib/orats/templates/includes/new/rails/app/views/pages/home.html.erb +0 -58
- data/lib/orats/templates/includes/new/rails/config/database.yml +0 -6
- data/lib/orats/templates/includes/new/rails/config/environments/staging.rb +0 -5
- data/lib/orats/templates/includes/new/rails/config/initializers/devise_async.rb +0 -1
- data/lib/orats/templates/includes/new/rails/config/initializers/mini_profiler.rb +0 -4
- data/lib/orats/templates/includes/new/rails/config/puma.rb +0 -39
- data/lib/orats/templates/includes/new/rails/config/schedule.rb +0 -3
- data/lib/orats/templates/includes/new/rails/config/sidekiq.yml +0 -7
- data/lib/orats/templates/includes/new/rails/config/sitemap.rb +0 -20
- data/lib/orats/templates/includes/new/rails/config/unicorn.rb +0 -84
- data/lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake +0 -48
- data/lib/orats/templates/includes/new/rails/public/404.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/422.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/500.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/502.html +0 -13
- data/lib/orats/templates/includes/new/rails/public/deploy.html +0 -14
- data/lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml +0 -27
- data/lib/orats/templates/includes/new/rails/test/models/account_test.rb +0 -46
data/lib/orats/templates/base.rb
DELETED
@@ -1,546 +0,0 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
|
3
|
-
# =============================================================================
|
4
|
-
# template for generating an orats base project for rails 4.2.x
|
5
|
-
# =============================================================================
|
6
|
-
# view the task list at the bottom of the file
|
7
|
-
# -----------------------------------------------------------------------------
|
8
|
-
|
9
|
-
# -----------------------------------------------------------------------------
|
10
|
-
# private functions
|
11
|
-
# -----------------------------------------------------------------------------
|
12
|
-
def generate_token
|
13
|
-
SecureRandom.hex(64)
|
14
|
-
end
|
15
|
-
|
16
|
-
def method_to_sentence(method)
|
17
|
-
method.tr!('_', ' ')
|
18
|
-
method[0] = method[0].upcase
|
19
|
-
method
|
20
|
-
end
|
21
|
-
|
22
|
-
def task(message, color = :blue)
|
23
|
-
puts
|
24
|
-
say_status 'task', set_color(message, :bold), color
|
25
|
-
end
|
26
|
-
|
27
|
-
def commit(message)
|
28
|
-
git add: '-A'
|
29
|
-
git commit: "-m '#{message}'"
|
30
|
-
end
|
31
|
-
|
32
|
-
def git_config(field)
|
33
|
-
command = "git config --global user.#{field}"
|
34
|
-
git_field_value = run(command, capture: true).gsub("\n", '')
|
35
|
-
default_value = "YOUR_#{field.upcase}"
|
36
|
-
|
37
|
-
git_field_value.to_s.empty? ? default_value : git_field_value
|
38
|
-
end
|
39
|
-
|
40
|
-
def orats_to_local(source, dest = '')
|
41
|
-
dest = source if dest.empty?
|
42
|
-
|
43
|
-
base_path = "#{File.expand_path File.dirname(__FILE__)}/includes/new/rails"
|
44
|
-
|
45
|
-
run "mkdir -p #{File.dirname(dest)}" unless Dir.exist?(File.dirname(dest))
|
46
|
-
run "cp -f #{base_path}/#{source} #{dest}"
|
47
|
-
end
|
48
|
-
|
49
|
-
# ---
|
50
|
-
|
51
|
-
def initial_commit
|
52
|
-
task __method__
|
53
|
-
|
54
|
-
git :init
|
55
|
-
commit 'Initial git commit'
|
56
|
-
end
|
57
|
-
|
58
|
-
def update_gitignore
|
59
|
-
task __method__
|
60
|
-
|
61
|
-
append_to_file '.gitignore' do
|
62
|
-
<<-S
|
63
|
-
# OS and editor files
|
64
|
-
.DS_Store
|
65
|
-
*/**.DS_Store
|
66
|
-
._*
|
67
|
-
.*.sw*
|
68
|
-
*~
|
69
|
-
.idea/
|
70
|
-
|
71
|
-
# the dotenv file
|
72
|
-
.env
|
73
|
-
|
74
|
-
# app specific folders
|
75
|
-
/vendor/bundle
|
76
|
-
/public/assets/*
|
77
|
-
S
|
78
|
-
end
|
79
|
-
commit 'Add common OS files, editor files and other paths'
|
80
|
-
end
|
81
|
-
|
82
|
-
def copy_gemfile
|
83
|
-
task __method__
|
84
|
-
|
85
|
-
orats_to_local 'Gemfile'
|
86
|
-
commit 'Add Gemfile'
|
87
|
-
end
|
88
|
-
|
89
|
-
def copy_base_favicon
|
90
|
-
task __method__
|
91
|
-
|
92
|
-
orats_to_local 'app/assets/favicon/favicon_base.png'
|
93
|
-
commit 'Add a 256x256 base favicon'
|
94
|
-
end
|
95
|
-
|
96
|
-
def add_dotenv
|
97
|
-
task 'add_dotenv'
|
98
|
-
|
99
|
-
orats_to_local '.env', '.env'
|
100
|
-
gsub_file '.env', 'generate_token', generate_token
|
101
|
-
gsub_file '.env', 'app_name', app_name
|
102
|
-
commit 'Add development environment file'
|
103
|
-
end
|
104
|
-
|
105
|
-
def add_procfile
|
106
|
-
task __method__
|
107
|
-
|
108
|
-
orats_to_local 'Procfile'
|
109
|
-
commit 'Add Procfile'
|
110
|
-
end
|
111
|
-
|
112
|
-
def add_markdown_readme
|
113
|
-
task __method__
|
114
|
-
|
115
|
-
orats_to_local 'README.md'
|
116
|
-
commit 'Add markdown readme'
|
117
|
-
end
|
118
|
-
|
119
|
-
def add_license
|
120
|
-
task __method__
|
121
|
-
|
122
|
-
author_name = git_config 'name'
|
123
|
-
author_email = git_config 'email'
|
124
|
-
|
125
|
-
orats_to_local '../../common/LICENSE', 'LICENSE'
|
126
|
-
gsub_file 'LICENSE', 'Time.now.year', Time.now.year.to_s
|
127
|
-
gsub_file 'LICENSE', 'author_name', author_name
|
128
|
-
gsub_file 'LICENSE', 'author_email', author_email
|
129
|
-
commit 'Add MIT license'
|
130
|
-
end
|
131
|
-
|
132
|
-
def update_app_secrets
|
133
|
-
task __method__
|
134
|
-
|
135
|
-
orats_to_local 'config/secrets.yml'
|
136
|
-
commit 'DRY out the yaml'
|
137
|
-
end
|
138
|
-
|
139
|
-
def update_app_config
|
140
|
-
task __method__
|
141
|
-
|
142
|
-
inject_into_file 'config/application.rb', after: "automatically loaded.\n" do
|
143
|
-
<<-S
|
144
|
-
config.action_mailer.delivery_method = :smtp
|
145
|
-
config.action_mailer.smtp_settings = {
|
146
|
-
:address => ENV['SMTP_ADDRESS'],
|
147
|
-
:port => ENV['SMTP_PORT'].to_i,
|
148
|
-
:domain => ENV['SMTP_DOMAIN'],
|
149
|
-
:user_name => ENV['SMTP_USERNAME'],
|
150
|
-
:password => ENV['SMTP_PASSWORD'],
|
151
|
-
:authentication => ENV['SMTP_AUTH']
|
152
|
-
}
|
153
|
-
|
154
|
-
config.action_mailer.smtp_settings[:enable_starttls_auto] = true if ENV['SMTP_ENCRYPTION'] == 'starttls'
|
155
|
-
config.action_mailer.smtp_settings[:ssl] = true if ENV['SMTP_ENCRYPTION'] == 'ssl'
|
156
|
-
config.action_mailer.default_options = { from: ENV['ACTION_MAILER_DEFAULT_FROM'] }
|
157
|
-
config.action_mailer.default_url_options = { host: ENV['ACTION_MAILER_HOST'] }
|
158
|
-
|
159
|
-
config.cache_store = :redis_store, ENV['CACHE_URL'],
|
160
|
-
{ namespace: '#{app_name}::cache' }
|
161
|
-
|
162
|
-
# run `bundle exec rake time:zones:all` to get a complete list of valid time zone names
|
163
|
-
config.time_zone = ENV['TIME_ZONE'] unless ENV['TIME_ZONE'] == 'UTC'
|
164
|
-
|
165
|
-
# http://www.loc.gov/standards/iso639-2/php/English_list.php
|
166
|
-
config.i18n.default_locale = ENV['DEFAULT_LOCALE'] unless ENV['DEFAULT_LOCALE'] == 'en'
|
167
|
-
|
168
|
-
# Log everything to a single file.
|
169
|
-
config.paths['log'] = ENV['LOG_FILE']
|
170
|
-
|
171
|
-
# Rotate logs daily. This gets overwritten in staging/production by writing
|
172
|
-
# to syslog instead of a log file. Rotating in development prevents your
|
173
|
-
# log file from getting out of control in size.
|
174
|
-
config.logger = Logger.new(config.paths['log'].first, 'daily')
|
175
|
-
S
|
176
|
-
end
|
177
|
-
|
178
|
-
append_file 'config/application.rb' do
|
179
|
-
<<-'S'
|
180
|
-
|
181
|
-
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
|
182
|
-
if html_tag =~ /\<label/
|
183
|
-
html_tag
|
184
|
-
else
|
185
|
-
errors = Array(instance.error_message).join(',')
|
186
|
-
%(#{html_tag}<p class="validation-error"> #{errors}</p>).html_safe
|
187
|
-
end
|
188
|
-
end
|
189
|
-
S
|
190
|
-
end
|
191
|
-
commit 'Configure various application wide settings'
|
192
|
-
end
|
193
|
-
|
194
|
-
def update_database_config
|
195
|
-
task __method__
|
196
|
-
|
197
|
-
orats_to_local 'config/database.yml'
|
198
|
-
commit 'DRY out the yaml'
|
199
|
-
end
|
200
|
-
|
201
|
-
def add_puma_config
|
202
|
-
task __method__
|
203
|
-
|
204
|
-
orats_to_local 'config/puma.rb'
|
205
|
-
gsub_file 'config/puma.rb', 'app_name', app_name
|
206
|
-
commit 'Add the puma config'
|
207
|
-
end
|
208
|
-
|
209
|
-
def add_unicorn_config
|
210
|
-
task __method__
|
211
|
-
|
212
|
-
orats_to_local 'config/unicorn.rb'
|
213
|
-
gsub_file 'config/unicorn.rb', 'app_name', app_name
|
214
|
-
commit 'Add the unicorn config'
|
215
|
-
end
|
216
|
-
|
217
|
-
def add_sidekiq_config
|
218
|
-
task __method__
|
219
|
-
|
220
|
-
orats_to_local 'config/sidekiq.yml'
|
221
|
-
commit 'Add the sidekiq config'
|
222
|
-
end
|
223
|
-
|
224
|
-
def add_sitemap_config
|
225
|
-
task __method__
|
226
|
-
|
227
|
-
orats_to_local 'config/sitemap.rb'
|
228
|
-
gsub_file 'config/sitemap.rb', 'app_name', app_name
|
229
|
-
commit 'Add the sitemap config'
|
230
|
-
end
|
231
|
-
|
232
|
-
def add_whenever_config
|
233
|
-
task __method__
|
234
|
-
|
235
|
-
orats_to_local 'config/schedule.rb'
|
236
|
-
commit 'Add the whenever config'
|
237
|
-
end
|
238
|
-
|
239
|
-
def add_sidekiq_initializer
|
240
|
-
task __method__
|
241
|
-
|
242
|
-
orats_to_local 'config/initializers/sidekiq.rb'
|
243
|
-
gsub_file 'config/initializers/sidekiq.rb', 'ns_app', app_name
|
244
|
-
commit 'Add the sidekiq initializer'
|
245
|
-
end
|
246
|
-
|
247
|
-
def add_mini_profiler_initializer
|
248
|
-
task __method__
|
249
|
-
|
250
|
-
orats_to_local 'config/initializers/mini_profiler.rb'
|
251
|
-
commit 'Add the mini profiler initializer'
|
252
|
-
end
|
253
|
-
|
254
|
-
def add_staging_environment
|
255
|
-
task __method__
|
256
|
-
|
257
|
-
orats_to_local 'config/environments/staging.rb'
|
258
|
-
gsub_file 'config/environments/staging.rb', 'app_name.humanize',
|
259
|
-
app_name.humanize
|
260
|
-
commit 'Add a staging environment'
|
261
|
-
end
|
262
|
-
|
263
|
-
def update_development_environment
|
264
|
-
task __method__
|
265
|
-
|
266
|
-
inject_into_file 'config/environments/development.rb',
|
267
|
-
before: "\nend" do
|
268
|
-
<<-'S'
|
269
|
-
# Set the default generator asset engines
|
270
|
-
config.generators.stylesheet_engine = :scss
|
271
|
-
config.generators.javascript_engine = :coffee
|
272
|
-
S
|
273
|
-
end
|
274
|
-
commit 'Update the default generator asset engines'
|
275
|
-
end
|
276
|
-
|
277
|
-
def update_production_environment
|
278
|
-
task __method__
|
279
|
-
|
280
|
-
inject_into_file 'config/environments/production.rb',
|
281
|
-
before: "Rails.application.configure" do
|
282
|
-
<<-'S'
|
283
|
-
require 'syslog/logger'
|
284
|
-
|
285
|
-
S
|
286
|
-
end
|
287
|
-
|
288
|
-
inject_into_file 'config/environments/production.rb',
|
289
|
-
after: "config.log_level = :debug\n" do
|
290
|
-
<<-S
|
291
|
-
|
292
|
-
# Log to syslog.
|
293
|
-
config.log_tags = [ :subdomain, :uuid ]
|
294
|
-
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('#{app_name}'))
|
295
|
-
S
|
296
|
-
end
|
297
|
-
commit 'Update the logger to be tagged and sent to syslog'
|
298
|
-
|
299
|
-
inject_into_file 'config/initializers/assets.rb',
|
300
|
-
after: "%w( search.js )\n" do
|
301
|
-
<<-'S'
|
302
|
-
Rails.application.config.assets.precompile << Proc.new { |path|
|
303
|
-
if path =~ /\.(eot|svg|ttf|woff|png)\z/
|
304
|
-
true
|
305
|
-
end
|
306
|
-
}
|
307
|
-
S
|
308
|
-
end
|
309
|
-
commit 'Update the assets precompiler to include common file types'
|
310
|
-
end
|
311
|
-
|
312
|
-
def update_routes
|
313
|
-
task __method__
|
314
|
-
|
315
|
-
prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
|
316
|
-
|
317
|
-
inject_into_file 'config/routes.rb', after: "draw do\n" do
|
318
|
-
<<-S
|
319
|
-
concern :pageable do
|
320
|
-
get 'page/:page', action: :index, on: :collection
|
321
|
-
end
|
322
|
-
|
323
|
-
# you may want to protect this behind authentication
|
324
|
-
mount Sidekiq::Web => '/sidekiq'
|
325
|
-
S
|
326
|
-
end
|
327
|
-
commit 'Add a concern for pagination and mount sidekiq'
|
328
|
-
end
|
329
|
-
|
330
|
-
def add_favicon_task
|
331
|
-
task __method__
|
332
|
-
|
333
|
-
orats_to_local 'lib/tasks/orats/favicon.rake'
|
334
|
-
commit 'Add a favicon generator task'
|
335
|
-
end
|
336
|
-
|
337
|
-
def add_helpers
|
338
|
-
task __method__
|
339
|
-
|
340
|
-
orats_to_local 'app/helpers/application_helper.rb'
|
341
|
-
commit 'Add various helpers'
|
342
|
-
end
|
343
|
-
|
344
|
-
def add_layout
|
345
|
-
task __method__
|
346
|
-
|
347
|
-
orats_to_local 'app/views/layouts/application.html.erb'
|
348
|
-
commit 'Add layout'
|
349
|
-
end
|
350
|
-
|
351
|
-
def add_layout_partials
|
352
|
-
task __method__
|
353
|
-
|
354
|
-
orats_to_local 'app/views/layouts/_flash.html.erb'
|
355
|
-
|
356
|
-
orats_to_local 'app/views/layouts/_navigation.html.erb'
|
357
|
-
gsub_file 'app/views/layouts/_navigation.html.erb', 'app_name', app_name
|
358
|
-
|
359
|
-
orats_to_local 'app/views/layouts/_navigation_links.html.erb'
|
360
|
-
|
361
|
-
orats_to_local 'app/views/layouts/_footer.html.erb'
|
362
|
-
gsub_file 'app/views/layouts/_footer.html.erb', 'Time.now.year.to_s',
|
363
|
-
Time.now.year.to_s
|
364
|
-
gsub_file 'app/views/layouts/_footer.html.erb', 'app_name', app_name
|
365
|
-
|
366
|
-
orats_to_local 'app/views/layouts/_google_analytics_snippet.html.erb'
|
367
|
-
|
368
|
-
orats_to_local 'app/views/layouts/_disqus_comments_snippet.html.erb'
|
369
|
-
orats_to_local 'app/views/layouts/_disqus_count_snippet.html.erb'
|
370
|
-
|
371
|
-
commit 'Add layout partials'
|
372
|
-
end
|
373
|
-
|
374
|
-
def add_public_html_pages
|
375
|
-
task __method__
|
376
|
-
|
377
|
-
orats_to_local 'public/404.html'
|
378
|
-
orats_to_local 'public/422.html'
|
379
|
-
orats_to_local 'public/500.html'
|
380
|
-
orats_to_local 'public/502.html'
|
381
|
-
orats_to_local 'public/deploy.html'
|
382
|
-
|
383
|
-
commit 'Add public html pages'
|
384
|
-
end
|
385
|
-
|
386
|
-
def update_sass
|
387
|
-
task __method__
|
388
|
-
|
389
|
-
run 'mv app/assets/stylesheets/application.css app/assets/stylesheets/' + \
|
390
|
-
'application.scss'
|
391
|
-
|
392
|
-
inject_into_file 'app/assets/stylesheets/application.scss',
|
393
|
-
" *= require font-awesome\n",
|
394
|
-
before: " *= require_self\n"
|
395
|
-
append_file 'app/assets/stylesheets/application.scss' do
|
396
|
-
<<-S
|
397
|
-
|
398
|
-
// Core variables and mixins
|
399
|
-
@import "bootstrap/variables";
|
400
|
-
@import "bootstrap/mixins";
|
401
|
-
|
402
|
-
// Reset
|
403
|
-
@import "bootstrap/normalize";
|
404
|
-
@import "bootstrap/print";
|
405
|
-
|
406
|
-
// Core CSS
|
407
|
-
@import "bootstrap/scaffolding";
|
408
|
-
@import "bootstrap/type";
|
409
|
-
@import "bootstrap/code";
|
410
|
-
@import "bootstrap/grid";
|
411
|
-
@import "bootstrap/tables";
|
412
|
-
@import "bootstrap/forms";
|
413
|
-
@import "bootstrap/buttons";
|
414
|
-
|
415
|
-
// Components
|
416
|
-
@import "bootstrap/component-animations";
|
417
|
-
// @import "bootstrap/glyphicons";
|
418
|
-
@import "bootstrap/dropdowns";
|
419
|
-
@import "bootstrap/button-groups";
|
420
|
-
@import "bootstrap/input-groups";
|
421
|
-
@import "bootstrap/navs";
|
422
|
-
@import "bootstrap/navbar";
|
423
|
-
@import "bootstrap/breadcrumbs";
|
424
|
-
@import "bootstrap/pagination";
|
425
|
-
@import "bootstrap/pager";
|
426
|
-
@import "bootstrap/labels";
|
427
|
-
@import "bootstrap/badges";
|
428
|
-
@import "bootstrap/jumbotron";
|
429
|
-
@import "bootstrap/thumbnails";
|
430
|
-
@import "bootstrap/alerts";
|
431
|
-
@import "bootstrap/progress-bars";
|
432
|
-
@import "bootstrap/media";
|
433
|
-
@import "bootstrap/list-group";
|
434
|
-
@import "bootstrap/panels";
|
435
|
-
@import "bootstrap/wells";
|
436
|
-
@import "bootstrap/close";
|
437
|
-
|
438
|
-
// Components w/ JavaScript
|
439
|
-
@import "bootstrap/modals";
|
440
|
-
@import "bootstrap/tooltip";
|
441
|
-
@import "bootstrap/popovers";
|
442
|
-
@import "bootstrap/carousel";
|
443
|
-
|
444
|
-
// Utility classes
|
445
|
-
@import "bootstrap/utilities";
|
446
|
-
@import "bootstrap/responsive-utilities";
|
447
|
-
|
448
|
-
.alert-notice {
|
449
|
-
@extend .alert-success;
|
450
|
-
}
|
451
|
-
|
452
|
-
.alert-alert {
|
453
|
-
@extend .alert-danger;
|
454
|
-
}
|
455
|
-
|
456
|
-
img {
|
457
|
-
@extend .img-responsive;
|
458
|
-
}
|
459
|
-
|
460
|
-
.validation-error {
|
461
|
-
margin-top: 2px;
|
462
|
-
color: $brand-danger;
|
463
|
-
font-size: $font-size-small;
|
464
|
-
}
|
465
|
-
|
466
|
-
html.turbolinks-progress-bar::before {
|
467
|
-
background-color: #aa0000 !important;
|
468
|
-
height: 3px !important;
|
469
|
-
}
|
470
|
-
S
|
471
|
-
end
|
472
|
-
commit 'Add font-awesome, bootstrap and a few default styles'
|
473
|
-
end
|
474
|
-
|
475
|
-
def update_coffeescript
|
476
|
-
task __method__
|
477
|
-
|
478
|
-
gsub_file 'app/assets/javascripts/application.js', "//= require jquery\n", ''
|
479
|
-
commit 'Remove jquery because it is loaded from a CDN'
|
480
|
-
|
481
|
-
inject_into_file 'app/assets/javascripts/application.js',
|
482
|
-
"//= require jquery.turbolinks\n",
|
483
|
-
before: "//= require_tree .\n"
|
484
|
-
inject_into_file 'app/assets/javascripts/application.js',
|
485
|
-
before: "//= require_tree .\n" do
|
486
|
-
<<-S
|
487
|
-
//= require bootstrap/affix
|
488
|
-
//= require bootstrap/alert
|
489
|
-
//= require bootstrap/button
|
490
|
-
//= require bootstrap/carousel
|
491
|
-
//= require bootstrap/collapse
|
492
|
-
//= require bootstrap/dropdown
|
493
|
-
//= require bootstrap/modal
|
494
|
-
//= require bootstrap/tooltip
|
495
|
-
//= require bootstrap/popover
|
496
|
-
//= require bootstrap/scrollspy
|
497
|
-
//= require bootstrap/tab
|
498
|
-
//= require bootstrap/transition
|
499
|
-
S
|
500
|
-
end
|
501
|
-
|
502
|
-
inject_into_file 'app/assets/javascripts/application.js',
|
503
|
-
"\nTurbolinks.enableProgressBar();\n",
|
504
|
-
after: "//= require_tree .\n"
|
505
|
-
commit 'Add jquery.turbolinks and bootstrap'
|
506
|
-
end
|
507
|
-
|
508
|
-
def remove_unused_files_from_git
|
509
|
-
task __method__
|
510
|
-
|
511
|
-
git add: '-u'
|
512
|
-
commit 'Remove unused files'
|
513
|
-
end
|
514
|
-
|
515
|
-
# ---
|
516
|
-
|
517
|
-
initial_commit
|
518
|
-
update_gitignore
|
519
|
-
copy_gemfile
|
520
|
-
copy_base_favicon
|
521
|
-
add_dotenv
|
522
|
-
add_procfile
|
523
|
-
add_markdown_readme
|
524
|
-
add_license
|
525
|
-
update_app_secrets
|
526
|
-
update_app_config
|
527
|
-
update_database_config
|
528
|
-
add_puma_config
|
529
|
-
add_unicorn_config
|
530
|
-
add_sidekiq_config
|
531
|
-
add_sitemap_config
|
532
|
-
add_whenever_config
|
533
|
-
add_sidekiq_initializer
|
534
|
-
add_mini_profiler_initializer
|
535
|
-
add_staging_environment
|
536
|
-
update_development_environment
|
537
|
-
update_production_environment
|
538
|
-
update_routes
|
539
|
-
add_favicon_task
|
540
|
-
add_helpers
|
541
|
-
add_layout
|
542
|
-
add_layout_partials
|
543
|
-
add_public_html_pages
|
544
|
-
update_sass
|
545
|
-
update_coffeescript
|
546
|
-
remove_unused_files_from_git
|