orats 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +1,57 @@
1
- # =====================================================================================================
2
- # Template for generating an opinionated base Rails 4.1.0 project using Ruby 2.1.2
3
- # =====================================================================================================
4
-
5
- # ----- Helper functions and variables ----------------------------------------------------------------
6
-
7
1
  require 'securerandom'
8
2
 
3
+ # =============================================================================
4
+ # template for generating an orats base project for rails 4.1.x
5
+ # =============================================================================
6
+ # view the task list at the bottom of the file
7
+ # -----------------------------------------------------------------------------
8
+
9
+ # -----------------------------------------------------------------------------
10
+ # private functions
11
+ # -----------------------------------------------------------------------------
9
12
  def generate_token
10
13
  SecureRandom.hex(64)
11
14
  end
12
15
 
13
- def from_gem(source, destination = nil)
14
- base_path = "#{File.expand_path File.dirname(__FILE__)}/includes"
15
- file_name = source.split('/').last
16
-
17
- if destination.present? && file_name != destination
18
- if destination.include? '/'
19
- run "mkdir -p #{destination}"
20
- end
21
- end
16
+ def method_to_sentence(method)
17
+ method.tr!('_', ' ')
18
+ method[0] = method[0].upcase
19
+ method
20
+ end
22
21
 
23
- run "cp #{base_path}/#{file_name} #{destination}"
22
+ def log_task(message)
23
+ puts
24
+ say_status 'task', "#{method_to_sentence(message.to_s)}:", :yellow
25
+ puts '-'*80, ''; sleep 0.25
24
26
  end
25
27
 
26
- app_name_class = app_name.humanize
28
+ def git_commit(message)
29
+ git add: '-A'
30
+ git commit: "-m '#{message}'"
31
+ end
27
32
 
28
- # ----- Create the git repo ----------------------------------------------------------------------------
33
+ def copy_from_local_gem(source, dest)
34
+ base_path = "#{File.expand_path File.dirname(__FILE__)}/includes"
35
+ file_name_of_source = File.basename(source)
29
36
 
30
- puts
31
- say_status 'git', 'Creating a new local git repo...', :yellow
32
- puts '-'*80, ''; sleep 0.25
37
+ run "mkdir -p #{File.dirname(dest)}" if dest.present? && file_name_of_source != dest
38
+ run "cp #{base_path}/#{source} #{dest}"
39
+ end
33
40
 
34
- git :init
35
- git add: '-A'
36
- git commit: "-m 'Initial commit'"
41
+ # ---
37
42
 
38
- # ----- Modify the .gitignore file --------------------------------------------------------------------
43
+ def initial_git_commit
44
+ log_task __method__
39
45
 
40
- puts
41
- say_status 'root', 'Modifying the .gitignore file...', :yellow
42
- puts '-'*80, ''; sleep 0.25
46
+ git :init
47
+ git_commit 'Initial git commit'
48
+ end
43
49
 
44
- append_to_file '.gitignore' do <<-TEXT
50
+ def update_gitignore
51
+ log_task __method__
45
52
 
46
- # Ignore OS and editor files.
53
+ append_to_file '.gitignore' do <<-S
54
+ # OS and editor files
47
55
  .DS_Store
48
56
  */**.DS_Store
49
57
  ._*
@@ -51,41 +59,37 @@ append_to_file '.gitignore' do <<-TEXT
51
59
  *~
52
60
  .idea/
53
61
 
54
- # Ignore the dotenv file.
62
+ # the dotenv file
55
63
  .env
56
64
 
57
- # Ignore app specific folders.
65
+ # app specific folders
58
66
  /vendor/bundle
59
67
  /public/assets/*
60
- TEXT
68
+ S
69
+ end
70
+ git_commit 'Add common OS files, editor files and other paths'
61
71
  end
62
72
 
63
- git add: '-A'
64
- git commit: "-m 'Add common OS and editor files to the .gitignore file'"
65
-
66
- # ----- Add a bundler config --------------------------------------------------------------------
73
+ def copy_gemfile
74
+ log_task __method__
67
75
 
68
- # puts
69
- # say_status 'bundle', 'Creating bundle config...', :yellow
70
- # puts '-'*80, ''; sleep 0.25
71
- #
72
- # file '.bundle/config' do <<-CODE
73
- # ---
74
- # BUNDLE_WITHOUT: production:staging
75
- # CODE
76
- # end
77
- #
78
- # git add: '-A'
79
- # git commit: "-m 'Add .bundle/config to ignore production:staging in development mode'"
76
+ run 'rm -f Gemfile'
77
+ copy_from_local_gem 'Gemfile', 'Gemfile'
78
+ git_commit 'Add Gemfile'
79
+ end
80
80
 
81
+ def copy_base_favicon
82
+ log_task __method__
81
83
 
82
- # ----- Create a development environment file ---------------------------------------------------
84
+ copy_from_local_gem 'app/assets/favicon/favicon_base.png',
85
+ 'app/assets/favicon/favicon_base.png'
86
+ git_commit 'Add a 256x256 base favicon'
87
+ end
83
88
 
84
- puts
85
- say_status 'root', 'Creating development environment file...', :yellow
86
- puts '-'*80, ''; sleep 0.25
89
+ def add_dotenv
90
+ log_task 'add_dotenv'
87
91
 
88
- file '.env' do <<-CODE
92
+ file '.env' do <<-S
89
93
  RAILS_ENV: development
90
94
 
91
95
  PROJECT_PATH: /full/path/to/your/project
@@ -127,43 +131,28 @@ PUMA_THREADS_MAX: 1
127
131
  PUMA_WORKERS: 0
128
132
 
129
133
  SIDEKIQ_CONCURRENCY: 25
130
- CODE
134
+ S
135
+ end
136
+ git_commit 'Add development environment file'
131
137
  end
132
138
 
133
- git add: '-A'
134
- git commit: "-m 'Add development environment file'"
135
-
136
- # ----- Create the foreman Procfile ------------------------------------------------------------------------
139
+ def add_procfile
140
+ log_task __method__
137
141
 
138
- puts
139
- say_status 'start', 'Creating the Procfile for foreman...', :yellow
140
- puts '-'*80, ''; sleep 0.25
141
-
142
- file 'Procfile' do <<-CODE
142
+ file 'Procfile' do <<-S
143
143
  web: puma -C config/puma.rb
144
144
  worker: sidekiq -C config/sidekiq.yml
145
- CODE
145
+ log: tail -f log/development.log
146
+ S
147
+ end
148
+ git_commit 'Add a Procfile'
146
149
  end
147
150
 
148
- git add: '-A'
149
- git commit: "-m 'Add a basic Procfile to start the puma and sidekiq processes'"
150
-
151
- # ----- Modify the secrets yaml file -----------------------------------------------------------------------
152
-
153
- gsub_file 'config/secrets.yml', /.*\n/, ''
154
- append_file 'config/secrets.yml' do <<-FILE
155
- # Be sure to restart your server when you modify this file.
156
-
157
- # Your secret key is used for verifying the integrity of signed cookies.
158
- # If you change this key, all old signed cookies will become invalid!
159
-
160
- # Make sure the secret is at least 30 characters and all random,
161
- # no regular words or you'll be exposed to dictionary attacks.
162
- # You can use `rake secret` to generate a secure secret key.
163
-
164
- # Make sure the secrets in this file are kept private
165
- # if you're sharing your code publicly.
151
+ def update_app_secrets
152
+ log_task __method__
166
153
 
154
+ gsub_file 'config/secrets.yml', /.*\n/, ''
155
+ append_file 'config/secrets.yml' do <<-S
167
156
  development: &default
168
157
  secret_key_base: <%= ENV['TOKEN_RAILS_SECRET'] %>
169
158
 
@@ -175,19 +164,15 @@ staging:
175
164
 
176
165
  production:
177
166
  <<: *default
178
- FILE
167
+ S
168
+ end
169
+ git_commit 'DRY out the yaml'
179
170
  end
180
171
 
181
- git add: '-A'
182
- git commit: "-m 'Dry up the secrets settings'"
172
+ def update_app_config
173
+ log_task __method__
183
174
 
184
- # ----- Modify the application file -------------------------------------------------------------------
185
-
186
- puts
187
- say_status 'config', 'Modifying the application file...', :yellow
188
- puts '-'*80, ''; sleep 0.25
189
-
190
- inject_into_file 'config/application.rb', after: "automatically loaded.\n" do <<-CODE
175
+ inject_into_file 'config/application.rb', after: "automatically loaded.\n" do <<-S
191
176
  config.action_mailer.delivery_method = :smtp
192
177
  config.action_mailer.smtp_settings = {
193
178
  :address => ENV['SMTP_ADDRESS'],
@@ -197,9 +182,9 @@ inject_into_file 'config/application.rb', after: "automatically loaded.\n" do <<
197
182
  :password => ENV['SMTP_PASSWORD'],
198
183
  :authentication => ENV['SMTP_AUTH']
199
184
  }
185
+
200
186
  config.action_mailer.smtp_settings[:enable_starttls_auto] = true if ENV['SMTP_ENCRYPTION'] == 'starttls'
201
187
  config.action_mailer.smtp_settings[:ssl] = true if ENV['SMTP_ENCRYPTION'] == 'ssl'
202
-
203
188
  config.action_mailer.default_options = { from: ENV['ACTION_MAILER_DEFAULT_FROM'] }
204
189
  config.action_mailer.default_url_options = { host: ENV['ACTION_MAILER_HOST'] }
205
190
 
@@ -208,15 +193,15 @@ inject_into_file 'config/application.rb', after: "automatically loaded.\n" do <<
208
193
  db: ENV['CACHE_DATABASE'].to_i,
209
194
  namespace: '#{app_name}::cache'
210
195
  }
211
- redis_store_options[:password] = ENV['CACHE_PASSWORD'] if ENV['CACHE_PASSWORD'].present?
212
196
 
197
+ redis_store_options[:password] = ENV['CACHE_PASSWORD'] if ENV['CACHE_PASSWORD'].present?
213
198
  config.cache_store = :redis_store, redis_store_options
214
- CODE
215
- end
216
-
217
- gsub_file 'config/application.rb', "# config.time_zone = 'Central Time (US & Canada)'", "config.time_zone = 'Eastern Time (US & Canada)'"
199
+ S
200
+ end
218
201
 
219
- append_file 'config/application.rb' do <<-'FILE'
202
+ gsub_file 'config/application.rb',
203
+ "# config.time_zone = 'Central Time (US & Canada)'","config.time_zone = 'Eastern Time (US & Canada)'"
204
+ append_file 'config/application.rb' do <<-'S'
220
205
 
221
206
  ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
222
207
  if html_tag =~ /\<label/
@@ -226,20 +211,16 @@ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
226
211
  %(#{html_tag}<p class="validation-error"> #{errors}</p>).html_safe
227
212
  end
228
213
  end
229
- FILE
214
+ S
215
+ end
216
+ git_commit 'Configure the mailer/redis, update the timezone and adjust the validation output'
230
217
  end
231
218
 
232
- git add: '-A'
233
- git commit: "-m 'Add tweakable settings, update the timezone and change the way validation errors are shown'"
234
-
235
- # ----- Modify the config files -----------------------------------------------------------------------
219
+ def update_database_config
220
+ log_task __method__
236
221
 
237
- puts
238
- say_status 'config', 'Modifying the config files...', :yellow
239
- puts '-'*80, ''; sleep 0.25
240
-
241
- gsub_file 'config/database.yml', /.*\n/, ''
242
- append_file 'config/database.yml' do <<-FILE
222
+ gsub_file 'config/database.yml', /.*\n/, ''
223
+ append_file 'config/database.yml' do <<-S
243
224
  development: &default
244
225
  adapter: postgresql
245
226
  database: <%= ENV['DATABASE_NAME'] %>
@@ -258,13 +239,15 @@ staging:
258
239
 
259
240
  production:
260
241
  <<: *default
261
- FILE
242
+ S
243
+ end
244
+ git_commit 'DRY out the yaml'
262
245
  end
263
246
 
264
- git add: '-A'
265
- git commit: "-m 'Dry up the database settings'"
247
+ def add_puma_config
248
+ log_task __method__
266
249
 
267
- file 'config/puma.rb', <<-'CODE'
250
+ file 'config/puma.rb', <<-'S'
268
251
  environment ENV['RAILS_ENV']
269
252
 
270
253
  threads ENV['PUMA_THREADS_MIN'].to_i,ENV['PUMA_THREADS_MAX'].to_i
@@ -285,28 +268,32 @@ restart_command 'bundle exec bin/puma'
285
268
 
286
269
  on_worker_boot do
287
270
  require 'active_record'
288
- config_path = File.expand_path('../database.yml', __FILE__)
289
271
 
272
+ config_path = File.expand_path('../database.yml', __FILE__)
290
273
  ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
291
274
  ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || YAML.load_file(config_path)[ENV['RAILS_ENV']])
292
275
  end
293
- CODE
276
+ S
277
+ git_commit 'Add the puma config'
278
+ end
294
279
 
295
- git add: '-A'
296
- git commit: "-m 'Add the puma config'"
280
+ def add_sidekiq_config
281
+ log_task __method__
297
282
 
298
- file 'config/sidekiq.yml', <<-CODE
283
+ file 'config/sidekiq.yml', <<-S
299
284
  ---
300
285
  :pidfile: <%= ENV['PROJECT_PATH'] %>/tmp/sidekiq.pid
301
286
  :concurrency: <%= ENV['SIDEKIQ_CONCURRENCY'].to_i %>
302
287
  :queues:
303
288
  - default
304
- CODE
289
+ S
290
+ git_commit 'Add the sidekiq config'
291
+ end
305
292
 
306
- git add: '-A'
307
- git commit: "-m 'Add the sidekiq config'"
293
+ def add_sitemap_config
294
+ log_task __method__
308
295
 
309
- file 'config/sitemap.rb', <<-'CODE'
296
+ file 'config/sitemap.rb', <<-'S'
310
297
  # Set the host name for URL creation
311
298
  SitemapGenerator::Sitemap.default_host = "http://www.app_name.com"
312
299
 
@@ -327,14 +314,15 @@ SitemapGenerator::Sitemap.create do
327
314
  # add article_path("#{article.id}-#{article.permalink}"), priority: 0.9, lastmod: article.updated_at
328
315
  # end
329
316
  end
330
- CODE
331
-
332
- gsub_file 'config/sitemap.rb', 'app_name', app_name
317
+ S
318
+ gsub_file 'config/sitemap.rb', 'app_name', app_name
319
+ git_commit 'Add the sitemap config'
320
+ end
333
321
 
334
- git add: '-A'
335
- git commit: "-m 'Add the sitemap config'"
322
+ def add_whenever_config
323
+ log_task __method__
336
324
 
337
- file 'config/schedule.rb', <<-CODE
325
+ file 'config/schedule.rb', <<-S
338
326
  every 1.day, at: '3:00 am' do
339
327
  rake 'orats:backup'
340
328
  end
@@ -342,52 +330,14 @@ end
342
330
  every 1.day, at: '4:00 am' do
343
331
  rake 'sitemap:refresh'
344
332
  end
345
- CODE
346
-
347
- git add: '-A'
348
- git commit: "-m 'Add a sitemap rake task that occurs at 4am'"
349
-
350
- # ----- Modify the environment files ------------------------------------------------------------------
351
-
352
- puts
353
- say_status 'Config', 'Modifying the environment files...', :yellow
354
- puts '-'*80, ''; sleep 0.25
355
-
356
- file 'config/environments/staging.rb', <<-CODE
357
- require_relative 'production.rb'
358
-
359
- #{app_name_class}::Application.configure do
360
- # Overwrite any production settings here, or if you want to start from scratch then remove line 1.
361
- end
362
- CODE
363
-
364
- git add: '-A'
365
- git commit: "-m 'Add add staging environment'"
366
-
367
- inject_into_file 'config/environments/production.rb', after: "config.log_level = :info\n" do <<-"CODE"
368
- config.logger = Logger.new(config.paths['log'].first, 'daily')
369
- CODE
333
+ S
334
+ git_commit 'Add the whenever config'
370
335
  end
371
336
 
372
- inject_into_file 'config/environments/production.rb', after: "%w( search.js )\n" do <<-"CODE"
373
- config.assets.precompile << Proc.new { |path|
374
- if path =~ /\.(eot|svg|ttf|woff|png)\z/
375
- true
376
- end
377
- }
378
- CODE
379
- end
380
-
381
- git add: '-A'
382
- git commit: "-m 'Change production config options'"
383
-
384
- # ----- Modify the initializer files ------------------------------------------------------------------
385
-
386
- puts
387
- say_status 'config', 'Modifying the initializer files...', :yellow
388
- puts '-'*80, ''; sleep 0.25
337
+ def add_sidekiq_initializer
338
+ log_task __method__
389
339
 
390
- file 'config/initializers/sidekiq.rb', <<-'CODE'
340
+ file 'config/initializers/sidekiq.rb', <<-'S'
391
341
  ENV['CACHE_PASSWORD'].present? ? pass_string = ":#{ENV['CACHE_PASSWORD']}@" : pass_string = ''
392
342
 
393
343
  redis_host = "#{pass_string}#{ENV['CACHE_HOST']}"
@@ -404,145 +354,83 @@ end
404
354
  Sidekiq.configure_client do |config|
405
355
  config.redis = sidekiq_config
406
356
  end
407
- CODE
408
-
409
- gsub_file 'config/initializers/sidekiq.rb', 'ns_app', app_name
357
+ S
358
+ gsub_file 'config/initializers/sidekiq.rb', 'ns_app', app_name
359
+ git_commit 'Add the sidekiq initializer'
360
+ end
410
361
 
411
- git add: '-A'
412
- git commit: "-m 'Add the sidekiq initializer'"
362
+ def add_mini_profiler_initializer
363
+ log_task __method__
413
364
 
414
- file 'config/initializers/mini_profiler.rb', <<-CODE
365
+ file 'config/initializers/mini_profiler.rb', <<-S
415
366
  if defined? Rack::MiniProfiler
416
367
  # Toggle with ALT+p
417
368
  Rack::MiniProfiler.config.start_hidden = true
418
369
  end
419
- CODE
420
-
421
- git add: '-A'
422
- git commit: "-m 'Add the rack mini profiler initializer'"
423
-
424
- # ----- Modify the routes file ------------------------------------------------------------------------
425
-
426
- puts
427
- say_status 'config', 'Modifying the routes file...', :yellow
428
- puts '-'*80, ''; sleep 0.25
429
-
430
- prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
431
-
432
- git add: '-A'
433
- git commit: "-m 'Add sidekiq to the routes file'"
434
-
435
- inject_into_file 'config/routes.rb', after: "draw do\n" do <<-CODE
436
- concern :pageable do
437
- get 'page/:page', action: :index, on: :collection
438
- end
439
- CODE
370
+ S
371
+ git_commit 'Add the mini profiler initializer'
440
372
  end
441
373
 
442
- git add: '-A'
443
- git commit: "-m 'Add a route concern for pagination'"
444
-
445
- # ----- Creating application tasks --------------------------------------------------------------------
446
-
447
- puts
448
- say_status 'tasks', 'Creating application tasks...', :yellow
449
- puts '-'*80, ''; sleep 0.25
374
+ def add_staging_environment
375
+ log_task __method__
450
376
 
451
- file 'lib/tasks/orats/favicon.rake', <<-'CODE'
452
- namespace :orats do
453
- desc 'Create favicons from a single base png'
454
- task :favicons do
455
- require 'favicon_maker'
456
-
457
- FaviconMaker.generate do
458
- setup do
459
- template_dir Rails.root.join('app', 'assets', 'favicon')
460
- output_dir Rails.root.join('public')
461
- end
377
+ file 'config/environments/staging.rb', <<-S
378
+ require_relative 'production.rb'
462
379
 
463
- favicon_base_path = "#{template_dir}/favicon_base.png"
380
+ #{app_name.humanize}::Application.configure do
381
+ # Overwrite any production settings here, or if you want to start from scratch then remove line 1.
382
+ end
383
+ S
384
+ git_commit 'Add a staging environment'
385
+ end
464
386
 
465
- unless File.exist?(favicon_base_path)
466
- puts
467
- puts 'A base favicon could not be found, make sure one exists at:'
468
- puts base_favicon
469
- puts
470
- exit 1
471
- end
387
+ def update_production_environment
388
+ log_task __method__
472
389
 
473
- from File.basename(favicon_base_path) do
474
- icon 'speeddial-160x160.png'
475
- icon 'apple-touch-icon-228x228-precomposed.png'
476
- icon 'apple-touch-icon-152x152-precomposed.png'
477
- icon 'apple-touch-icon-144x144-precomposed.png'
478
- icon 'apple-touch-icon-120x120-precomposed.png'
479
- icon 'apple-touch-icon-114x114-precomposed.png'
480
- icon 'apple-touch-icon-76x76-precomposed.png'
481
- icon 'apple-touch-icon-72x72-precomposed.png'
482
- icon 'apple-touch-icon-60x60-precomposed.png'
483
- icon 'apple-touch-icon-57x57-precomposed.png'
484
- icon 'favicon-196x196.png'
485
- icon 'favicon-160x160.png'
486
- icon 'favicon-96x96.png'
487
- icon 'favicon-64x64.png'
488
- icon 'favicon-32x32.png'
489
- icon 'favicon-24x24.png'
490
- icon 'favicon-16x16.png'
491
- icon 'favicon.ico', size: '64x64,32x32,24x24,16x16'
492
- end
390
+ inject_into_file 'config/environments/production.rb', after: "config.log_level = :info\n" do <<-'S'
391
+ config.logger = Logger.new(config.paths['log'].first, 'daily')
392
+ S
393
+ end
394
+ git_commit 'Update the logger to rotate daily'
493
395
 
494
- each_icon do |filepath|
495
- puts "Creating favicon for: #{File.basename filepath}"
496
- end
497
- end
396
+ inject_into_file 'config/environments/production.rb', after: "%w( search.js )\n" do <<-'S'
397
+ config.assets.precompile << Proc.new { |path|
398
+ if path =~ /\.(eot|svg|ttf|woff|png)\z/
399
+ true
400
+ end
401
+ }
402
+ S
498
403
  end
404
+ git_commit 'Update the assets precompiler to include common file types'
499
405
  end
500
- CODE
501
406
 
502
- git add: '-A'
503
- git commit: "-m 'Add a favicon generator task'"
407
+ def update_routes
408
+ log_task __method__
504
409
 
505
- file 'lib/tasks/orats/backup.rake', <<-'CODE'
506
- namespace :orats do
507
- desc 'Create a backup of your application for a specific environment'
508
- task :backup do
509
- if File.exist?('.env') && File.file?('.env')
510
- require 'dotenv'
511
- Dotenv.load
512
-
513
- source_external_env = ''
514
- else
515
- source_external_env = '. /etc/default/app_name &&'
516
- end
410
+ prepend_file 'config/routes.rb', "require 'sidekiq/web'\n\n"
517
411
 
518
- # hack'ish way to run the backup command with elevated privileges, it won't prompt for a password on the production
519
- # server because passwordless sudo has been enabled if you use the ansible setup provided by orats
520
- system 'sudo whoami'
412
+ inject_into_file 'config/routes.rb', after: "draw do\n" do <<-S
413
+ concern :pageable do
414
+ get 'page/:page', action: :index, on: :collection
415
+ end
521
416
 
522
- system "#{source_external_env} backup perform -t backup -c '#{File.join('lib', 'backup', 'config.rb')}' --log-path='#{File.join('log')}'"
417
+ # you may want to protect this behind authentication
418
+ mount Sidekiq::Web => '/sidekiq'
419
+ S
523
420
  end
421
+ git_commit 'Add a concern for pagination and mount sidekiq'
524
422
  end
525
- CODE
526
-
527
- gsub_file 'lib/tasks/orats/backup.rake', 'app_name', app_name
528
-
529
- git add: '-A'
530
- git commit: "-m 'Add a backup task'"
531
-
532
- # ----- Creating application backup --------------------------------------------------------------------
533
423
 
534
- puts
535
- say_status 'backup', 'Creating application backup script...', :yellow
536
- puts '-'*80, ''; sleep 0.25
424
+ def add_backup_lib
425
+ log_task __method__
537
426
 
538
- file 'lib/backup/config.rb', <<-'CODE'
427
+ file 'lib/backup/config.rb', <<-'S'
539
428
  ##
540
429
  # Backup v4.x Configuration
541
430
  #
542
431
  # Documentation: http://meskyanichi.github.io/backup
543
432
  # Issue Tracker: https://github.com/meskyanichi/backup/issues
544
433
 
545
- ##
546
434
  # Config Options
547
435
  #
548
436
  # The options here may be overridden on the command line, but the result
@@ -564,27 +452,21 @@ file 'lib/backup/config.rb', <<-'CODE'
564
452
  #
565
453
  # Sets the root path for all relative paths, including default paths.
566
454
  # May be an absolute path, or relative to the current working directory.
567
- #
568
455
 
569
456
  root_path 'lib/backup'
570
457
 
571
- #
572
458
  # Sets the path where backups are processed until they're stored.
573
459
  # This must have enough free space to hold apx. 2 backups.
574
460
  # May be an absolute path, or relative to the current directory or +root_path+.
575
- #
576
461
 
577
462
  tmp_path '../../tmp'
578
463
 
579
- #
580
464
  # Sets the path where backup stores persistent information.
581
465
  # When Backup's Cycler is used, small YAML files are stored here.
582
466
  # May be an absolute path, or relative to the current directory or +root_path+.
583
- #
584
467
 
585
468
  data_path '../../tmp/backup/data'
586
469
 
587
- ##
588
470
  # Utilities
589
471
  #
590
472
  # If you need to use a utility other than the one Backup detects,
@@ -595,7 +477,6 @@ data_path '../../tmp/backup/data'
595
477
  # redis_cli '/opt/redis/redis-cli'
596
478
  # end
597
479
 
598
- ##
599
480
  # Logging
600
481
  #
601
482
  # Logging options may be set on the command line, but certain settings
@@ -613,7 +494,6 @@ data_path '../../tmp/backup/data'
613
494
  # to disable syslog and enable console output.
614
495
  # backup perform --trigger my_backup --no-syslog --no-quiet
615
496
 
616
- ##
617
497
  # Component Defaults
618
498
  #
619
499
  # Set default options to be applied to components in all models.
@@ -636,7 +516,6 @@ data_path '../../tmp/backup/data'
636
516
  # mail.encryption = :starttls
637
517
  # end
638
518
 
639
- ##
640
519
  # Preconfigured Models
641
520
  #
642
521
  # Create custom models with preconfigured components.
@@ -662,19 +541,15 @@ data_path '../../tmp/backup/data'
662
541
  # mail.to = 'john.smith@email.com'
663
542
  # end
664
543
  # end
665
- CODE
666
-
667
- git add: '-A'
668
- git commit: "-m 'Add backup config'"
544
+ S
669
545
 
670
- file 'lib/backup/models/backup.rb', <<-'CODE'
546
+ file 'lib/backup/models/backup.rb', <<-'S'
671
547
  Model.new(:backup, 'Backup for the current RAILS_ENV') do
672
548
  split_into_chunks_of 10
673
549
  compress_with Gzip
674
550
 
675
551
  database PostgreSQL do |db|
676
552
  db.sudo_user = ENV['DATABASE_USERNAME']
677
-
678
553
  # To dump all databases, set `db.name = :all` (or leave blank)
679
554
  db.name = ENV['DATABASE_NAME']
680
555
  db.username = ENV['DATABASE_USERNAME']
@@ -713,7 +588,6 @@ Model.new(:backup, 'Backup for the current RAILS_ENV') do
713
588
  mail.on_success = false
714
589
  #mail.on_warning = true
715
590
  mail.on_failure = true
716
-
717
591
  mail.from = ENV['ACTION_MAILER_DEFAULT_FROM']
718
592
  mail.to = ENV['ACTION_MAILER_DEFAULT_TO']
719
593
  mail.address = ENV['SMTP_ADDRESS']
@@ -725,18 +599,97 @@ Model.new(:backup, 'Backup for the current RAILS_ENV') do
725
599
  mail.encryption = mail_encryption.to_sym
726
600
  end
727
601
  end
728
- CODE
602
+ S
603
+ git_commit 'Add backup library'
604
+ end
605
+
606
+ def add_favicon_task
607
+ log_task __method__
608
+
609
+ file 'lib/tasks/orats/favicon.rake', <<-'S'
610
+ namespace :orats do
611
+ desc 'Create favicons from a single base png'
612
+ task :favicons do
613
+ require 'favicon_maker'
614
+
615
+ FaviconMaker.generate do
616
+ setup do
617
+ template_dir Rails.root.join('app', 'assets', 'favicon')
618
+ output_dir Rails.root.join('public')
619
+ end
729
620
 
730
- git add: '-A'
731
- git commit: "-m 'Add backup model'"
621
+ favicon_base_path = "#{template_dir}/favicon_base.png"
732
622
 
733
- # ----- Creating application helpers ------------------------------------------------------------------
623
+ unless File.exist?(favicon_base_path)
624
+ puts
625
+ puts 'A base favicon could not be found, make sure one exists at:'
626
+ puts favicon_base_path
627
+ puts
628
+ exit 1
629
+ end
734
630
 
735
- puts
736
- say_status 'helpers', 'Creating application helpers...', :yellow
737
- puts '-'*80, ''; sleep 0.25
631
+ from File.basename(favicon_base_path) do
632
+ icon 'speeddial-160x160.png'
633
+ icon 'apple-touch-icon-228x228-precomposed.png'
634
+ icon 'apple-touch-icon-152x152-precomposed.png'
635
+ icon 'apple-touch-icon-144x144-precomposed.png'
636
+ icon 'apple-touch-icon-120x120-precomposed.png'
637
+ icon 'apple-touch-icon-114x114-precomposed.png'
638
+ icon 'apple-touch-icon-76x76-precomposed.png'
639
+ icon 'apple-touch-icon-72x72-precomposed.png'
640
+ icon 'apple-touch-icon-60x60-precomposed.png'
641
+ icon 'apple-touch-icon-57x57-precomposed.png'
642
+ icon 'favicon-196x196.png'
643
+ icon 'favicon-160x160.png'
644
+ icon 'favicon-96x96.png'
645
+ icon 'favicon-64x64.png'
646
+ icon 'favicon-32x32.png'
647
+ icon 'favicon-24x24.png'
648
+ icon 'favicon-16x16.png'
649
+ icon 'favicon.ico', size: '64x64,32x32,24x24,16x16'
650
+ end
738
651
 
739
- inject_into_file 'app/helpers/application_helper.rb', after: "ApplicationHelper\n" do <<-CODE
652
+ each_icon do |filepath|
653
+ puts "Creating favicon @ #{filepath}"
654
+ end
655
+ end
656
+ end
657
+ end
658
+ S
659
+ git_commit 'Add a favicon generator task'
660
+ end
661
+
662
+ def add_backup_task
663
+ log_task __method__
664
+
665
+ file 'lib/tasks/orats/backup.rake', <<-'S'
666
+ namespace :orats do
667
+ desc 'Create a backup of your application for a specific environment'
668
+ task :backup do
669
+ if File.exist?('.env') && File.file?('.env')
670
+ require 'dotenv'
671
+ Dotenv.load
672
+ source_external_env = ''
673
+ else
674
+ source_external_env = '. /etc/default/app_name &&'
675
+ end
676
+
677
+ # hack'ish way to run the backup command with elevated privileges, it won't prompt for a password on the production
678
+ # server because passwordless sudo has been enabled if you use the ansible setup provided by orats
679
+ system 'sudo whoami'
680
+
681
+ system "#{source_external_env} backup perform -t backup -c '#{File.join('lib', 'backup', 'config.rb')}' --log-path='#{File.join('log')}'"
682
+ end
683
+ end
684
+ S
685
+ gsub_file 'lib/tasks/orats/backup.rake', 'app_name', app_name
686
+ git_commit 'Add an application backup task'
687
+ end
688
+
689
+ def add_helpers
690
+ log_task __method__
691
+
692
+ inject_into_file 'app/helpers/application_helper.rb', after: "ApplicationHelper\n" do <<-S
740
693
  def title(page_title)
741
694
  content_for(:title) { page_title }
742
695
  end
@@ -773,7 +726,6 @@ inject_into_file 'app/helpers/application_helper.rb', after: "ApplicationHelper\
773
726
 
774
727
  def humanize_boolean(input)
775
728
  input ||= ''
776
-
777
729
  case input.to_s.downcase
778
730
  when 't', 'true'
779
731
  'Yes'
@@ -789,21 +741,16 @@ inject_into_file 'app/helpers/application_helper.rb', after: "ApplicationHelper\
789
741
  'danger'
790
742
  end
791
743
  end
792
- CODE
744
+ S
745
+ end
746
+ git_commit 'Add various helpers'
793
747
  end
794
748
 
795
- git add: '-A'
796
- git commit: "-m 'Add favicon and boolean view helpers'"
797
-
798
- # ----- Creating view files ---------------------------------------------------------------------------
749
+ def add_layout
750
+ log_task __method__
799
751
 
800
- puts
801
- say_status 'views', 'Creating view files...', :yellow
802
- puts '-'*80, ''; sleep 0.25
803
-
804
- run 'rm -f app/views/layouts/application.html.erb'
805
-
806
- file 'app/views/layouts/application.html.erb', <<-HTML
752
+ run 'rm -f app/views/layouts/application.html.erb'
753
+ file 'app/views/layouts/application.html.erb', <<-S
807
754
  <!doctype html>
808
755
  <html lang="en">
809
756
  <head>
@@ -813,7 +760,8 @@ file 'app/views/layouts/application.html.erb', <<-HTML
813
760
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
814
761
  <meta name="description" content="<%= yield :meta_description %>" />
815
762
  <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
816
- <%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', 'application', 'data-turbolinks-track' => true %>
763
+ <%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js',
764
+ 'application', 'data-turbolinks-track' => true %>
817
765
  <%= csrf_meta_tags %>
818
766
  <%= link_to_all_favicons %>
819
767
  <!--[if lt IE 9]>
@@ -823,6 +771,7 @@ file 'app/views/layouts/application.html.erb', <<-HTML
823
771
  <![endif]-->
824
772
  <%= render 'layouts/google_analytics_snippet' %>
825
773
  </head>
774
+
826
775
  <body>
827
776
  <%= render 'layouts/google_analytics_tracker' %>
828
777
  <header>
@@ -833,26 +782,6 @@ file 'app/views/layouts/application.html.erb', <<-HTML
833
782
  <div class="page-header">
834
783
  <h1><%= yield :heading %></h1>
835
784
  </div>
836
- <h4>Using disqus</h4>
837
- <p>Disqus related html and javascript will only be loaded when the short name is not empty.</p>
838
- <ul>
839
- <li>Set the <code>DISQUS_SHORT_NAME</code> env variable in <code>.env</code> and restart the server</li>
840
- <li>
841
- To output the main comments (place this where you want it):
842
- <ul><li>&lt;%= render 'layouts/disqus_comments_snippet' %&gt;</li></ul>
843
- </li>
844
- <li>
845
- <strong>(optional)</strong> The count snippet is already right before &lt;/body&gt;
846
- <ul>
847
- <li>
848
- <strong>(optional)</strong> Append #disqus_thread to the href attribute in your links.<br />
849
- This will tell Disqus which links to look up and return the comment count.<br />
850
- For example: <a href="http://foo.com/bar.html#disqus_thread">Link</a>.
851
- </li>
852
- </ul>
853
- </li>
854
- </ul>
855
-
856
785
  <%= render 'layouts/flash' %>
857
786
  <%= yield %>
858
787
  </main>
@@ -867,12 +796,14 @@ file 'app/views/layouts/application.html.erb', <<-HTML
867
796
  <%= render 'layouts/disqus_count_snippet' %>
868
797
  </body>
869
798
  </html>
870
- HTML
799
+ S
800
+ git_commit 'Add layout'
801
+ end
871
802
 
872
- git add: '-A'
873
- git commit: "-m 'Add new layout view'"
803
+ def add_layout_partials
804
+ log_task __method__
874
805
 
875
- file 'app/views/layouts/_flash.html.erb', <<-'HTML'
806
+ file 'app/views/layouts/_flash.html.erb', <<-'S'
876
807
  <% flash.each do |key, msg| %>
877
808
  <% unless key == :timedout %>
878
809
  <%= content_tag :div, class: "alert alert-dismissable alert-#{key}" do -%>
@@ -883,12 +814,9 @@ file 'app/views/layouts/_flash.html.erb', <<-'HTML'
883
814
  <% end %>
884
815
  <% end %>
885
816
  <% end %>
886
- HTML
887
-
888
- git add: '-A'
889
- git commit: "-m 'Add flash message partial'"
817
+ S
890
818
 
891
- file 'app/views/layouts/_navigation.html.erb', <<-HTML
819
+ file 'app/views/layouts/_navigation.html.erb', <<-S
892
820
  <nav class="navbar navbar-default">
893
821
  <div class="container">
894
822
  <div class="navbar-header">
@@ -898,7 +826,7 @@ file 'app/views/layouts/_navigation.html.erb', <<-HTML
898
826
  <span class="icon-bar"></span>
899
827
  <span class="icon-bar"></span>
900
828
  </button>
901
- <%= link_to '#{app_name}', '#root_path_would_go_here', class: 'navbar-brand' %>
829
+ <%= link_to '#{app_name}', root_path, class: 'navbar-brand' %>
902
830
  </div>
903
831
  <div class="collapse navbar-collapse">
904
832
  <ul class="nav navbar-nav">
@@ -907,33 +835,23 @@ file 'app/views/layouts/_navigation.html.erb', <<-HTML
907
835
  </div>
908
836
  </div>
909
837
  </nav>
910
- HTML
838
+ S
911
839
 
912
- git add: '-A'
913
- git commit: "-m 'Add navigation partial'"
914
-
915
- file 'app/views/layouts/_navigation_links.html.erb', <<-HTML
916
- <li class="active">
917
- <%= link_to 'Bar', '#' %>
840
+ file 'app/views/layouts/_navigation_links.html.erb', <<-S
841
+ <li>
842
+ <%= link_to 'Sidekiq dashboard', '/sidekiq' %>
918
843
  </li>
919
- HTML
920
-
921
- git add: '-A'
922
- git commit: "-m 'Add navigation links partial'"
844
+ S
923
845
 
924
- file 'app/views/layouts/_footer.html.erb', <<-HTML
846
+ file 'app/views/layouts/_footer.html.erb', <<-S
925
847
  <p class="text-muted">&copy; #{Time.now.year.to_s} #{app_name} - All rights reserved</p>
926
- HTML
848
+ S
927
849
 
928
- git add: '-A'
929
- git commit: "-m 'Add footer partial'"
930
-
931
- file 'app/views/layouts/_google_analytics_snippet.html.erb', <<-HTML
850
+ file 'app/views/layouts/_google_analytics_snippet.html.erb', <<-S
932
851
  <script type="text/javascript">
933
852
  var _gaq = _gaq || [];
934
853
  <% if ENV['GOOGLE_ANALYTICS_UA'].present? %>
935
854
  _gaq.push(['_setAccount', '<%= ENV["GOOGLE_ANALYTICS_UA"] %>']);
936
-
937
855
  (function() {
938
856
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
939
857
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
@@ -941,41 +859,38 @@ file 'app/views/layouts/_google_analytics_snippet.html.erb', <<-HTML
941
859
  })();
942
860
  <% end %>
943
861
  </script>
944
- HTML
862
+ S
945
863
 
946
- file 'app/views/layouts/_google_analytics_tracker.html.erb', <<-HTML
864
+ file 'app/views/layouts/_google_analytics_tracker.html.erb', <<-S
947
865
  <script type="text/javascript">
948
866
  // This is added in the body to track both turbolinks and regular hits.
949
867
  _gaq.push(['_trackPageview']);
950
868
  </script>
951
- HTML
952
-
953
- git add: '-A'
954
- git commit: "-m 'Add google analytics partials'"
869
+ S
955
870
 
956
- file 'app/views/layouts/_disqus_comments_snippet.html.erb', <<-HTML
871
+ file 'app/views/layouts/_disqus_comments_snippet.html.erb', <<-S
957
872
  <% if ENV['DISQUS_SHORT_NAME'].present? %>
958
873
  <div id="disqus_thread"></div>
959
874
  <script type="text/javascript">
960
875
  var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
961
-
962
876
  (function() {
963
877
  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
964
878
  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
965
879
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
966
880
  })();
967
881
  </script>
968
- <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
882
+ <noscript>
883
+ Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>
884
+ </noscript>
969
885
  <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
970
886
  <% end %>
971
- HTML
887
+ S
972
888
 
973
- file 'app/views/layouts/_disqus_count_snippet.html.erb', <<-HTML
889
+ file 'app/views/layouts/_disqus_count_snippet.html.erb', <<-S
974
890
  <% if ENV['DISQUS_SHORT_NAME'].present? %>
975
891
  <div id="disqus_thread"></div>
976
892
  <script type="text/javascript">
977
893
  var disqus_shortname = '<%= ENV["DISQUS_SHORT_NAME"] %>';
978
-
979
894
  (function () {
980
895
  var s = document.createElement('script'); s.async = true;
981
896
  s.type = 'text/javascript';
@@ -983,22 +898,17 @@ file 'app/views/layouts/_disqus_count_snippet.html.erb', <<-HTML
983
898
  (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
984
899
  }());
985
900
  <% end %>
986
- HTML
987
-
988
- git add: '-A'
989
- git commit: "-m 'Add disqus partials'"
990
-
991
- # ----- Creating public files -------------------------------------------------------------------------
992
-
993
- puts
994
- say_status 'public', 'Creating public files...', :yellow
995
- puts '-'*80, ''; sleep 0.25
901
+ S
902
+ git_commit 'Add layout partials'
903
+ end
996
904
 
997
- run 'rm -f public/404.html'
998
- run 'rm -f public/422.html'
999
- run 'rm -f public/500.html'
905
+ def add_http_error_pages
906
+ log_task __method__
1000
907
 
1001
- file 'public/404.html', <<-HTML
908
+ run 'rm -f public/404.html'
909
+ run 'rm -f public/422.html'
910
+ run 'rm -f public/500.html'
911
+ file 'public/404.html', <<-S
1002
912
  <!DOCTYPE html>
1003
913
  <html>
1004
914
  <head>
@@ -1012,9 +922,9 @@ file 'public/404.html', <<-HTML
1012
922
  <h1>Error 404</h1>
1013
923
  </body>
1014
924
  </html>
1015
- HTML
925
+ S
1016
926
 
1017
- file 'public/422.html', <<-HTML
927
+ file 'public/422.html', <<-S
1018
928
  <!DOCTYPE html>
1019
929
  <html>
1020
930
  <head>
@@ -1028,9 +938,9 @@ file 'public/422.html', <<-HTML
1028
938
  <h1>Error 422</h1>
1029
939
  </body>
1030
940
  </html>
1031
- HTML
941
+ S
1032
942
 
1033
- file 'public/500.html', <<-HTML
943
+ file 'public/500.html', <<-S
1034
944
  <!DOCTYPE html>
1035
945
  <html>
1036
946
  <head>
@@ -1044,47 +954,34 @@ file 'public/500.html', <<-HTML
1044
954
  <h1>Error 500</h1>
1045
955
  </body>
1046
956
  </html>
1047
- HTML
957
+ S
1048
958
 
1049
- file 'public/502.html', <<-HTML
959
+ file 'public/502.html', <<-S
1050
960
  <!DOCTYPE html>
1051
961
  <html>
1052
962
  <head>
963
+
1053
964
  <title>Error 502</title>
1054
965
  <meta charset="utf-8" />
1055
966
  <style>
1056
967
  </style>
1057
968
  </head>
1058
-
1059
969
  <body>
1060
970
  <h1>Error 502</h1>
1061
971
  </body>
1062
972
  </html>
1063
- HTML
1064
-
1065
- git add: '-A'
1066
- git commit: "-m 'Add public 404, 422, 500 and 502 error pages'"
1067
-
1068
- # ----- Modifying sass files --------------------------------------------------------------------------
1069
-
1070
- puts
1071
- say_status 'assets', 'Modifying sass files...', :yellow
1072
- puts '-'*80, ''; sleep 0.25
1073
-
1074
- run 'mv app/assets/stylesheets/application.css app/assets/stylesheets/application.css.scss'
1075
-
1076
- git add: '-A'
1077
- git commit: "-m 'Rename application.css to application.scss'"
1078
- git add: '-u'
1079
-
1080
- inject_into_file 'app/assets/stylesheets/application.css.scss',
1081
- " *= require font-awesome\n",
1082
- before: " *= require_self\n"
973
+ S
974
+ git_commit 'Add http status code pages'
975
+ end
1083
976
 
1084
- git add: '-A'
1085
- git commit: "-m 'Add font-awesome to the application.scss file'"
977
+ def update_sass
978
+ log_task __method__
1086
979
 
1087
- append_file 'app/assets/stylesheets/application.css.scss' do <<-SCSS
980
+ run 'mv app/assets/stylesheets/application.css app/assets/stylesheets/application.css.scss'
981
+ inject_into_file 'app/assets/stylesheets/application.css.scss',
982
+ " *= require font-awesome\n",
983
+ before: " *= require_self\n"
984
+ append_file 'app/assets/stylesheets/application.css.scss' do <<-S
1088
985
 
1089
986
  // Core variables and mixins
1090
987
  @import "bootstrap/variables";
@@ -1146,7 +1043,6 @@ append_file 'app/assets/stylesheets/application.css.scss' do <<-SCSS
1146
1043
 
1147
1044
  img {
1148
1045
  @extend .img-responsive;
1149
- margin: 0 auto;
1150
1046
  }
1151
1047
 
1152
1048
  .validation-error {
@@ -1154,28 +1050,21 @@ img {
1154
1050
  color: $brand-danger;
1155
1051
  font-size: $font-size-small;
1156
1052
  }
1157
- SCSS
1053
+ S
1054
+ end
1055
+ git_commit 'Add font-awesome, bootstrap and a few default styles'
1158
1056
  end
1159
1057
 
1160
- # ----- Modifying javascript and coffeescript files ------------------------------------------------------------------
1161
-
1162
- puts
1163
- say_status 'assets', 'Modifying javascript and coffeescript files...', :yellow
1164
- puts '-'*80, ''; sleep 0.25
1165
-
1166
- gsub_file 'app/assets/javascripts/application.js', "//= require jquery\n", ''
1058
+ def update_coffeescript
1059
+ log_task __method__
1167
1060
 
1168
- git add: '-A'
1169
- git commit: "-m 'Remove jquery from the application.js file because it is loaded from a CDN'"
1061
+ gsub_file 'app/assets/javascripts/application.js', "//= require jquery\n", ''
1062
+ git_commit 'Remove jquery because it is loaded from a CDN'
1170
1063
 
1171
- inject_into_file 'app/assets/javascripts/application.js',
1172
- "//= require jquery.turbolinks\n",
1173
- before: "//= require_tree .\n"
1174
-
1175
- git add: '-A'
1176
- git commit: "-m 'Add jquery-turbolinks to the application.js file'"
1177
-
1178
- inject_into_file 'app/assets/javascripts/application.js', before: "//= require_tree .\n" do <<-CODE
1064
+ inject_into_file 'app/assets/javascripts/application.js',
1065
+ "//= require jquery.turbolinks\n",
1066
+ before: "//= require_tree .\n"
1067
+ inject_into_file 'app/assets/javascripts/application.js', before: "//= require_tree .\n" do <<-S
1179
1068
  //= require bootstrap/affix
1180
1069
  //= require bootstrap/alert
1181
1070
  //= require bootstrap/button
@@ -1183,38 +1072,50 @@ inject_into_file 'app/assets/javascripts/application.js', before: "//= require_t
1183
1072
  //= require bootstrap/collapse
1184
1073
  //= require bootstrap/dropdown
1185
1074
  //= require bootstrap/modal
1075
+ //= require bootstrap/tooltip
1186
1076
  //= require bootstrap/popover
1187
1077
  //= require bootstrap/scrollspy
1188
1078
  //= require bootstrap/tab
1189
- //= require bootstrap/tooltip
1190
1079
  //= require bootstrap/transition
1191
- CODE
1080
+ S
1081
+ end
1082
+ git_commit 'Add jquery.turbolinks and bootstrap'
1192
1083
  end
1193
1084
 
1194
- git add: '-A'
1195
- git commit: "-m 'Add bootstrap to the application.js file'"
1196
-
1197
- # ----- Modifying gem file ----------------------------------------------------------------------------
1198
-
1199
- puts
1200
- say_status 'root', 'Copying Gemfile...', :yellow
1201
- puts '-'*80, ''; sleep 0.25
1202
-
1203
- run 'rm -f Gemfile'
1204
- from_gem 'Gemfile', 'Gemfile'
1085
+ def remove_unused_files_from_git
1086
+ log_task __method__
1205
1087
 
1206
- git add: '-A'
1207
- git commit: "-m 'Add basic gems to the Gemfile'"
1208
-
1209
- # ----- Adding default favicon-------------------------------------------------------------------------
1210
-
1211
- puts
1212
- say_status 'assets', 'Copying default favicon...', :yellow
1213
- puts '-'*80, ''; sleep 0.25
1088
+ git add: '-u'
1089
+ git_commit 'Remove unused files'
1090
+ end
1214
1091
 
1215
- base_path = "#{File.expand_path File.dirname(__FILE__)}/includes"
1216
- run 'mkdir -p app/assets/favicon'
1217
- run "cp #{base_path}/app/assets/favicon/favicon_base.png app/assets/favicon/favicon_base.png"
1092
+ # ---
1218
1093
 
1219
- git add: '-A'
1220
- git commit: "-m 'Add default 256x256 favicon'"
1094
+ initial_git_commit
1095
+ update_gitignore
1096
+ copy_gemfile
1097
+ copy_base_favicon
1098
+ add_dotenv
1099
+ add_procfile
1100
+ update_app_secrets
1101
+ update_app_config
1102
+ update_database_config
1103
+ add_puma_config
1104
+ add_sidekiq_config
1105
+ add_sitemap_config
1106
+ add_whenever_config
1107
+ add_sidekiq_initializer
1108
+ add_mini_profiler_initializer
1109
+ add_staging_environment
1110
+ update_production_environment
1111
+ update_routes
1112
+ add_backup_lib
1113
+ add_favicon_task
1114
+ add_backup_task
1115
+ add_helpers
1116
+ add_layout
1117
+ add_layout_partials
1118
+ add_http_error_pages
1119
+ update_sass
1120
+ update_coffeescript
1121
+ remove_unused_files_from_git