orats 0.9.7 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.rubocop.yml +24 -0
  4. data/.travis.yml +9 -0
  5. data/README.md +103 -194
  6. data/bin/orats +2 -5
  7. data/lib/orats/cli.rb +6 -67
  8. data/lib/orats/cli_help/destroy +11 -0
  9. data/lib/orats/cli_help/new +2 -26
  10. data/lib/orats/commands/new.rb +127 -0
  11. data/lib/orats/common.rb +0 -29
  12. data/lib/orats/templates/base/.dockerignore +5 -0
  13. data/lib/orats/templates/base/.gitignore +22 -0
  14. data/lib/orats/templates/base/.rubocop.yml +29 -0
  15. data/lib/orats/templates/base/Dockerfile +102 -0
  16. data/lib/orats/templates/base/Gemfile +69 -0
  17. data/lib/orats/templates/base/Gemfile.lock +205 -0
  18. data/lib/orats/templates/base/README.md +24 -0
  19. data/lib/orats/templates/base/Rakefile +7 -0
  20. data/lib/orats/templates/base/app/assets/config/manifest.js +3 -0
  21. data/lib/orats/templates/base/app/assets/images/.keep +0 -0
  22. data/lib/orats/templates/base/app/assets/javascripts/application.js +33 -0
  23. data/lib/orats/templates/base/app/assets/javascripts/cable.js +14 -0
  24. data/lib/orats/templates/base/app/assets/javascripts/channels/.keep +0 -0
  25. data/lib/orats/templates/base/app/assets/stylesheets/application.scss +89 -0
  26. data/lib/orats/templates/base/app/channels/application_cable/channel.rb +4 -0
  27. data/lib/orats/templates/base/app/channels/application_cable/connection.rb +4 -0
  28. data/lib/orats/templates/base/app/controllers/application_controller.rb +3 -0
  29. data/lib/orats/templates/base/app/controllers/concerns/.keep +0 -0
  30. data/lib/orats/templates/base/app/controllers/pages_controller.rb +4 -0
  31. data/lib/orats/templates/base/app/helpers/application_helper.rb +31 -0
  32. data/lib/orats/templates/base/app/helpers/pages_helper.rb +2 -0
  33. data/lib/orats/templates/base/app/jobs/application_job.rb +2 -0
  34. data/lib/orats/templates/base/app/mailers/application_mailer.rb +4 -0
  35. data/lib/orats/templates/base/app/models/application_record.rb +3 -0
  36. data/lib/orats/templates/base/app/models/concerns/.keep +0 -0
  37. data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_flash.html.erb +1 -1
  38. data/lib/orats/templates/base/app/views/layouts/_footer.html.erb +3 -0
  39. 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
  40. data/lib/orats/templates/{includes/new/rails → base}/app/views/layouts/_navigation.html.erb +5 -4
  41. data/lib/orats/templates/base/app/views/layouts/application.html.erb +48 -0
  42. data/lib/orats/templates/base/app/views/layouts/mailer.html.erb +13 -0
  43. data/lib/orats/templates/base/app/views/layouts/mailer.text.erb +1 -0
  44. data/lib/orats/templates/base/app/views/pages/home.html.erb +46 -0
  45. data/lib/orats/templates/base/bin/bundle +3 -0
  46. data/lib/orats/templates/base/bin/rails +4 -0
  47. data/lib/orats/templates/base/bin/rake +4 -0
  48. data/lib/orats/templates/base/bin/setup +34 -0
  49. data/lib/orats/templates/base/bin/update +29 -0
  50. data/lib/orats/templates/base/cable/config.ru +4 -0
  51. data/lib/orats/templates/base/config.ru +5 -0
  52. data/lib/orats/templates/base/config/application.rb +71 -0
  53. data/lib/orats/templates/base/config/boot.rb +3 -0
  54. data/lib/orats/templates/base/config/cable.yml +14 -0
  55. data/lib/orats/templates/base/config/database.yml +13 -0
  56. data/lib/orats/templates/base/config/environment.rb +5 -0
  57. data/lib/orats/templates/base/config/environments/development.rb +49 -0
  58. data/lib/orats/templates/base/config/environments/production.rb +56 -0
  59. data/lib/orats/templates/base/config/environments/staging.rb +6 -0
  60. data/lib/orats/templates/base/config/environments/test.rb +40 -0
  61. data/lib/orats/templates/base/config/initializers/application_controller_renderer.rb +6 -0
  62. data/lib/orats/templates/base/config/initializers/assets.rb +12 -0
  63. data/lib/orats/templates/base/config/initializers/backtrace_silencers.rb +9 -0
  64. data/lib/orats/templates/base/config/initializers/cookies_serializer.rb +5 -0
  65. data/lib/orats/templates/base/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/lib/orats/templates/base/config/initializers/inflections.rb +16 -0
  67. data/lib/orats/templates/base/config/initializers/mime_types.rb +4 -0
  68. data/lib/orats/templates/base/config/initializers/new_framework_defaults.rb +27 -0
  69. data/lib/orats/templates/base/config/initializers/session_store.rb +4 -0
  70. data/lib/orats/templates/{includes/new/rails → base}/config/initializers/sidekiq.rb +1 -4
  71. data/lib/orats/templates/base/config/initializers/timeout.rb +1 -0
  72. data/lib/orats/templates/base/config/initializers/wrap_parameters.rb +15 -0
  73. data/lib/orats/templates/base/config/locales/en.yml +23 -0
  74. data/lib/orats/templates/base/config/puma.rb +60 -0
  75. data/lib/orats/templates/base/config/routes.rb +3 -0
  76. data/lib/orats/templates/{includes/new/rails → base}/config/secrets.yml +3 -2
  77. data/lib/orats/templates/base/config/sidekiq.yml.erb +5 -0
  78. data/lib/orats/templates/base/config/spring.rb +6 -0
  79. data/lib/orats/templates/base/db/seeds.rb +9 -0
  80. data/lib/orats/templates/base/docker-compose.yml +59 -0
  81. data/lib/orats/templates/base/lib/assets/.keep +0 -0
  82. data/lib/orats/templates/base/lib/tasks/.keep +0 -0
  83. data/lib/orats/templates/base/log/.keep +0 -0
  84. data/lib/orats/templates/base/public/404.html +67 -0
  85. data/lib/orats/templates/base/public/422.html +67 -0
  86. data/lib/orats/templates/base/public/500.html +66 -0
  87. data/lib/orats/templates/base/public/apple-touch-icon-precomposed.png +0 -0
  88. data/lib/orats/templates/base/public/apple-touch-icon.png +0 -0
  89. data/lib/orats/templates/base/public/favicon.ico +0 -0
  90. data/lib/orats/templates/base/public/robots.txt +5 -0
  91. data/lib/orats/templates/base/test/controllers/.keep +0 -0
  92. data/lib/orats/templates/base/test/controllers/pages_controller_test.rb +9 -0
  93. data/lib/orats/templates/base/test/fixtures/.keep +0 -0
  94. data/lib/orats/templates/base/test/fixtures/files/.keep +0 -0
  95. data/lib/orats/templates/base/test/helpers/.keep +0 -0
  96. data/lib/orats/templates/base/test/integration/.keep +0 -0
  97. data/lib/orats/templates/base/test/mailers/.keep +0 -0
  98. data/lib/orats/templates/base/test/models/.keep +0 -0
  99. data/lib/orats/templates/base/test/test_helper.rb +11 -0
  100. data/lib/orats/templates/base/tmp/.keep +0 -0
  101. data/lib/orats/templates/base/vendor/assets/javascripts/.keep +0 -0
  102. data/lib/orats/templates/base/vendor/assets/stylesheets/.keep +0 -0
  103. data/lib/orats/ui.rb +5 -5
  104. data/lib/orats/util.rb +14 -0
  105. data/lib/orats/version.rb +1 -1
  106. data/orats.gemspec +3 -2
  107. data/test/integration/cli_test.rb +43 -65
  108. data/test/test_helper.rb +9 -58
  109. metadata +114 -66
  110. data/lib/orats/argv_adjust.rb +0 -61
  111. data/lib/orats/cli_help/nuke +0 -19
  112. data/lib/orats/commands/new/exec.rb +0 -59
  113. data/lib/orats/commands/new/rails.rb +0 -215
  114. data/lib/orats/commands/new/server.rb +0 -67
  115. data/lib/orats/commands/nuke.rb +0 -108
  116. data/lib/orats/postgres.rb +0 -92
  117. data/lib/orats/process.rb +0 -35
  118. data/lib/orats/redis.rb +0 -25
  119. data/lib/orats/shell.rb +0 -12
  120. data/lib/orats/templates/auth.rb +0 -394
  121. data/lib/orats/templates/base.rb +0 -546
  122. data/lib/orats/templates/includes/common/.gitignore +0 -6
  123. data/lib/orats/templates/includes/common/LICENSE +0 -22
  124. data/lib/orats/templates/includes/new/rails/.env +0 -59
  125. data/lib/orats/templates/includes/new/rails/Gemfile +0 -48
  126. data/lib/orats/templates/includes/new/rails/Procfile +0 -3
  127. data/lib/orats/templates/includes/new/rails/README.md +0 -3
  128. data/lib/orats/templates/includes/new/rails/app/assets/favicon/favicon_base.png +0 -0
  129. data/lib/orats/templates/includes/new/rails/app/helpers/application_helper.rb +0 -53
  130. data/lib/orats/templates/includes/new/rails/app/models/account.rb +0 -40
  131. data/lib/orats/templates/includes/new/rails/app/views/devise/confirmations/new.html.erb +0 -26
  132. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
  133. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/reset_password_instructions.html.erb +0 -10
  134. data/lib/orats/templates/includes/new/rails/app/views/devise/mailer/unlock_instructions.html.erb +0 -8
  135. data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/edit.html.erb +0 -28
  136. data/lib/orats/templates/includes/new/rails/app/views/devise/passwords/new.html.erb +0 -26
  137. data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/edit.html.erb +0 -51
  138. data/lib/orats/templates/includes/new/rails/app/views/devise/registrations/new.html.erb +0 -31
  139. data/lib/orats/templates/includes/new/rails/app/views/devise/sessions/new.html.erb +0 -39
  140. data/lib/orats/templates/includes/new/rails/app/views/devise/shared/_links.html.erb +0 -38
  141. data/lib/orats/templates/includes/new/rails/app/views/devise/unlocks/new.html.erb +0 -26
  142. data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_comments_snippet.html.erb +0 -19
  143. data/lib/orats/templates/includes/new/rails/app/views/layouts/_disqus_count_snippet.html.erb +0 -12
  144. data/lib/orats/templates/includes/new/rails/app/views/layouts/_footer.html.erb +0 -2
  145. data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_auth.html.erb +0 -15
  146. data/lib/orats/templates/includes/new/rails/app/views/layouts/_navigation_links.html.erb +0 -3
  147. data/lib/orats/templates/includes/new/rails/app/views/layouts/application.html.erb +0 -47
  148. data/lib/orats/templates/includes/new/rails/app/views/pages/home.html.erb +0 -58
  149. data/lib/orats/templates/includes/new/rails/config/database.yml +0 -6
  150. data/lib/orats/templates/includes/new/rails/config/environments/staging.rb +0 -5
  151. data/lib/orats/templates/includes/new/rails/config/initializers/devise_async.rb +0 -1
  152. data/lib/orats/templates/includes/new/rails/config/initializers/mini_profiler.rb +0 -4
  153. data/lib/orats/templates/includes/new/rails/config/puma.rb +0 -39
  154. data/lib/orats/templates/includes/new/rails/config/schedule.rb +0 -3
  155. data/lib/orats/templates/includes/new/rails/config/sidekiq.yml +0 -7
  156. data/lib/orats/templates/includes/new/rails/config/sitemap.rb +0 -20
  157. data/lib/orats/templates/includes/new/rails/config/unicorn.rb +0 -84
  158. data/lib/orats/templates/includes/new/rails/lib/tasks/orats/favicon.rake +0 -48
  159. data/lib/orats/templates/includes/new/rails/public/404.html +0 -13
  160. data/lib/orats/templates/includes/new/rails/public/422.html +0 -13
  161. data/lib/orats/templates/includes/new/rails/public/500.html +0 -13
  162. data/lib/orats/templates/includes/new/rails/public/502.html +0 -13
  163. data/lib/orats/templates/includes/new/rails/public/deploy.html +0 -14
  164. data/lib/orats/templates/includes/new/rails/test/fixtures/accounts.yml +0 -27
  165. data/lib/orats/templates/includes/new/rails/test/models/account_test.rb +0 -46
@@ -0,0 +1,2 @@
1
+ module PagesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: ENV['ACTION_MAILER_DEFAULT_FROM']
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -7,4 +7,4 @@
7
7
  <%= msg %>
8
8
  <% end %>
9
9
  <% end %>
10
- <% end %>
10
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <p class="text-muted">
2
+ &copy; <%= Time.now.year.to_s %> OratsBase - All rights reserved
3
+ </p>
@@ -1,21 +1,17 @@
1
1
  <% if ENV['GOOGLE_ANALYTICS_UA'].present? %>
2
- <script data-turbolinks-eval="false">
2
+ <script>
3
3
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4
4
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5
5
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
7
-
8
- ga('create', '<%= ENV["GOOGLE_ANALYTICS_UA"] %>', 'auto');
9
- </script>
6
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
10
7
 
11
- <script>
12
8
  // Enable 'Demographics and interest reports' in your analytics settings
13
9
  // ga('require', 'displayfeatures');
14
10
 
15
11
  // Enable 'Use enhanced link attribution' in your analytics settings
16
12
  // ga('require', 'linkid', 'linkid.js');
17
13
 
18
- ga('set', 'location', location.href.split('#')[0]);
19
- ga('send', 'pageview', { 'title': document.title });
14
+ ga('create', '<%= ENV["GOOGLE_ANALYTICS_UA"] %>', 'auto');
15
+ ga('send', 'pageview');
20
16
  </script>
21
- <% end %>
17
+ <% end %>
@@ -1,18 +1,19 @@
1
1
  <nav class="navbar navbar-default">
2
2
  <div class="container">
3
3
  <div class="navbar-header">
4
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
4
+ <button type="button" class="navbar-toggle" data-toggle="collapse"
5
+ data-target=".navbar-collapse">
5
6
  <span class="sr-only">Toggle navigation</span>
6
7
  <span class="icon-bar"></span>
7
8
  <span class="icon-bar"></span>
8
9
  <span class="icon-bar"></span>
9
10
  </button>
10
- <%= link_to 'app_name', root_path, class: 'navbar-brand' %>
11
+ <%= link_to 'OratsBase', root_path, class: 'navbar-brand' %>
11
12
  </div>
12
13
  <div class="collapse navbar-collapse">
13
14
  <ul class="nav navbar-nav">
14
- <%= render 'layouts/navigation_links' %>
15
+ <li><%= link_to 'Test nav item', root_path %></li>
15
16
  </ul>
16
17
  </div>
17
18
  </div>
18
- </nav>
19
+ </nav>
@@ -0,0 +1,48 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title><%= yield :title %></title>
5
+ <meta charset="utf-8"/>
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <meta name="description" content="<%= yield :meta_description %>"/>
9
+
10
+ <%= action_cable_meta_tag %>
11
+
12
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
13
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
14
+
15
+ <%= csrf_meta_tags %>
16
+
17
+ <!--[if lt IE 9]>
18
+ <script
19
+ src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
20
+ <script
21
+ src="//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"></script>
22
+ <script
23
+ src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
24
+ <![endif]-->
25
+ </head>
26
+
27
+ <body>
28
+ <%= render 'layouts/google_analytics' %>
29
+ <header>
30
+ <%= render 'layouts/navigation' %>
31
+ </header>
32
+
33
+ <main role="main" class="container">
34
+ <div class="page-header">
35
+ <h1><%= yield :heading %></h1>
36
+ </div>
37
+ <%= render 'layouts/flash' %>
38
+ <%= yield %>
39
+ </main>
40
+
41
+ <footer>
42
+ <hr/>
43
+ <div class="container">
44
+ <%= render 'layouts/footer' %>
45
+ </div>
46
+ </footer>
47
+ </body>
48
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1,46 @@
1
+ <%
2
+ title "Yay! You're on Rails!"
3
+ meta_description 'Meta descriptions are useful for SEO purposes.'
4
+ heading "Yay! You're on Rails!"
5
+ %>
6
+
7
+ <div class="row">
8
+ <div class="col-sm-8">
9
+ <p class="lead">
10
+ You have successfully generated this project
11
+ with <%= link_to 'orats', 'https://github.com/nickjj/orats' %> vVERSION.
12
+ </p>
13
+
14
+ <p>
15
+ <%= image_tag 'https://badge.fury.io/rb/orats.png', alt: 'Gem badge' %>
16
+ is the latest version.
17
+ </p>
18
+
19
+ <hr/>
20
+
21
+ <h3>Learn more about Docker and this project</h3>
22
+
23
+ <ul>
24
+ <li>
25
+ <%= link_to 'Learn how this application was Dockerized', 'http://nickjanetakis.com/blog/dockerize-a-rails-5-postgres-redis-sidekiq-action-cable-app-with-docker-compose' %>
26
+ </li>
27
+ </ul>
28
+
29
+ <hr/>
30
+
31
+ <h3>Want to get rid of this page?</h3>
32
+
33
+ <p>No problem, just follow these steps:</p>
34
+
35
+ <ul>
36
+ <li>
37
+ Run <code>docker-compose exec website rails d controller Pages</code>
38
+ </li>
39
+ <li>
40
+ Remove the root route from <code>config/routes.rb</code>
41
+ </li>
42
+ </ul>
43
+ </div>
44
+
45
+ <div class="col-sm-4"></div>
46
+ </div>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -0,0 +1,4 @@
1
+ require_relative '../config/environment'
2
+ Rails.application.eager_load!
3
+
4
+ run ActionCable.server
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,71 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module OratsBase
10
+ class Application < Rails::Application
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Set up logging to be the same in all environments but control the level
15
+ # through an environment variable.
16
+ config.log_level = ENV['LOG_LEVEL']
17
+
18
+ # Log to STDOUT because Docker expects all processes to log here. You could
19
+ # then redirect logs to a third party service on your own such as systemd,
20
+ # or a third party host such as Loggly, etc..
21
+ logger = ActiveSupport::Logger.new(STDOUT)
22
+ logger.formatter = config.log_formatter
23
+ config.log_tags = [:subdomain, :uuid]
24
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
25
+
26
+ # Action mailer settings.
27
+ config.action_mailer.delivery_method = :smtp
28
+ config.action_mailer.smtp_settings = {
29
+ address: ENV['SMTP_ADDRESS'],
30
+ port: ENV['SMTP_PORT'].to_i,
31
+ domain: ENV['SMTP_DOMAIN'],
32
+ user_name: ENV['SMTP_USERNAME'],
33
+ password: ENV['SMTP_PASSWORD'],
34
+ authentication: ENV['SMTP_AUTH'],
35
+ enable_starttls_auto: ENV['SMTP_ENABLE_STARTTLS_AUTO'] == 'true'
36
+ }
37
+
38
+ config.action_mailer.default_url_options = {
39
+ host: ENV['ACTION_MAILER_HOST']
40
+ }
41
+ config.action_mailer.default_options = {
42
+ from: ENV['ACTION_MAILER_DEFAULT_FROM']
43
+ }
44
+
45
+ # Set Redis as the back-end for the cache.
46
+ config.cache_store = :redis_store, ENV['REDIS_CACHE_URL']
47
+
48
+ # Set Sidekiq as the back-end for Active Job.
49
+ config.active_job.queue_adapter = :sidekiq
50
+ config.active_job.queue_name_prefix =
51
+ "#{ENV['ACTIVE_JOB_QUEUE_PREFIX']}_#{Rails.env}"
52
+
53
+ # Action Cable setting to de-couple it from the main Rails process.
54
+ config.action_cable.url = ENV['ACTION_CABLE_FRONTEND_URL']
55
+
56
+ # Action Cable setting to allow connections from these domains.
57
+ origins = ENV['ACTION_CABLE_ALLOWED_REQUEST_ORIGINS'].split(',')
58
+ origins.map! { |url| /#{url}/ }
59
+ config.action_cable.allowed_request_origins = origins
60
+ end
61
+ end
62
+
63
+ # Show in-line form errors.
64
+ ActionView::Base.field_error_proc = proc do |html_tag, instance|
65
+ if html_tag =~ /\<label/
66
+ html_tag
67
+ else
68
+ errors = Array(instance.error_message).join(',')
69
+ %(#{html_tag}<p class="validation-error"> #{errors}</p>).html_safe
70
+ end
71
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,14 @@
1
+ ---
2
+
3
+ development: &default
4
+ adapter: redis
5
+ url: <%= ENV['ACTION_CABLE_BACKEND_URL'] %>
6
+
7
+ test:
8
+ <<: *default
9
+
10
+ staging:
11
+ <<: *default
12
+
13
+ production:
14
+ <<: *default
@@ -0,0 +1,13 @@
1
+ ---
2
+
3
+ development:
4
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_development?') %>
5
+
6
+ test:
7
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_test?') %>
8
+
9
+ staging:
10
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_staging?') %>
11
+
12
+ production:
13
+ url: <%= ENV['DATABASE_URL'].gsub('?', '_production?') %>
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,49 @@
1
+ Rails.application.configure do
2
+ # In the development environment your application's code is reloaded on
3
+ # every request. This slows down response time but is perfect for development
4
+ # since you don't have to restart the web server when you make code changes.
5
+ config.cache_classes = false
6
+
7
+ # Do not eager load code on boot.
8
+ config.eager_load = false
9
+
10
+ # Show full error reports.
11
+ config.consider_all_requests_local = true
12
+
13
+ # Enable/disable caching. By default caching is disabled.
14
+ if Rails.root.join('tmp/caching-dev.txt').exist?
15
+ config.action_controller.perform_caching = true
16
+
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => 'public, max-age=172800'
19
+ }
20
+ else
21
+ config.action_controller.perform_caching = false
22
+ end
23
+
24
+ # Don't care if the mailer can't send.
25
+ config.action_mailer.raise_delivery_errors = false
26
+
27
+ config.action_mailer.perform_caching = false
28
+
29
+ # Print deprecation notices to the Rails logger.
30
+ config.active_support.deprecation = :log
31
+
32
+ # Raise an error on page load if there are pending migrations.
33
+ config.active_record.migration_error = :page_load
34
+
35
+ # Debug mode disables concatenation and preprocessing of assets.
36
+ # This option may cause significant delays in view rendering with a large
37
+ # number of complex assets.
38
+ config.assets.debug = true
39
+
40
+ # Suppress logger output for asset requests.
41
+ config.assets.quiet = true
42
+
43
+ # Raises error for missing translations.
44
+ # config.action_view.raise_on_missing_translations = true
45
+
46
+ # Use an evented file watcher to asynchronously detect changes in source
47
+ # code, routes, locales, etc. This feature depends on the listen gem.
48
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
49
+ end