backy_rb 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.drone.yml +13 -0
  3. data/.idea/.gitignore +8 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +23 -0
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +16 -0
  8. data/Gemfile.lock +120 -0
  9. data/README.md +36 -0
  10. data/Rakefile +10 -0
  11. data/backy.gemspec +45 -0
  12. data/bucky.png +0 -0
  13. data/config/database.example.yml +15 -0
  14. data/dummy/psql/.gitattributes +7 -0
  15. data/dummy/psql/.gitignore +22 -0
  16. data/dummy/psql/.ruby-version +1 -0
  17. data/dummy/psql/Gemfile +34 -0
  18. data/dummy/psql/Gemfile.lock +207 -0
  19. data/dummy/psql/README.md +24 -0
  20. data/dummy/psql/Rakefile +6 -0
  21. data/dummy/psql/app/assets/config/manifest.js +2 -0
  22. data/dummy/psql/app/assets/images/.keep +0 -0
  23. data/dummy/psql/app/assets/stylesheets/application.css +15 -0
  24. data/dummy/psql/app/controllers/application_controller.rb +2 -0
  25. data/dummy/psql/app/controllers/concerns/.keep +0 -0
  26. data/dummy/psql/app/controllers/posts_controller.rb +59 -0
  27. data/dummy/psql/app/helpers/application_helper.rb +2 -0
  28. data/dummy/psql/app/helpers/posts_helper.rb +2 -0
  29. data/dummy/psql/app/models/application_record.rb +3 -0
  30. data/dummy/psql/app/models/concerns/.keep +0 -0
  31. data/dummy/psql/app/models/post.rb +2 -0
  32. data/dummy/psql/app/views/layouts/application.html.erb +15 -0
  33. data/dummy/psql/app/views/posts/_form.html.erb +27 -0
  34. data/dummy/psql/app/views/posts/_post.html.erb +12 -0
  35. data/dummy/psql/app/views/posts/edit.html.erb +10 -0
  36. data/dummy/psql/app/views/posts/index.html.erb +14 -0
  37. data/dummy/psql/app/views/posts/new.html.erb +9 -0
  38. data/dummy/psql/app/views/posts/show.html.erb +10 -0
  39. data/dummy/psql/bin/bundle +109 -0
  40. data/dummy/psql/bin/rails +4 -0
  41. data/dummy/psql/bin/rake +4 -0
  42. data/dummy/psql/bin/setup +33 -0
  43. data/dummy/psql/config/application.rb +43 -0
  44. data/dummy/psql/config/boot.rb +3 -0
  45. data/dummy/psql/config/credentials.yml.enc +1 -0
  46. data/dummy/psql/config/database.yml +87 -0
  47. data/dummy/psql/config/environment.rb +5 -0
  48. data/dummy/psql/config/environments/development.rb +62 -0
  49. data/dummy/psql/config/environments/production.rb +75 -0
  50. data/dummy/psql/config/environments/test.rb +50 -0
  51. data/dummy/psql/config/locales/en.yml +33 -0
  52. data/dummy/psql/config/master.key +1 -0
  53. data/dummy/psql/config/puma.rb +43 -0
  54. data/dummy/psql/config/routes.rb +7 -0
  55. data/dummy/psql/config.ru +6 -0
  56. data/dummy/psql/db/migrate/20230330203226_create_posts.rb +10 -0
  57. data/dummy/psql/db/schema.rb +23 -0
  58. data/dummy/psql/db/seeds.rb +8 -0
  59. data/dummy/psql/log/.keep +0 -0
  60. data/dummy/psql/public/404.html +67 -0
  61. data/dummy/psql/public/422.html +67 -0
  62. data/dummy/psql/public/500.html +66 -0
  63. data/dummy/psql/public/apple-touch-icon-precomposed.png +0 -0
  64. data/dummy/psql/public/apple-touch-icon.png +0 -0
  65. data/dummy/psql/public/favicon.ico +0 -0
  66. data/dummy/psql/public/robots.txt +1 -0
  67. data/dummy/psql/tmp/.keep +0 -0
  68. data/dummy/psql/tmp/pids/.keep +0 -0
  69. data/lib/backy/app_config.rb +11 -0
  70. data/lib/backy/cli.rb +0 -0
  71. data/lib/backy/configuration.rb +66 -0
  72. data/lib/backy/db.rb +29 -0
  73. data/lib/backy/list.rb +18 -0
  74. data/lib/backy/pg_dump.rb +39 -0
  75. data/lib/backy/pg_restore.rb +27 -0
  76. data/lib/backy/railtie.rb +19 -0
  77. data/lib/backy/s3.rb +27 -0
  78. data/lib/backy/s3_list.rb +31 -0
  79. data/lib/backy/s3_load.rb +41 -0
  80. data/lib/backy/s3_save.rb +33 -0
  81. data/lib/backy/version.rb +3 -0
  82. data/lib/backy.rb +30 -0
  83. data/lib/tasks/backy_tasks.rake +84 -0
  84. metadata +291 -0
@@ -0,0 +1,59 @@
1
+ class PostsController < ApplicationController
2
+ before_action :set_post, only: %i[show edit update destroy]
3
+
4
+ # GET /posts
5
+ def index
6
+ @posts = Post.all
7
+ end
8
+
9
+ # GET /posts/1
10
+ def show
11
+ end
12
+
13
+ # GET /posts/new
14
+ def new
15
+ @post = Post.new
16
+ end
17
+
18
+ # GET /posts/1/edit
19
+ def edit
20
+ end
21
+
22
+ # POST /posts
23
+ def create
24
+ @post = Post.new(post_params)
25
+
26
+ if @post.save
27
+ redirect_to @post, notice: "Post was successfully created."
28
+ else
29
+ render :new, status: :unprocessable_entity
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT /posts/1
34
+ def update
35
+ if @post.update(post_params)
36
+ redirect_to @post, notice: "Post was successfully updated."
37
+ else
38
+ render :edit, status: :unprocessable_entity
39
+ end
40
+ end
41
+
42
+ # DELETE /posts/1
43
+ def destroy
44
+ @post.destroy
45
+ redirect_to posts_url, notice: "Post was successfully destroyed."
46
+ end
47
+
48
+ private
49
+
50
+ # Use callbacks to share common setup or constraints between actions.
51
+ def set_post
52
+ @post = Post.find(params[:id])
53
+ end
54
+
55
+ # Only allow a list of trusted parameters through.
56
+ def post_params
57
+ params.require(:post).permit(:title, :body)
58
+ end
59
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ primary_abstract_class
3
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ class Post < ApplicationRecord
2
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Psql</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= stylesheet_link_tag "application" %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </html>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: post) do |form| %>
2
+ <% if post.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% post.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.label :title, style: "display: block" %>
16
+ <%= form.text_field :title %>
17
+ </div>
18
+
19
+ <div>
20
+ <%= form.label :body, style: "display: block" %>
21
+ <%= form.text_area :body %>
22
+ </div>
23
+
24
+ <div>
25
+ <%= form.submit %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <div id="<%= dom_id post %>">
2
+ <p>
3
+ <strong>Title:</strong>
4
+ <%= post.title %>
5
+ </p>
6
+
7
+ <p>
8
+ <strong>Body:</strong>
9
+ <%= post.body %>
10
+ </p>
11
+
12
+ </div>
@@ -0,0 +1,10 @@
1
+ <h1>Editing post</h1>
2
+
3
+ <%= render "form", post: @post %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Show this post", @post %> |
9
+ <%= link_to "Back to posts", posts_path %>
10
+ </div>
@@ -0,0 +1,14 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <h1>Posts</h1>
4
+
5
+ <div id="posts">
6
+ <% @posts.each do |post| %>
7
+ <%= render post %>
8
+ <p>
9
+ <%= link_to "Show this post", post %>
10
+ </p>
11
+ <% end %>
12
+ </div>
13
+
14
+ <%= link_to "New post", new_post_path %>
@@ -0,0 +1,9 @@
1
+ <h1>New post</h1>
2
+
3
+ <%= render "form", post: @post %>
4
+
5
+ <br>
6
+
7
+ <div>
8
+ <%= link_to "Back to posts", posts_path %>
9
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @post %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this post", edit_post_path(@post) %> |
7
+ <%= link_to "Back to posts", posts_path %>
8
+
9
+ <%= button_to "Destroy this post", @post, method: :delete %>
10
+ </div>
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../Gemfile", __dir__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_requirement
64
+ @bundler_requirement ||=
65
+ env_var_version ||
66
+ cli_arg_version ||
67
+ bundler_requirement_for(lockfile_version)
68
+ end
69
+
70
+ def bundler_requirement_for(version)
71
+ return "#{Gem::Requirement.default}.a" unless version
72
+
73
+ bundler_gem_version = Gem::Version.new(version)
74
+
75
+ bundler_gem_version.approximate_recommendation
76
+ end
77
+
78
+ def load_bundler!
79
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
80
+
81
+ activate_bundler
82
+ end
83
+
84
+ def activate_bundler
85
+ gem_error = activation_error_handling do
86
+ gem "bundler", bundler_requirement
87
+ end
88
+ return if gem_error.nil?
89
+ require_error = activation_error_handling do
90
+ require "bundler/version"
91
+ end
92
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94
+ exit 42
95
+ end
96
+
97
+ def activation_error_handling
98
+ yield
99
+ nil
100
+ rescue StandardError, LoadError => e
101
+ e
102
+ end
103
+ end
104
+
105
+ m.load_bundler!
106
+
107
+ if m.invoked_as_script?
108
+ load Gem.bin_path("bundler", "bundle")
109
+ end
@@ -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,33 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! "bin/rails db:prepare"
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! "bin/rails log:clear tmp:clear"
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! "bin/rails restart"
33
+ end
@@ -0,0 +1,43 @@
1
+ require_relative "boot"
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ # require "active_job/railtie"
7
+ require "active_record/railtie"
8
+ # require "active_storage/engine"
9
+ require "action_controller/railtie"
10
+ # require "action_mailer/railtie"
11
+ # require "action_mailbox/engine"
12
+ # require "action_text/engine"
13
+ require "action_view/railtie"
14
+ # require "action_cable/engine"
15
+ # require "rails/test_unit/railtie"
16
+
17
+ # Require the gems listed in Gemfile, including any gems
18
+ # you've limited to :test, :development, or :production.
19
+ Bundler.require(*Rails.groups)
20
+
21
+ module Psql
22
+ class Application < Rails::Application
23
+ # Initialize configuration defaults for originally generated Rails version.
24
+ config.load_defaults 7.0
25
+
26
+ # Configuration for the application, engines, and railties goes here.
27
+ #
28
+ # These settings can be overridden in specific environments using the files
29
+ # in config/environments, which are processed later.
30
+ #
31
+ # config.time_zone = "Central Time (US & Canada)"
32
+ # config.eager_load_paths << Rails.root.join("extras")
33
+
34
+ # Don't generate system test files.
35
+ config.generators.system_tests = nil
36
+ end
37
+ end
38
+
39
+ Rails.application.config.filter_parameters += [
40
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
41
+ ]
42
+
43
+ Rails.application.config.assets.version = "1.0"
@@ -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 @@
1
+ plSlcg+t0A3VbiSy1AFqbxcm5N/z95xphqK2zOxbQ91seyuW9aKjZ8KLorLFTbpOld/v2yia1kgwrm3tIZu1UlsF1BymLXeL2stx7jSDQTjYodz8DxvFII8CoTzA9AqdEBa3sJTy10ifCEqJYcAlygil3ZsEKR7wRYdPClWdTOXfgJvHemiDgDt2/m/vleRSaXKPXQI9qacUa562/FeVgFV0sRF4q/L2JNPK1BxUrptYmFmSwhiLRd2NyuEFnFaHIFvU4KiaTxUc4zafNLvzcCg8bX9LjzNu2kEIbG+mw4w7/5v5LbWMFOGkOzwWTY7jJnBpBo6z67hA8vLJNQD7FmZfO2Ab9o7jsEFFZT2Yp4uGLx6KywEzt9YoVO6wmJ56JaFsvDVLmfYbkkSapWrOFh01Z/KD06MPfPr2--/n/GDDqwUK81G2CY--qpNK06m0BX4ziBa2GjASdA==
@@ -0,0 +1,87 @@
1
+ # PostgreSQL. Versions 9.3 and up are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On macOS with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On macOS with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem "pg"
16
+ #
17
+ default: &default
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ host: localhost
21
+ # For details on connection pooling, see Rails configuration guide
22
+ # https://guides.rubyonrails.org/configuring.html#database-pooling
23
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
24
+
25
+ development:
26
+ <<: *default
27
+ database: backy_development
28
+
29
+ # The specified database role being used to connect to postgres.
30
+ # To create additional roles in postgres see `$ createuser --help`.
31
+ # When left blank, postgres will use the default role. This is
32
+ # the same name as the operating system user running Rails.
33
+ #username: psql
34
+
35
+ # The password associated with the postgres role (username).
36
+ #password:
37
+
38
+ # Connect on a TCP socket. Omitted by default since the client uses a
39
+ # domain socket that doesn't need configuration. Windows does not have
40
+ # domain sockets, so uncomment these lines.
41
+ #host: localhost
42
+
43
+ # The TCP port the server listens on. Defaults to 5432.
44
+ # If your server runs on a different port number, change accordingly.
45
+ #port: 5432
46
+
47
+ # Schema search path. The server defaults to $user,public
48
+ #schema_search_path: myapp,sharedapp,public
49
+
50
+ # Minimum log levels, in increasing order:
51
+ # debug5, debug4, debug3, debug2, debug1,
52
+ # log, notice, warning, error, fatal, and panic
53
+ # Defaults to warning.
54
+ #min_messages: notice
55
+
56
+ # Warning: The database defined as "test" will be erased and
57
+ # re-generated from your development database when you run "rake".
58
+ # Do not set this db to the same as development or production.
59
+ test:
60
+ <<: *default
61
+ database: backy_test
62
+
63
+ # As with config/credentials.yml, you never want to store sensitive information,
64
+ # like your database password, in your source code. If your source code is
65
+ # ever seen by anyone, they now have access to your database.
66
+ #
67
+ # Instead, provide the password or a full connection URL as an environment
68
+ # variable when you boot the app. For example:
69
+ #
70
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
71
+ #
72
+ # If the connection URL is provided in the special DATABASE_URL environment
73
+ # variable, Rails will automatically merge its configuration values on top of
74
+ # the values provided in this file. Alternatively, you can specify a connection
75
+ # URL environment variable explicitly:
76
+ #
77
+ # production:
78
+ # url: <%= ENV["MY_APP_DATABASE_URL"] %>
79
+ #
80
+ # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
81
+ # for a full overview on how database connection configuration can be specified.
82
+ #
83
+ production:
84
+ <<: *default
85
+ database: backy_production
86
+ username: psql
87
+ password: <%= ENV["PSQL_DATABASE_PASSWORD"] %>
@@ -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,62 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # In the development environment your application's code is reloaded any time
7
+ # it changes. This slows down response time but is perfect for development
8
+ # since you don't have to restart the web server when you make code changes.
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot.
12
+ config.eager_load = false
13
+
14
+ # Show full error reports.
15
+ config.consider_all_requests_local = true
16
+
17
+ # Enable server timing
18
+ config.server_timing = true
19
+
20
+ # Enable/disable caching. By default caching is disabled.
21
+ # Run rails dev:cache to toggle caching.
22
+ if Rails.root.join("tmp/caching-dev.txt").exist?
23
+ config.action_controller.perform_caching = true
24
+ config.action_controller.enable_fragment_cache_logging = true
25
+
26
+ config.cache_store = :memory_store
27
+ config.public_file_server.headers = {
28
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
29
+ }
30
+ else
31
+ config.action_controller.perform_caching = false
32
+
33
+ config.cache_store = :null_store
34
+ end
35
+
36
+ # Print deprecation notices to the Rails logger.
37
+ config.active_support.deprecation = :log
38
+
39
+ # Raise exceptions for disallowed deprecations.
40
+ config.active_support.disallowed_deprecation = :raise
41
+
42
+ # Tell Active Support which deprecation messages to disallow.
43
+ config.active_support.disallowed_deprecation_warnings = []
44
+
45
+ # Raise an error on page load if there are pending migrations.
46
+ config.active_record.migration_error = :page_load
47
+
48
+ # Highlight code that triggered database queries in logs.
49
+ config.active_record.verbose_query_logs = true
50
+
51
+ # Suppress logger output for asset requests.
52
+ config.assets.quiet = true
53
+
54
+ # Raises error for missing translations.
55
+ # config.i18n.raise_on_missing_translations = true
56
+
57
+ # Annotate rendered view with file names.
58
+ # config.action_view.annotate_rendered_view_with_filenames = true
59
+
60
+ # Uncomment if you wish to allow Action Cable access from any origin.
61
+ # config.action_cable.disable_request_forgery_protection = true
62
+ end
@@ -0,0 +1,75 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ Rails.application.configure do
4
+ # Settings specified here will take precedence over those in config/application.rb.
5
+
6
+ # Code is not reloaded between requests.
7
+ config.cache_classes = true
8
+
9
+ # Eager load code on boot. This eager loads most of Rails and
10
+ # your application in memory, allowing both threaded web servers
11
+ # and those relying on copy on write to perform better.
12
+ # Rake tasks automatically ignore this option for performance.
13
+ config.eager_load = true
14
+
15
+ # Full error reports are disabled and caching is turned on.
16
+ config.consider_all_requests_local = false
17
+ config.action_controller.perform_caching = true
18
+
19
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21
+ # config.require_master_key = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
26
+
27
+ # Compress CSS using a preprocessor.
28
+ # config.assets.css_compressor = :sass
29
+
30
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
31
+ config.assets.compile = false
32
+
33
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
34
+ # config.asset_host = "http://assets.example.com"
35
+
36
+ # Specifies the header that your server uses for sending files.
37
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
38
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
39
+
40
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
41
+ # config.force_ssl = true
42
+
43
+ # Include generic and useful information about system operation, but avoid logging too much
44
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
45
+ config.log_level = :info
46
+
47
+ # Prepend all log lines with the following tags.
48
+ config.log_tags = [:request_id]
49
+
50
+ # Use a different cache store in production.
51
+ # config.cache_store = :mem_cache_store
52
+
53
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
54
+ # the I18n.default_locale when a translation cannot be found).
55
+ config.i18n.fallbacks = true
56
+
57
+ # Don't log any deprecations.
58
+ config.active_support.report_deprecations = false
59
+
60
+ # Use default logging formatter so that PID and timestamp are not suppressed.
61
+ config.log_formatter = ::Logger::Formatter.new
62
+
63
+ # Use a different logger for distributed setups.
64
+ # require "syslog/logger"
65
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
66
+
67
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
68
+ logger = ActiveSupport::Logger.new($stdout)
69
+ logger.formatter = config.log_formatter
70
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
71
+ end
72
+
73
+ # Do not dump schema after migrations.
74
+ config.active_record.dump_schema_after_migration = false
75
+ end
@@ -0,0 +1,50 @@
1
+ require "active_support/core_ext/integer/time"
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+
8
+ Rails.application.configure do
9
+ # Settings specified here will take precedence over those in config/application.rb.
10
+
11
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
12
+ config.cache_classes = true
13
+
14
+ # Eager loading loads your whole application. When running a single test locally,
15
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
16
+ # system, or in some way before deploying your code.
17
+ config.eager_load = ENV["CI"].present?
18
+
19
+ # Configure public file server for tests with Cache-Control for performance.
20
+ config.public_file_server.enabled = true
21
+ config.public_file_server.headers = {
22
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
23
+ }
24
+
25
+ # Show full error reports and disable caching.
26
+ config.consider_all_requests_local = true
27
+ config.action_controller.perform_caching = false
28
+ config.cache_store = :null_store
29
+
30
+ # Raise exceptions instead of rendering exception templates.
31
+ config.action_dispatch.show_exceptions = false
32
+
33
+ # Disable request forgery protection in test environment.
34
+ config.action_controller.allow_forgery_protection = false
35
+
36
+ # Print deprecation notices to the stderr.
37
+ config.active_support.deprecation = :stderr
38
+
39
+ # Raise exceptions for disallowed deprecations.
40
+ config.active_support.disallowed_deprecation = :raise
41
+
42
+ # Tell Active Support which deprecation messages to disallow.
43
+ config.active_support.disallowed_deprecation_warnings = []
44
+
45
+ # Raises error for missing translations.
46
+ # config.i18n.raise_on_missing_translations = true
47
+
48
+ # Annotate rendered view with file names.
49
+ # config.action_view.annotate_rendered_view_with_filenames = true
50
+ end