orats 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +231 -58
- data/lib/orats/cli.rb +63 -25
- data/lib/orats/commands/common.rb +47 -22
- data/lib/orats/commands/{outdated → diff}/compare.rb +5 -4
- data/lib/orats/commands/diff/exec.rb +86 -0
- data/lib/orats/commands/{outdated → diff}/parse.rb +5 -1
- data/lib/orats/commands/inventory.rb +121 -0
- data/lib/orats/commands/{play.rb → playbook.rb} +5 -5
- data/lib/orats/commands/project/exec.rb +74 -0
- data/lib/orats/commands/{new → project}/rails.rb +57 -81
- data/lib/orats/commands/{new → project}/server.rb +6 -4
- data/lib/orats/templates/auth.rb +26 -481
- data/lib/orats/templates/base.rb +74 -716
- data/lib/orats/templates/includes/common/LICENSE +22 -0
- data/lib/orats/templates/includes/new/rails/.env +43 -0
- data/lib/orats/templates/includes/{Gemfile → new/rails/Gemfile} +1 -1
- data/lib/orats/templates/includes/new/rails/Procfile +3 -0
- data/lib/orats/templates/includes/new/rails/README.md +3 -0
- data/lib/orats/templates/includes/{app → new/rails/app}/assets/favicon/favicon_base.png +0 -0
- data/lib/orats/templates/includes/new/rails/app/helpers/application_helper.rb +53 -0
- data/lib/orats/templates/includes/new/rails/app/models/account.rb +40 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/confirmations/new.html.erb +26 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/reset_password_instructions.html.erb +10 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/unlock_instructions.html.erb +8 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/edit.html.erb +28 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/new.html.erb +26 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/edit.html.erb +51 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/new.html.erb +31 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/sessions/new.html.erb +39 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/shared/_links.html.erb +38 -0
- data/lib/orats/templates/includes/new/rails/app/views/devise/unlocks/new.html.erb +26 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_comments_snippet.html.erb +19 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_count_snippet.html.erb +12 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_flash.html.erb +10 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_footer.html.erb +2 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_google_analytics_snippet.html.erb +13 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_google_analytics_tracker.html.erb +4 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation.html.erb +18 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_auth.html.erb +15 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_links.html.erb +3 -0
- data/lib/orats/templates/includes/new/rails/app/views/layouts/application.html.erb +48 -0
- data/lib/orats/templates/includes/new/rails/app/views/pages/home.html.erb +81 -0
- data/lib/orats/templates/includes/new/rails/config/database.yml +19 -0
- data/lib/orats/templates/includes/new/rails/config/environments/staging.rb +5 -0
- data/lib/orats/templates/includes/new/rails/config/initializers/devise_async.rb +1 -0
- data/lib/orats/templates/includes/new/rails/config/initializers/mini_profiler.rb +4 -0
- data/lib/orats/templates/includes/new/rails/config/initializers/sidekiq.rb +16 -0
- data/lib/orats/templates/includes/new/rails/config/puma.rb +25 -0
- data/lib/orats/templates/includes/new/rails/config/secrets.yml +12 -0
- data/lib/orats/templates/includes/new/rails/config/sidekiq.yml +5 -0
- data/lib/orats/templates/includes/new/rails/config/sitemap.rb +20 -0
- data/lib/orats/templates/includes/new/rails/config/whenever.rb +7 -0
- data/lib/orats/templates/includes/new/rails/lib/backup/config.rb +116 -0
- data/lib/orats/templates/includes/new/rails/lib/backup/models/backup.rb +55 -0
- data/lib/orats/templates/includes/new/rails/lib/tasks/orats/backup.rake +18 -0
- data/lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake +48 -0
- data/lib/orats/templates/includes/new/rails/public/404.html +13 -0
- data/lib/orats/templates/includes/new/rails/public/422.html +13 -0
- data/lib/orats/templates/includes/new/rails/public/500.html +13 -0
- data/lib/orats/templates/includes/new/rails/public/502.html +13 -0
- data/lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml +27 -0
- data/lib/orats/templates/includes/new/rails/test/models/account_test.rb +46 -0
- data/lib/orats/templates/includes/{Galaxyfile → playbook/Galaxyfile} +0 -0
- data/lib/orats/templates/includes/playbook/site.yml +53 -0
- data/lib/orats/templates/playbook.rb +115 -0
- data/lib/orats/version.rb +1 -1
- data/test/integration/cli_test.rb +122 -75
- data/test/test_helper.rb +16 -8
- metadata +63 -14
- data/lib/orats/commands/new/ansible.rb +0 -98
- data/lib/orats/commands/new/exec.rb +0 -60
- data/lib/orats/commands/outdated/exec.rb +0 -46
- data/lib/orats/templates/play.rb +0 -185
data/lib/orats/templates/base.rb
CHANGED
|
@@ -30,12 +30,21 @@ def git_commit(message)
|
|
|
30
30
|
git commit: "-m '#{message}'"
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
def
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
def git_config(field)
|
|
34
|
+
command = "git config --global user.#{field}"
|
|
35
|
+
git_field_value = run(command, capture: true).gsub("\n", '')
|
|
36
|
+
default_value = "YOUR_#{field.upcase}"
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
git_field_value.to_s.empty? ? default_value : git_field_value
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def copy_from_local_gem(source, dest = '')
|
|
42
|
+
dest = source if dest.empty?
|
|
43
|
+
|
|
44
|
+
base_path = "#{File.expand_path File.dirname(__FILE__)}/includes/new/rails"
|
|
45
|
+
|
|
46
|
+
run "mkdir -p #{File.dirname(dest)}" unless Dir.exist?(File.dirname(dest))
|
|
47
|
+
run "cp -f #{base_path}/#{source} #{dest}"
|
|
39
48
|
end
|
|
40
49
|
|
|
41
50
|
# ---
|
|
@@ -74,118 +83,57 @@ end
|
|
|
74
83
|
def copy_gemfile
|
|
75
84
|
log_task __method__
|
|
76
85
|
|
|
77
|
-
|
|
78
|
-
copy_from_local_gem 'Gemfile', 'Gemfile'
|
|
86
|
+
copy_from_local_gem 'Gemfile'
|
|
79
87
|
git_commit 'Add Gemfile'
|
|
80
88
|
end
|
|
81
89
|
|
|
82
90
|
def copy_base_favicon
|
|
83
91
|
log_task __method__
|
|
84
92
|
|
|
85
|
-
copy_from_local_gem 'app/assets/favicon/favicon_base.png'
|
|
86
|
-
'app/assets/favicon/favicon_base.png'
|
|
93
|
+
copy_from_local_gem 'app/assets/favicon/favicon_base.png'
|
|
87
94
|
git_commit 'Add a 256x256 base favicon'
|
|
88
95
|
end
|
|
89
96
|
|
|
90
97
|
def add_dotenv
|
|
91
98
|
log_task 'add_dotenv'
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
PROJECT_PATH: /full/path/to/your/project
|
|
98
|
-
TIME_ZONE: Eastern Time (US & Canada)
|
|
99
|
-
DEFAULT_LOCALE: en
|
|
100
|
-
|
|
101
|
-
GOOGLE_ANALYTICS_UA: ""
|
|
102
|
-
DISQUS_SHORT_NAME: ""
|
|
103
|
-
S3_ACCESS_KEY_ID: ""
|
|
104
|
-
S3_SECRET_ACCESS_KEY: ""
|
|
105
|
-
S3_REGION: ""
|
|
106
|
-
|
|
107
|
-
TOKEN_RAILS_SECRET: #{generate_token}
|
|
108
|
-
|
|
109
|
-
SMTP_ADDRESS: smtp.gmail.com
|
|
110
|
-
SMTP_PORT: 587 # 465 if you use ssl
|
|
111
|
-
SMTP_DOMAIN: gmail.com
|
|
112
|
-
SMTP_USERNAME: #{app_name}@gmail.com
|
|
113
|
-
SMTP_PASSWORD: thebestpassword
|
|
114
|
-
SMTP_AUTH: plain
|
|
115
|
-
SMTP_ENCRYPTION: starttls
|
|
116
|
-
|
|
117
|
-
ACTION_MAILER_HOST: localhost:3000
|
|
118
|
-
ACTION_MAILER_DEFAULT_FROM: info@#{app_name}.com
|
|
119
|
-
ACTION_MAILER_DEFAULT_TO: me@#{app_name}.com
|
|
120
|
-
|
|
121
|
-
DATABASE_NAME: #{app_name}
|
|
122
|
-
DATABASE_HOST: localhost
|
|
123
|
-
DATABASE_POOL: 25
|
|
124
|
-
DATABASE_TIMEOUT: 5000
|
|
125
|
-
DATABASE_USERNAME: postgres
|
|
126
|
-
DATABASE_PASSWORD: supersecrets
|
|
127
|
-
|
|
128
|
-
CACHE_HOST: localhost
|
|
129
|
-
CACHE_PORT: 6379
|
|
130
|
-
CACHE_DATABASE: 0
|
|
131
|
-
CACHE_PASSWORD: ""
|
|
132
|
-
|
|
133
|
-
PUMA_THREADS_MIN: 0
|
|
134
|
-
PUMA_THREADS_MAX: 1
|
|
135
|
-
PUMA_WORKERS: 0
|
|
136
|
-
|
|
137
|
-
SIDEKIQ_CONCURRENCY: 25
|
|
138
|
-
S
|
|
139
|
-
end
|
|
100
|
+
copy_from_local_gem '.env', '.env'
|
|
101
|
+
gsub_file '.env', 'generate_token', generate_token
|
|
102
|
+
gsub_file '.env', 'app_name', app_name
|
|
140
103
|
git_commit 'Add development environment file'
|
|
141
104
|
end
|
|
142
105
|
|
|
143
106
|
def add_procfile
|
|
144
107
|
log_task __method__
|
|
145
108
|
|
|
146
|
-
|
|
147
|
-
<<-S
|
|
148
|
-
web: puma -C config/puma.rb | grep -v --line-buffered ' 304 -'
|
|
149
|
-
worker: sidekiq -C config/sidekiq.yml
|
|
150
|
-
log: tail -f log/development.log | grep -xv --line-buffered '^[[:space:]]*' | grep -v --line-buffered '/assets/'
|
|
151
|
-
S
|
|
152
|
-
end
|
|
109
|
+
copy_from_local_gem 'Procfile'
|
|
153
110
|
git_commit 'Add Procfile'
|
|
154
111
|
end
|
|
155
112
|
|
|
156
113
|
def add_markdown_readme
|
|
157
114
|
log_task __method__
|
|
158
115
|
|
|
159
|
-
|
|
160
|
-
file 'README.md' do
|
|
161
|
-
<<-S
|
|
162
|
-
## Project information
|
|
163
|
-
|
|
164
|
-
This project was generated with [orats](https://github.com/nickjj/orats) vVERSION.
|
|
165
|
-
S
|
|
166
|
-
end
|
|
116
|
+
copy_from_local_gem 'README.md'
|
|
167
117
|
git_commit 'Add markdown readme'
|
|
168
118
|
end
|
|
169
119
|
|
|
170
|
-
def
|
|
120
|
+
def add_license
|
|
171
121
|
log_task __method__
|
|
172
122
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<<-S
|
|
176
|
-
development: &default
|
|
177
|
-
secret_key_base: <%= ENV['TOKEN_RAILS_SECRET'] %>
|
|
123
|
+
author_name = git_config 'name'
|
|
124
|
+
author_email = git_config 'email'
|
|
178
125
|
|
|
179
|
-
|
|
180
|
-
|
|
126
|
+
copy_from_local_gem '../../common/LICENSE', 'LICENSE'
|
|
127
|
+
gsub_file 'LICENSE', 'Time.now.year', Time.now.year.to_s
|
|
128
|
+
gsub_file 'LICENSE', 'author_name', author_name
|
|
129
|
+
gsub_file 'LICENSE', 'author_email', author_email
|
|
130
|
+
git_commit 'Add MIT license'
|
|
131
|
+
end
|
|
181
132
|
|
|
182
|
-
|
|
183
|
-
|
|
133
|
+
def update_app_secrets
|
|
134
|
+
log_task __method__
|
|
184
135
|
|
|
185
|
-
|
|
186
|
-
<<: *default
|
|
187
|
-
S
|
|
188
|
-
end
|
|
136
|
+
copy_from_local_gem 'config/secrets.yml'
|
|
189
137
|
git_commit 'DRY out the yaml'
|
|
190
138
|
end
|
|
191
139
|
|
|
@@ -245,103 +193,28 @@ end
|
|
|
245
193
|
def update_database_config
|
|
246
194
|
log_task __method__
|
|
247
195
|
|
|
248
|
-
|
|
249
|
-
append_file 'config/database.yml' do
|
|
250
|
-
<<-S
|
|
251
|
-
development: &default
|
|
252
|
-
adapter: postgresql
|
|
253
|
-
database: <%= ENV['DATABASE_NAME'] %>
|
|
254
|
-
host: <%= ENV['DATABASE_HOST'] %>
|
|
255
|
-
pool: <%= ENV['DATABASE_POOL'] %>
|
|
256
|
-
timeout: <%= ENV['DATABASE_TIMEOUT'] %>
|
|
257
|
-
username: <%= ENV['DATABASE_USERNAME'] %>
|
|
258
|
-
password: <%= ENV['DATABASE_PASSWORD'] %>
|
|
259
|
-
|
|
260
|
-
test:
|
|
261
|
-
<<: *default
|
|
262
|
-
database: <%= ENV['DATABASE_NAME'] %>_test
|
|
263
|
-
|
|
264
|
-
staging:
|
|
265
|
-
<<: *default
|
|
266
|
-
|
|
267
|
-
production:
|
|
268
|
-
<<: *default
|
|
269
|
-
S
|
|
270
|
-
end
|
|
196
|
+
copy_from_local_gem 'config/database.yml'
|
|
271
197
|
git_commit 'DRY out the yaml'
|
|
272
198
|
end
|
|
273
199
|
|
|
274
200
|
def add_puma_config
|
|
275
201
|
log_task __method__
|
|
276
202
|
|
|
277
|
-
|
|
278
|
-
environment ENV['RAILS_ENV']
|
|
279
|
-
|
|
280
|
-
threads ENV['PUMA_THREADS_MIN'].to_i,ENV['PUMA_THREADS_MAX'].to_i
|
|
281
|
-
workers ENV['PUMA_WORKERS'].to_i
|
|
282
|
-
|
|
283
|
-
pidfile "#{ENV['PROJECT_PATH']}/tmp/puma.pid"
|
|
284
|
-
|
|
285
|
-
if ENV['RAILS_ENV'] == 'production'
|
|
286
|
-
bind "unix://#{ENV['PROJECT_PATH']}/tmp/puma.sock"
|
|
287
|
-
else
|
|
288
|
-
port '3000'
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
# https://github.com/puma/puma/blob/master/examples/config.rb#L125
|
|
292
|
-
prune_bundler
|
|
293
|
-
|
|
294
|
-
restart_command 'bundle exec bin/puma'
|
|
295
|
-
|
|
296
|
-
on_worker_boot do
|
|
297
|
-
require 'active_record'
|
|
298
|
-
|
|
299
|
-
config_path = File.expand_path('../database.yml', __FILE__)
|
|
300
|
-
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
|
|
301
|
-
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML.load_file(config_path)[ENV['RAILS_ENV']])
|
|
302
|
-
end
|
|
303
|
-
S
|
|
203
|
+
copy_from_local_gem 'config/puma.rb'
|
|
304
204
|
git_commit 'Add the puma config'
|
|
305
205
|
end
|
|
306
206
|
|
|
307
207
|
def add_sidekiq_config
|
|
308
208
|
log_task __method__
|
|
309
209
|
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
:pidfile: <%= ENV['PROJECT_PATH'] %>/tmp/sidekiq.pid
|
|
313
|
-
:concurrency: <%= ENV['SIDEKIQ_CONCURRENCY'].to_i %>
|
|
314
|
-
:queues:
|
|
315
|
-
- default
|
|
316
|
-
S
|
|
210
|
+
copy_from_local_gem 'config/sidekiq.yml'
|
|
317
211
|
git_commit 'Add the sidekiq config'
|
|
318
212
|
end
|
|
319
213
|
|
|
320
214
|
def add_sitemap_config
|
|
321
215
|
log_task __method__
|
|
322
216
|
|
|
323
|
-
|
|
324
|
-
# Set the host name for URL creation
|
|
325
|
-
SitemapGenerator::Sitemap.default_host = "http://www.app_name.com"
|
|
326
|
-
|
|
327
|
-
SitemapGenerator::Sitemap.create do
|
|
328
|
-
# Put links creation logic here.
|
|
329
|
-
#
|
|
330
|
-
# The root path '/' and sitemap index file are added automatically for you.
|
|
331
|
-
# Links are added to the Sitemap in the order they are specified.
|
|
332
|
-
#
|
|
333
|
-
# Examples:
|
|
334
|
-
#
|
|
335
|
-
# add root_path
|
|
336
|
-
# add foobar_path, priority: 0.7, changefreq: 'daily'
|
|
337
|
-
#
|
|
338
|
-
# Iteration example:
|
|
339
|
-
#
|
|
340
|
-
# Article.published.find_each do |article|
|
|
341
|
-
# add article_path("#{article.id}-#{article.permalink}"), priority: 0.9, lastmod: article.updated_at
|
|
342
|
-
# end
|
|
343
|
-
end
|
|
344
|
-
S
|
|
217
|
+
copy_from_local_gem 'config/sitemap.rb'
|
|
345
218
|
gsub_file 'config/sitemap.rb', 'app_name', app_name
|
|
346
219
|
git_commit 'Add the sitemap config'
|
|
347
220
|
end
|
|
@@ -349,39 +222,14 @@ end
|
|
|
349
222
|
def add_whenever_config
|
|
350
223
|
log_task __method__
|
|
351
224
|
|
|
352
|
-
|
|
353
|
-
every 1.day, at: '3:00 am' do
|
|
354
|
-
rake 'orats:backup'
|
|
355
|
-
end
|
|
356
|
-
|
|
357
|
-
every 1.day, at: '4:00 am' do
|
|
358
|
-
rake 'sitemap:refresh'
|
|
359
|
-
end
|
|
360
|
-
S
|
|
225
|
+
copy_from_local_gem 'config/whenever.rb'
|
|
361
226
|
git_commit 'Add the whenever config'
|
|
362
227
|
end
|
|
363
228
|
|
|
364
229
|
def add_sidekiq_initializer
|
|
365
230
|
log_task __method__
|
|
366
231
|
|
|
367
|
-
|
|
368
|
-
ENV['CACHE_PASSWORD'].present? ? pass_string = ":#{ENV['CACHE_PASSWORD']}@" : pass_string = ''
|
|
369
|
-
|
|
370
|
-
redis_host = "#{pass_string}#{ENV['CACHE_HOST']}"
|
|
371
|
-
|
|
372
|
-
sidekiq_config = {
|
|
373
|
-
url: "redis://#{redis_host}:#{ENV['CACHE_PORT']}/#{ENV['CACHE_DATABASE']}",
|
|
374
|
-
namespace: "ns_app::sidekiq_#{Rails.env}"
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
Sidekiq.configure_server do |config|
|
|
378
|
-
config.redis = sidekiq_config
|
|
379
|
-
end
|
|
380
|
-
|
|
381
|
-
Sidekiq.configure_client do |config|
|
|
382
|
-
config.redis = sidekiq_config
|
|
383
|
-
end
|
|
384
|
-
S
|
|
232
|
+
copy_from_local_gem 'config/initializers/sidekiq.rb'
|
|
385
233
|
gsub_file 'config/initializers/sidekiq.rb', 'ns_app', app_name
|
|
386
234
|
git_commit 'Add the sidekiq initializer'
|
|
387
235
|
end
|
|
@@ -389,25 +237,16 @@ end
|
|
|
389
237
|
def add_mini_profiler_initializer
|
|
390
238
|
log_task __method__
|
|
391
239
|
|
|
392
|
-
|
|
393
|
-
if defined? Rack::MiniProfiler
|
|
394
|
-
# Toggle with ALT+p
|
|
395
|
-
Rack::MiniProfiler.config.start_hidden = true
|
|
396
|
-
end
|
|
397
|
-
S
|
|
240
|
+
copy_from_local_gem 'config/initializers/mini_profiler.rb'
|
|
398
241
|
git_commit 'Add the mini profiler initializer'
|
|
399
242
|
end
|
|
400
243
|
|
|
401
244
|
def add_staging_environment
|
|
402
245
|
log_task __method__
|
|
403
246
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
#{app_name.humanize}::Application.configure do
|
|
408
|
-
# Overwrite any production settings here, or if you want to start from scratch then remove line 1.
|
|
409
|
-
end
|
|
410
|
-
S
|
|
247
|
+
copy_from_local_gem 'config/environments/staging.rb'
|
|
248
|
+
gsub_file 'config/environments/staging.rb', 'app_name.humanize',
|
|
249
|
+
app_name.humanize
|
|
411
250
|
git_commit 'Add a staging environment'
|
|
412
251
|
end
|
|
413
252
|
|
|
@@ -472,264 +311,22 @@ end
|
|
|
472
311
|
def add_backup_lib
|
|
473
312
|
log_task __method__
|
|
474
313
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
# Backup v4.x Configuration
|
|
478
|
-
#
|
|
479
|
-
# Documentation: http://meskyanichi.github.io/backup
|
|
480
|
-
# Issue Tracker: https://github.com/meskyanichi/backup/issues
|
|
481
|
-
|
|
482
|
-
# Config Options
|
|
483
|
-
#
|
|
484
|
-
# The options here may be overridden on the command line, but the result
|
|
485
|
-
# will depend on the use of --root-path on the command line.
|
|
486
|
-
#
|
|
487
|
-
# If --root-path is used on the command line, then all paths set here
|
|
488
|
-
# will be overridden. If a path (like --tmp-path) is not given along with
|
|
489
|
-
# --root-path, that path will use it's default location _relative to --root-path_.
|
|
490
|
-
#
|
|
491
|
-
# If --root-path is not used on the command line, a path option (like --tmp-path)
|
|
492
|
-
# given on the command line will override the tmp_path set here, but all other
|
|
493
|
-
# paths set here will be used.
|
|
494
|
-
#
|
|
495
|
-
# Note that relative paths given on the command line without --root-path
|
|
496
|
-
# are relative to the current directory. The root_path set here only applies
|
|
497
|
-
# to relative paths set here.
|
|
498
|
-
#
|
|
499
|
-
# ---
|
|
500
|
-
#
|
|
501
|
-
# Sets the root path for all relative paths, including default paths.
|
|
502
|
-
# May be an absolute path, or relative to the current working directory.
|
|
503
|
-
|
|
504
|
-
root_path 'lib/backup'
|
|
505
|
-
|
|
506
|
-
# Sets the path where backups are processed until they're stored.
|
|
507
|
-
# This must have enough free space to hold apx. 2 backups.
|
|
508
|
-
# May be an absolute path, or relative to the current directory or +root_path+.
|
|
509
|
-
|
|
510
|
-
tmp_path '../../tmp'
|
|
511
|
-
|
|
512
|
-
# Sets the path where backup stores persistent information.
|
|
513
|
-
# When Backup's Cycler is used, small YAML files are stored here.
|
|
514
|
-
# May be an absolute path, or relative to the current directory or +root_path+.
|
|
515
|
-
|
|
516
|
-
data_path '../../tmp/backup/data'
|
|
517
|
-
|
|
518
|
-
# Utilities
|
|
519
|
-
#
|
|
520
|
-
# If you need to use a utility other than the one Backup detects,
|
|
521
|
-
# or a utility can not be found in your $PATH.
|
|
522
|
-
#
|
|
523
|
-
# Utilities.configure do
|
|
524
|
-
# tar '/usr/bin/gnutar'
|
|
525
|
-
# redis_cli '/opt/redis/redis-cli'
|
|
526
|
-
# end
|
|
527
|
-
|
|
528
|
-
# Logging
|
|
529
|
-
#
|
|
530
|
-
# Logging options may be set on the command line, but certain settings
|
|
531
|
-
# may only be configured here.
|
|
532
|
-
#
|
|
533
|
-
# Logger.configure do
|
|
534
|
-
# console.quiet = true # Same as command line: --quiet
|
|
535
|
-
# logfile.max_bytes = 2_000_000 # Default: 500_000
|
|
536
|
-
# syslog.enabled = true # Same as command line: --syslog
|
|
537
|
-
# syslog.ident = 'my_app_backup' # Default: 'backup'
|
|
538
|
-
# end
|
|
539
|
-
#
|
|
540
|
-
# Command line options will override those set here.
|
|
541
|
-
# For example, the following would override the example settings above
|
|
542
|
-
# to disable syslog and enable console output.
|
|
543
|
-
# backup perform --trigger my_backup --no-syslog --no-quiet
|
|
544
|
-
|
|
545
|
-
# Component Defaults
|
|
546
|
-
#
|
|
547
|
-
# Set default options to be applied to components in all models.
|
|
548
|
-
# Options set within a model will override those set here.
|
|
549
|
-
#
|
|
550
|
-
# Storage::S3.defaults do |s3|
|
|
551
|
-
# s3.access_key_id = "my_access_key_id"
|
|
552
|
-
# s3.secret_access_key = "my_secret_access_key"
|
|
553
|
-
# end
|
|
554
|
-
#
|
|
555
|
-
# Notifier::Mail.defaults do |mail|
|
|
556
|
-
# mail.from = 'sender@email.com'
|
|
557
|
-
# mail.to = 'receiver@email.com'
|
|
558
|
-
# mail.address = 'smtp.gmail.com'
|
|
559
|
-
# mail.port = 587
|
|
560
|
-
# mail.domain = 'your.host.name'
|
|
561
|
-
# mail.user_name = 'sender@email.com'
|
|
562
|
-
# mail.password = 'my_password'
|
|
563
|
-
# mail.authentication = 'plain'
|
|
564
|
-
# mail.encryption = :starttls
|
|
565
|
-
# end
|
|
566
|
-
|
|
567
|
-
# Preconfigured Models
|
|
568
|
-
#
|
|
569
|
-
# Create custom models with preconfigured components.
|
|
570
|
-
# Components added within the model definition will
|
|
571
|
-
# +add to+ the preconfigured components.
|
|
572
|
-
#
|
|
573
|
-
# preconfigure 'MyModel' do
|
|
574
|
-
# archive :user_pictures do |archive|
|
|
575
|
-
# archive.add '~/pictures'
|
|
576
|
-
# end
|
|
577
|
-
#
|
|
578
|
-
# notify_by Mail do |mail|
|
|
579
|
-
# mail.to = 'admin@email.com'
|
|
580
|
-
# end
|
|
581
|
-
# end
|
|
582
|
-
#
|
|
583
|
-
# MyModel.new(:john_smith, 'John Smith Backup') do
|
|
584
|
-
# archive :user_music do |archive|
|
|
585
|
-
# archive.add '~/music'
|
|
586
|
-
# end
|
|
587
|
-
#
|
|
588
|
-
# notify_by Mail do |mail|
|
|
589
|
-
# mail.to = 'john.smith@email.com'
|
|
590
|
-
# end
|
|
591
|
-
# end
|
|
592
|
-
S
|
|
593
|
-
|
|
594
|
-
file 'lib/backup/models/backup.rb', <<-'S'
|
|
595
|
-
Model.new(:backup, 'Backup for the current RAILS_ENV') do
|
|
596
|
-
split_into_chunks_of 10
|
|
597
|
-
compress_with Gzip
|
|
598
|
-
|
|
599
|
-
database PostgreSQL do |db|
|
|
600
|
-
db.sudo_user = ENV['DATABASE_USERNAME']
|
|
601
|
-
# To dump all databases, set `db.name = :all` (or leave blank)
|
|
602
|
-
db.name = ENV['DATABASE_NAME']
|
|
603
|
-
db.username = ENV['DATABASE_USERNAME']
|
|
604
|
-
db.password = ENV['DATABASE_PASSWORD']
|
|
605
|
-
db.host = ENV['DATABASE_HOST']
|
|
606
|
-
db.port = 5432
|
|
607
|
-
db.socket = '/var/run/postgresql'
|
|
608
|
-
#db.skip_tables = ['skip', 'these', 'tables']
|
|
609
|
-
#db.only_tables = ['only', 'these', 'tables']
|
|
610
|
-
end
|
|
611
|
-
|
|
612
|
-
# uncomment the block below to archive a specific path
|
|
613
|
-
# this may be useful if you have user supplied content
|
|
614
|
-
|
|
615
|
-
# archive :app_archive do |archive|
|
|
616
|
-
# archive.add File.join(ENV['PROJECT_PATH'], 'public', 'system')
|
|
617
|
-
# end
|
|
618
|
-
|
|
619
|
-
# uncomment the block below and fill in the required information
|
|
620
|
-
# to use S3 to store your backups
|
|
621
|
-
|
|
622
|
-
# don't want to use S3? check out the other available options:
|
|
623
|
-
# http://meskyanichi.github.io/backup/v4/storages/
|
|
624
|
-
|
|
625
|
-
# store_with S3 do |s3|
|
|
626
|
-
# s3.access_key_id = ENV['S3_ACCESS_KEY_ID']
|
|
627
|
-
# s3.secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
|
|
628
|
-
# s3.region = ENV['S3_REGION']
|
|
629
|
-
# s3.bucket = 'backup'
|
|
630
|
-
# s3.path = "/database/#{ENV['RAILS_ENV']}"
|
|
631
|
-
# end
|
|
632
|
-
|
|
633
|
-
ENV['SMTP_ENCRYPTION'].empty? ? mail_encryption = 'none' : mail_encryption = ENV['SMTP_ENCRYPTION']
|
|
634
|
-
|
|
635
|
-
notify_by Mail do |mail|
|
|
636
|
-
mail.on_success = false
|
|
637
|
-
#mail.on_warning = true
|
|
638
|
-
mail.on_failure = true
|
|
639
|
-
mail.from = ENV['ACTION_MAILER_DEFAULT_FROM']
|
|
640
|
-
mail.to = ENV['ACTION_MAILER_DEFAULT_TO']
|
|
641
|
-
mail.address = ENV['SMTP_ADDRESS']
|
|
642
|
-
mail.port = ENV['SMTP_PORT'].to_i
|
|
643
|
-
mail.domain = ENV['SMTP_DOMAIN']
|
|
644
|
-
mail.user_name = ENV['SMTP_USERNAME']
|
|
645
|
-
mail.password = ENV['SMTP_PASSWORD']
|
|
646
|
-
mail.authentication = ENV['SMTP_AUTH']
|
|
647
|
-
mail.encryption = mail_encryption.to_sym
|
|
648
|
-
end
|
|
649
|
-
end
|
|
650
|
-
S
|
|
314
|
+
copy_from_local_gem 'lib/backup/config.rb'
|
|
315
|
+
copy_from_local_gem 'lib/backup/models/backup.rb'
|
|
651
316
|
git_commit 'Add backup library'
|
|
652
317
|
end
|
|
653
318
|
|
|
654
319
|
def add_favicon_task
|
|
655
320
|
log_task __method__
|
|
656
321
|
|
|
657
|
-
|
|
658
|
-
namespace :orats do
|
|
659
|
-
desc 'Create favicons from a single base png'
|
|
660
|
-
task :favicons do
|
|
661
|
-
require 'favicon_maker'
|
|
662
|
-
|
|
663
|
-
FaviconMaker.generate do
|
|
664
|
-
setup do
|
|
665
|
-
template_dir Rails.root.join('app', 'assets', 'favicon')
|
|
666
|
-
output_dir Rails.root.join('public')
|
|
667
|
-
end
|
|
668
|
-
|
|
669
|
-
favicon_base_path = "#{template_dir}/favicon_base.png"
|
|
670
|
-
|
|
671
|
-
unless File.exist?(favicon_base_path)
|
|
672
|
-
puts
|
|
673
|
-
puts 'A base favicon could not be found, make sure one exists at:'
|
|
674
|
-
puts favicon_base_path
|
|
675
|
-
puts
|
|
676
|
-
exit 1
|
|
677
|
-
end
|
|
678
|
-
|
|
679
|
-
from File.basename(favicon_base_path) do
|
|
680
|
-
icon 'speeddial-160x160.png'
|
|
681
|
-
icon 'apple-touch-icon-228x228-precomposed.png'
|
|
682
|
-
icon 'apple-touch-icon-152x152-precomposed.png'
|
|
683
|
-
icon 'apple-touch-icon-144x144-precomposed.png'
|
|
684
|
-
icon 'apple-touch-icon-120x120-precomposed.png'
|
|
685
|
-
icon 'apple-touch-icon-114x114-precomposed.png'
|
|
686
|
-
icon 'apple-touch-icon-76x76-precomposed.png'
|
|
687
|
-
icon 'apple-touch-icon-72x72-precomposed.png'
|
|
688
|
-
icon 'apple-touch-icon-60x60-precomposed.png'
|
|
689
|
-
icon 'apple-touch-icon-57x57-precomposed.png'
|
|
690
|
-
icon 'favicon-196x196.png'
|
|
691
|
-
icon 'favicon-160x160.png'
|
|
692
|
-
icon 'favicon-96x96.png'
|
|
693
|
-
icon 'favicon-64x64.png'
|
|
694
|
-
icon 'favicon-32x32.png'
|
|
695
|
-
icon 'favicon-24x24.png'
|
|
696
|
-
icon 'favicon-16x16.png'
|
|
697
|
-
icon 'favicon.ico', size: '64x64,32x32,24x24,16x16'
|
|
698
|
-
end
|
|
699
|
-
|
|
700
|
-
each_icon do |filepath|
|
|
701
|
-
puts "Creating favicon @ #{filepath}"
|
|
702
|
-
end
|
|
703
|
-
end
|
|
704
|
-
end
|
|
705
|
-
end
|
|
706
|
-
S
|
|
322
|
+
copy_from_local_gem 'lib/tasks/orats/favicon.rake'
|
|
707
323
|
git_commit 'Add a favicon generator task'
|
|
708
324
|
end
|
|
709
325
|
|
|
710
326
|
def add_backup_task
|
|
711
327
|
log_task __method__
|
|
712
328
|
|
|
713
|
-
|
|
714
|
-
namespace :orats do
|
|
715
|
-
desc 'Create a backup of your application for a specific environment'
|
|
716
|
-
task :backup do
|
|
717
|
-
if File.exist?('.env') && File.file?('.env')
|
|
718
|
-
require 'dotenv'
|
|
719
|
-
Dotenv.load
|
|
720
|
-
source_external_env = ''
|
|
721
|
-
else
|
|
722
|
-
source_external_env = '. /etc/default/app_name &&'
|
|
723
|
-
end
|
|
724
|
-
|
|
725
|
-
# hack'ish way to run the backup command with elevated privileges, it won't prompt for a password on the production
|
|
726
|
-
# server because passwordless sudo has been enabled if you use the ansible setup provided by orats
|
|
727
|
-
system 'sudo whoami'
|
|
728
|
-
|
|
729
|
-
system "#{source_external_env} backup perform -t backup -c '#{File.join('lib', 'backup', 'config.rb')}' --log-path='#{File.join('log')}'"
|
|
730
|
-
end
|
|
731
|
-
end
|
|
732
|
-
S
|
|
329
|
+
copy_from_local_gem 'lib/tasks/orats/backup.rake'
|
|
733
330
|
gsub_file 'lib/tasks/orats/backup.rake', 'app_name', app_name
|
|
734
331
|
git_commit 'Add an application backup task'
|
|
735
332
|
end
|
|
@@ -737,289 +334,49 @@ end
|
|
|
737
334
|
def add_helpers
|
|
738
335
|
log_task __method__
|
|
739
336
|
|
|
740
|
-
|
|
741
|
-
<<-S
|
|
742
|
-
def title(page_title)
|
|
743
|
-
content_for(:title) { page_title }
|
|
744
|
-
end
|
|
745
|
-
|
|
746
|
-
def meta_description(page_meta_description)
|
|
747
|
-
content_for(:meta_description) { page_meta_description }
|
|
748
|
-
end
|
|
749
|
-
|
|
750
|
-
def heading(page_heading)
|
|
751
|
-
content_for(:heading) { page_heading }
|
|
752
|
-
end
|
|
753
|
-
|
|
754
|
-
def link_to_all_favicons
|
|
755
|
-
'<link href="speeddial-160x160.png" rel="icon" type="image/png" />
|
|
756
|
-
<link href="apple-touch-icon-228x228-precomposed.png" rel="apple-touch-icon-precomposed" sizes="228x228" type="image/png" />
|
|
757
|
-
<link href="apple-touch-icon-152x152-precomposed.png" rel="apple-touch-icon-precomposed" sizes="152x152" type="image/png" />
|
|
758
|
-
<link href="apple-touch-icon-144x144-precomposed.png" rel="apple-touch-icon-precomposed" sizes="144x144" type="image/png" />
|
|
759
|
-
<link href="apple-touch-icon-120x120-precomposed.png" rel="apple-touch-icon-precomposed" sizes="120x120" type="image/png" />
|
|
760
|
-
<link href="apple-touch-icon-114x114-precomposed.png" rel="apple-touch-icon-precomposed" sizes="114x114" type="image/png" />
|
|
761
|
-
<link href="apple-touch-icon-76x76-precomposed.png" rel="apple-touch-icon-precomposed" sizes="76x76" type="image/png" />
|
|
762
|
-
<link href="apple-touch-icon-72x72-precomposed.png" rel="apple-touch-icon-precomposed" sizes="72x72" type="image/png" />
|
|
763
|
-
<link href="apple-touch-icon-60x60-precomposed.png" rel="apple-touch-icon-precomposed" sizes="60x60" type="image/png" />
|
|
764
|
-
<link href="apple-touch-icon-57x57-precomposed.png" rel="apple-touch-icon-precomposed" sizes="57x57" type="image/png" />
|
|
765
|
-
<link href="favicon-196x196.png" rel="icon" sizes="196x196" type="image/png" />
|
|
766
|
-
<link href="favicon-160x160.png" rel="icon" sizes="160x160" type="image/png" />
|
|
767
|
-
<link href="favicon-96x96.png" rel="icon" sizes="96x96" type="image/png" />
|
|
768
|
-
<link href="favicon-64x64.png" rel="icon" sizes="64x64" type="image/png" />
|
|
769
|
-
<link href="favicon-32x32.png" rel="icon" sizes="32x32" type="image/png" />
|
|
770
|
-
<link href="favicon-24x24.png" rel="icon" sizes="24x24" type="image/png" />
|
|
771
|
-
<link href="favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" />
|
|
772
|
-
<link href="favicon.ico" rel="icon" type="image/x-icon" />
|
|
773
|
-
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />'.html_safe
|
|
774
|
-
end
|
|
775
|
-
|
|
776
|
-
def humanize_boolean(input)
|
|
777
|
-
input ||= ''
|
|
778
|
-
case input.to_s.downcase
|
|
779
|
-
when 't', 'true'
|
|
780
|
-
'Yes'
|
|
781
|
-
else
|
|
782
|
-
'No'
|
|
783
|
-
end
|
|
784
|
-
end
|
|
785
|
-
|
|
786
|
-
def css_for_boolean(input)
|
|
787
|
-
if input
|
|
788
|
-
'success'
|
|
789
|
-
else
|
|
790
|
-
'danger'
|
|
791
|
-
end
|
|
792
|
-
end
|
|
793
|
-
S
|
|
794
|
-
end
|
|
337
|
+
copy_from_local_gem 'app/helpers/application_helper.rb'
|
|
795
338
|
git_commit 'Add various helpers'
|
|
796
339
|
end
|
|
797
340
|
|
|
798
341
|
def add_layout
|
|
799
342
|
log_task __method__
|
|
800
343
|
|
|
801
|
-
|
|
802
|
-
file 'app/views/layouts/application.html.erb', <<-S
|
|
803
|
-
<!doctype html>
|
|
804
|
-
<html lang="en">
|
|
805
|
-
<head>
|
|
806
|
-
<title><%= yield :title %></title>
|
|
807
|
-
<meta charset="utf-8" />
|
|
808
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
809
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
810
|
-
<meta name="description" content="<%= yield :meta_description %>" />
|
|
811
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
|
812
|
-
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
|
|
813
|
-
'application', 'data-turbolinks-track' => true %>
|
|
814
|
-
<%= csrf_meta_tags %>
|
|
815
|
-
<%= link_to_all_favicons %>
|
|
816
|
-
<!--[if lt IE 9]>
|
|
817
|
-
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7/html5shiv.js"></script>
|
|
818
|
-
<script src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.0/json3.min.js"></script>
|
|
819
|
-
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
|
|
820
|
-
<![endif]-->
|
|
821
|
-
<%= render 'layouts/google_analytics_snippet' %>
|
|
822
|
-
</head>
|
|
823
|
-
|
|
824
|
-
<body>
|
|
825
|
-
<%= render 'layouts/google_analytics_tracker' %>
|
|
826
|
-
<header>
|
|
827
|
-
<%= render 'layouts/navigation' %>
|
|
828
|
-
</header>
|
|
829
|
-
|
|
830
|
-
<main role="main" class="container">
|
|
831
|
-
<div class="page-header">
|
|
832
|
-
<h1><%= yield :heading %></h1>
|
|
833
|
-
</div>
|
|
834
|
-
<%= render 'layouts/flash' %>
|
|
835
|
-
<%= yield %>
|
|
836
|
-
</main>
|
|
837
|
-
|
|
838
|
-
<footer>
|
|
839
|
-
<hr />
|
|
840
|
-
<div class="container">
|
|
841
|
-
<%= render 'layouts/footer' %>
|
|
842
|
-
</div>
|
|
843
|
-
</footer>
|
|
844
|
-
|
|
845
|
-
<%= render 'layouts/disqus_count_snippet' %>
|
|
846
|
-
</body>
|
|
847
|
-
</html>
|
|
848
|
-
S
|
|
344
|
+
copy_from_local_gem 'app/views/layouts/application.html.erb'
|
|
849
345
|
git_commit 'Add layout'
|
|
850
346
|
end
|
|
851
347
|
|
|
852
348
|
def add_layout_partials
|
|
853
349
|
log_task __method__
|
|
854
350
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
<span class="sr-only">Toggle navigation</span>
|
|
874
|
-
<span class="icon-bar"></span>
|
|
875
|
-
<span class="icon-bar"></span>
|
|
876
|
-
<span class="icon-bar"></span>
|
|
877
|
-
</button>
|
|
878
|
-
<%= link_to '#{app_name}', root_path, class: 'navbar-brand' %>
|
|
879
|
-
</div>
|
|
880
|
-
<div class="collapse navbar-collapse">
|
|
881
|
-
<ul class="nav navbar-nav">
|
|
882
|
-
<%= render 'layouts/navigation_links' %>
|
|
883
|
-
</ul>
|
|
884
|
-
</div>
|
|
885
|
-
</div>
|
|
886
|
-
</nav>
|
|
887
|
-
S
|
|
888
|
-
|
|
889
|
-
file 'app/views/layouts/_navigation_links.html.erb', <<-S
|
|
890
|
-
<li>
|
|
891
|
-
<%= link_to 'Sidekiq dashboard', '/sidekiq' %>
|
|
892
|
-
</li>
|
|
893
|
-
S
|
|
894
|
-
|
|
895
|
-
file 'app/views/layouts/_footer.html.erb', <<-S
|
|
896
|
-
<p class="text-muted">© #{Time.now.year.to_s} #{app_name} - All rights reserved</p>
|
|
897
|
-
S
|
|
898
|
-
|
|
899
|
-
file 'app/views/layouts/_google_analytics_snippet.html.erb', <<-S
|
|
900
|
-
<script type="text/javascript">
|
|
901
|
-
var _gaq = _gaq || [];
|
|
902
|
-
<% if ENV['GOOGLE_ANALYTICS_UA'].present? %>
|
|
903
|
-
_gaq.push(['_setAccount', '<%= ENV["GOOGLE_ANALYTICS_UA"] %>']);
|
|
904
|
-
(function() {
|
|
905
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
906
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
907
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
908
|
-
})();
|
|
909
|
-
<% end %>
|
|
910
|
-
</script>
|
|
911
|
-
S
|
|
912
|
-
|
|
913
|
-
file 'app/views/layouts/_google_analytics_tracker.html.erb', <<-S
|
|
914
|
-
<script type="text/javascript">
|
|
915
|
-
// This is added in the body to track both turbolinks and regular hits.
|
|
916
|
-
_gaq.push(['_trackPageview']);
|
|
917
|
-
</script>
|
|
918
|
-
S
|
|
919
|
-
|
|
920
|
-
file 'app/views/layouts/_disqus_comments_snippet.html.erb', <<-S
|
|
921
|
-
<% if ENV['DISQUS_SHORT_NAME'].present? %>
|
|
922
|
-
<div id="disqus_thread"></div>
|
|
923
|
-
<script type="text/javascript">
|
|
924
|
-
var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
|
|
925
|
-
(function() {
|
|
926
|
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
|
927
|
-
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
|
928
|
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
929
|
-
})();
|
|
930
|
-
</script>
|
|
931
|
-
<noscript>
|
|
932
|
-
Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
|
|
933
|
-
</noscript>
|
|
934
|
-
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
|
935
|
-
<% end %>
|
|
936
|
-
S
|
|
937
|
-
|
|
938
|
-
file 'app/views/layouts/_disqus_count_snippet.html.erb', <<-S
|
|
939
|
-
<% if ENV['DISQUS_SHORT_NAME'].present? %>
|
|
940
|
-
<div id="disqus_thread"></div>
|
|
941
|
-
<script type="text/javascript">
|
|
942
|
-
var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
|
|
943
|
-
(function () {
|
|
944
|
-
var s = document.createElement('script'); s.async = true;
|
|
945
|
-
s.type = 'text/javascript';
|
|
946
|
-
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
|
|
947
|
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
|
948
|
-
}());
|
|
949
|
-
<% end %>
|
|
950
|
-
S
|
|
351
|
+
copy_from_local_gem 'app/views/layouts/_flash.html.erb'
|
|
352
|
+
|
|
353
|
+
copy_from_local_gem 'app/views/layouts/_navigation.html.erb'
|
|
354
|
+
gsub_file 'app/views/layouts/_navigation.html.erb', 'app_name', app_name
|
|
355
|
+
|
|
356
|
+
copy_from_local_gem 'app/views/layouts/_navigation_links.html.erb'
|
|
357
|
+
|
|
358
|
+
copy_from_local_gem 'app/views/layouts/_footer.html.erb'
|
|
359
|
+
gsub_file 'app/views/layouts/_footer.html.erb', 'Time.now.year.to_s',
|
|
360
|
+
Time.now.year.to_s
|
|
361
|
+
gsub_file 'app/views/layouts/_footer.html.erb', 'app_name', app_name
|
|
362
|
+
|
|
363
|
+
copy_from_local_gem 'app/views/layouts/_google_analytics_snippet.html.erb'
|
|
364
|
+
copy_from_local_gem 'app/views/layouts/_google_analytics_tracker.html.erb'
|
|
365
|
+
|
|
366
|
+
copy_from_local_gem 'app/views/layouts/_disqus_comments_snippet.html.erb'
|
|
367
|
+
copy_from_local_gem 'app/views/layouts/_disqus_count_snippet.html.erb'
|
|
368
|
+
|
|
951
369
|
git_commit 'Add layout partials'
|
|
952
370
|
end
|
|
953
371
|
|
|
954
372
|
def add_http_error_pages
|
|
955
373
|
log_task __method__
|
|
956
374
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
<html>
|
|
963
|
-
<head>
|
|
964
|
-
<title>Error 404</title>
|
|
965
|
-
<meta charset="utf-8" />
|
|
966
|
-
<style>
|
|
967
|
-
</style>
|
|
968
|
-
</head>
|
|
969
|
-
|
|
970
|
-
<body>
|
|
971
|
-
<h1>Error 404</h1>
|
|
972
|
-
</body>
|
|
973
|
-
</html>
|
|
974
|
-
S
|
|
975
|
-
|
|
976
|
-
file 'public/422.html', <<-S
|
|
977
|
-
<!DOCTYPE html>
|
|
978
|
-
<html>
|
|
979
|
-
<head>
|
|
980
|
-
<title>Error 422</title>
|
|
981
|
-
<meta charset="utf-8" />
|
|
982
|
-
<style>
|
|
983
|
-
</style>
|
|
984
|
-
</head>
|
|
985
|
-
|
|
986
|
-
<body>
|
|
987
|
-
<h1>Error 422</h1>
|
|
988
|
-
</body>
|
|
989
|
-
</html>
|
|
990
|
-
S
|
|
991
|
-
|
|
992
|
-
file 'public/500.html', <<-S
|
|
993
|
-
<!DOCTYPE html>
|
|
994
|
-
<html>
|
|
995
|
-
<head>
|
|
996
|
-
<title>Error 500</title>
|
|
997
|
-
<meta charset="utf-8" />
|
|
998
|
-
<style>
|
|
999
|
-
</style>
|
|
1000
|
-
</head>
|
|
1001
|
-
|
|
1002
|
-
<body>
|
|
1003
|
-
<h1>Error 500</h1>
|
|
1004
|
-
</body>
|
|
1005
|
-
</html>
|
|
1006
|
-
S
|
|
1007
|
-
|
|
1008
|
-
file 'public/502.html', <<-S
|
|
1009
|
-
<!DOCTYPE html>
|
|
1010
|
-
<html>
|
|
1011
|
-
<head>
|
|
1012
|
-
|
|
1013
|
-
<title>Error 502</title>
|
|
1014
|
-
<meta charset="utf-8" />
|
|
1015
|
-
<style>
|
|
1016
|
-
</style>
|
|
1017
|
-
</head>
|
|
1018
|
-
<body>
|
|
1019
|
-
<h1>Error 502</h1>
|
|
1020
|
-
</body>
|
|
1021
|
-
</html>
|
|
1022
|
-
S
|
|
375
|
+
copy_from_local_gem 'public/404.html'
|
|
376
|
+
copy_from_local_gem 'public/422.html'
|
|
377
|
+
copy_from_local_gem 'public/500.html'
|
|
378
|
+
copy_from_local_gem 'public/502.html'
|
|
379
|
+
|
|
1023
380
|
git_commit 'Add http status code pages'
|
|
1024
381
|
end
|
|
1025
382
|
|
|
@@ -1149,6 +506,7 @@ copy_base_favicon
|
|
|
1149
506
|
add_dotenv
|
|
1150
507
|
add_procfile
|
|
1151
508
|
add_markdown_readme
|
|
509
|
+
add_license
|
|
1152
510
|
update_app_secrets
|
|
1153
511
|
update_app_config
|
|
1154
512
|
update_database_config
|
|
@@ -1163,8 +521,8 @@ update_development_environment
|
|
|
1163
521
|
update_production_environment
|
|
1164
522
|
update_routes
|
|
1165
523
|
add_backup_lib
|
|
1166
|
-
add_favicon_task
|
|
1167
524
|
add_backup_task
|
|
525
|
+
add_favicon_task
|
|
1168
526
|
add_helpers
|
|
1169
527
|
add_layout
|
|
1170
528
|
add_layout_partials
|