neeto-jwt-engine 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +89 -0
  3. data/Rakefile +20 -0
  4. data/app/controllers/concerns/neeto_jwt_engine/api_exceptions.rb +77 -0
  5. data/app/controllers/concerns/neeto_jwt_engine/authenticatable.rb +20 -0
  6. data/app/controllers/neeto_jwt_engine/application_controller.rb +7 -0
  7. data/app/controllers/neeto_jwt_engine/configurations_controller.rb +54 -0
  8. data/app/models/concerns/neeto_jwt_engine/incinerable_concern.rb +26 -0
  9. data/app/models/neeto_jwt_engine/application_record.rb +7 -0
  10. data/app/models/neeto_jwt_engine/configuration.rb +24 -0
  11. data/app/models/neeto_jwt_engine/onetime_link.rb +19 -0
  12. data/app/services/neeto_jwt_engine/elliptic_key_generator_service.rb +44 -0
  13. data/app/views/layouts/neeto_jwt_engine/application.html.erb +15 -0
  14. data/config/brakeman.ignore +5 -0
  15. data/config/locales/en.yml +1 -0
  16. data/config/routes.rb +7 -0
  17. data/db/migrate/20250329064017_create_neeto_jwt_engine_configurations.rb +14 -0
  18. data/db/migrate/20250716075611_create_neeto_jwt_engine_onetime_links.rb +13 -0
  19. data/lib/neeto-jwt-engine.rb +5 -0
  20. data/lib/neeto_jwt_engine/engine.rb +7 -0
  21. data/lib/neeto_jwt_engine/exceptions.rb +5 -0
  22. data/lib/neeto_jwt_engine/version.rb +5 -0
  23. data/lib/omniauth/strategies/jwt.rb +93 -0
  24. data/test/controllers/neeto_jwt_engine/configurations_controller_test.rb +58 -0
  25. data/test/dummy/Rakefile +8 -0
  26. data/test/dummy/app/assets/config/manifest.js +3 -0
  27. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  28. data/test/dummy/app/channels/application_cable/channel.rb +6 -0
  29. data/test/dummy/app/channels/application_cable/connection.rb +6 -0
  30. data/test/dummy/app/controllers/application_controller.rb +5 -0
  31. data/test/dummy/app/controllers/concerns/sso_helpers.rb +20 -0
  32. data/test/dummy/app/helpers/application_helper.rb +4 -0
  33. data/test/dummy/app/javascript/packs/application.js +19 -0
  34. data/test/dummy/app/jobs/application_job.rb +9 -0
  35. data/test/dummy/app/mailers/application_mailer.rb +6 -0
  36. data/test/dummy/app/models/application_record.rb +5 -0
  37. data/test/dummy/app/models/organization.rb +10 -0
  38. data/test/dummy/app/models/user.rb +11 -0
  39. data/test/dummy/app/services/sample_data/common/admin_service.rb +26 -0
  40. data/test/dummy/app/services/sample_data/common/base.rb +43 -0
  41. data/test/dummy/app/services/sample_data/common/database_cleanup_service.rb +11 -0
  42. data/test/dummy/app/services/sample_data/common/loader_service.rb +34 -0
  43. data/test/dummy/app/services/sample_data/common/organization_service.rb +27 -0
  44. data/test/dummy/app/services/sample_data/loaders_list.rb +14 -0
  45. data/test/dummy/app/services/sample_data/user_service.rb +26 -0
  46. data/test/dummy/app/views/home/index.html.erb +1 -0
  47. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  48. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  49. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  50. data/test/dummy/app/views/users/index.json.jbuilder +19 -0
  51. data/test/dummy/bin/rails +6 -0
  52. data/test/dummy/bin/rake +6 -0
  53. data/test/dummy/bin/setup +37 -0
  54. data/test/dummy/bin/webpacker +16 -0
  55. data/test/dummy/bin/webpacker-dev-server +19 -0
  56. data/test/dummy/config/application.rb +29 -0
  57. data/test/dummy/config/boot.rb +7 -0
  58. data/test/dummy/config/cable.yml +10 -0
  59. data/test/dummy/config/database.yml +17 -0
  60. data/test/dummy/config/database.yml.ci +17 -0
  61. data/test/dummy/config/database.yml.postgresql +17 -0
  62. data/test/dummy/config/environment.rb +7 -0
  63. data/test/dummy/config/environments/development.rb +70 -0
  64. data/test/dummy/config/environments/production.rb +116 -0
  65. data/test/dummy/config/environments/test.rb +63 -0
  66. data/test/dummy/config/initializers/application_controller_renderer.rb +9 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +10 -0
  68. data/test/dummy/config/initializers/content_security_policy.rb +29 -0
  69. data/test/dummy/config/initializers/cookies_serializer.rb +7 -0
  70. data/test/dummy/config/initializers/inflections.rb +17 -0
  71. data/test/dummy/config/initializers/mime_types.rb +5 -0
  72. data/test/dummy/config/initializers/permissions_policy.rb +12 -0
  73. data/test/dummy/config/initializers/strong_migrations.rb +4 -0
  74. data/test/dummy/config/initializers/wrap_parameters.rb +16 -0
  75. data/test/dummy/config/locales/en.yml +33 -0
  76. data/test/dummy/config/puma.rb +45 -0
  77. data/test/dummy/config/routes.rb +13 -0
  78. data/test/dummy/config/storage.yml +34 -0
  79. data/test/dummy/config/webpack/development.js +5 -0
  80. data/test/dummy/config/webpack/environment.js +13 -0
  81. data/test/dummy/config/webpack/production.js +5 -0
  82. data/test/dummy/config/webpack/resolve.js +11 -0
  83. data/test/dummy/config/webpack/test.js +5 -0
  84. data/test/dummy/config/webpack/webpack.config.js +20 -0
  85. data/test/dummy/config/webpacker.yml +73 -0
  86. data/test/dummy/config.ru +8 -0
  87. data/test/dummy/db/migrate/20220419104218_create_organizations.rb +15 -0
  88. data/test/dummy/db/migrate/20220419114209_create_users.rb +20 -0
  89. data/test/dummy/db/migrate/20240607032904_add_deactivated_at_to_organizations.rb +7 -0
  90. data/test/dummy/db/schema.rb +68 -0
  91. data/test/dummy/lib/tasks/setup.rake +48 -0
  92. data/test/dummy/log/development.log +71 -0
  93. data/test/dummy/log/test.log +5189 -0
  94. data/test/dummy/public/404.html +67 -0
  95. data/test/dummy/public/422.html +67 -0
  96. data/test/dummy/public/500.html +66 -0
  97. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  98. data/test/dummy/public/apple-touch-icon.png +0 -0
  99. data/test/dummy/public/favicon.ico +0 -0
  100. data/test/dummy/tmp/local_secret.txt +1 -0
  101. data/test/dummy/tmp/restart.txt +0 -0
  102. data/test/factories/neeto_jwt_engine/configuration.rb +7 -0
  103. data/test/factories/neeto_jwt_engine/onetime_link.rb +7 -0
  104. data/test/factories/organization.rb +8 -0
  105. data/test/factories/user.rb +13 -0
  106. data/test/models/neeto_jwt_engine/configuration_test.rb +23 -0
  107. data/test/models/neeto_jwt_engine/onetime_link_test.rb +27 -0
  108. data/test/neeto_jwt_engine_test.rb +12 -0
  109. data/test/services/neeto_jwt_engine/elliptic_key_generator_service_test.rb +30 -0
  110. data/test/support/assertion_support.rb +9 -0
  111. data/test/test_helper.rb +30 -0
  112. metadata +168 -0
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ include SsoHelpers
5
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This module simulates the `LoadOrganization` module from neeto_sso.
4
+ # The original behavior is to load the organization from the subdomain. For this dummy application, the `load_organization` method is stubbed.
5
+ # Refer: https://github.com/bigbinary/neeto_sso/blob/main/lib/neeto_sso/load_organization.rb
6
+
7
+ module SsoHelpers
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ before_action :load_organization
12
+ end
13
+
14
+ def load_organization
15
+ @organization = Organization.active.first
16
+ unless @organization
17
+ render status: :not_found, json: { error: "No organizations found. Please create a new organization." }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,19 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require rails-ujs
14
+ //= require activestorage
15
+ //= require_tree .
16
+ // Support component names relative to this directory:
17
+ var componentRequireContext = require.context("src", true);
18
+ var ReactRailsUJS = require("react_ujs");
19
+ ReactRailsUJS.useContext(componentRequireContext);
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Organization < ApplicationRecord
4
+ scope :active, -> { all }
5
+
6
+ validates :name, presence: true
7
+ validates :subdomain, presence: true, uniqueness: true
8
+
9
+ has_one :jwt_configuration, class_name: "NeetoJwtEngine::Configuration", dependent: :destroy
10
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class User < ApplicationRecord
4
+ belongs_to :organization
5
+
6
+ has_many :deals, dependent: :destroy
7
+
8
+ validates :first_name, presence: true
9
+ validates :email, presence: true, uniqueness: true
10
+ validates :timezone, presence: true
11
+ end
@@ -0,0 +1,26 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ module SampleData
5
+ module Common
6
+ class AdminService < Common::Base
7
+ attr_reader :admin
8
+
9
+ def process!
10
+ create_admin!
11
+ end
12
+
13
+ private
14
+
15
+ def create_admin!
16
+ @admin = User.create! \
17
+ organization:,
18
+ email: "oliver@example.com",
19
+ first_name: "Oliver",
20
+ last_name: "Smith",
21
+ experience: 10,
22
+ timezone: "+05:30"
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faker"
4
+
5
+ module SampleData
6
+ module Common
7
+ class Base
8
+ def organization
9
+ @_organization ||= Organization.active.first
10
+ end
11
+
12
+ def admin
13
+ organization.users.first
14
+ end
15
+
16
+ def skip?
17
+ !heroku_or_development_env?
18
+ end
19
+
20
+ def print_description
21
+ print "%-80s" % [description]
22
+ end
23
+
24
+ def print_success
25
+ print "[DONE]\n"
26
+ end
27
+
28
+ def description
29
+ self.class.name
30
+ end
31
+
32
+ def heroku_or_development_env?
33
+ Rails.env.heroku? || Rails.env.development?
34
+ end
35
+
36
+ def load!
37
+ print_description
38
+ process!
39
+ print_success
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SampleData
4
+ module Common
5
+ class DatabaseCleanupService < Common::Base
6
+ def process!
7
+ DatabaseCleaner.clean_with :truncation
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SampleData
4
+ module Common
5
+ class LoaderService < Common::Base
6
+ include SampleData::LoadersList
7
+
8
+ def process!
9
+ return if skip?
10
+
11
+ ActiveRecord::Base.descendants.map(&:reset_column_information)
12
+ puts "\n#{'-' * 80}"
13
+ puts "Loading sample data..."
14
+ ActiveRecord::Base.logger.level = Logger::INFO
15
+
16
+ begin
17
+ load_sample_data!
18
+ rescue
19
+ Common::DatabaseCleanupService.new.process!
20
+ end
21
+ puts "#{'-' * 80}\n"
22
+ true
23
+ end
24
+
25
+ private
26
+
27
+ def load_sample_data!
28
+ loaders_list.each do |loader_service|
29
+ loader_service.new.load!
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SampleData
4
+ module Common
5
+ class OrganizationService < Common::Base
6
+ ORGANIZATION_NAME = "Spinkart"
7
+
8
+ attr_reader :organization_name, :organization
9
+
10
+ def initialize
11
+ @organization_name = ORGANIZATION_NAME
12
+ end
13
+
14
+ def process!
15
+ create_organization!
16
+ end
17
+
18
+ private
19
+
20
+ def create_organization!
21
+ @organization = Organization.create! \
22
+ name: organization_name,
23
+ subdomain: organization_name.parameterize
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SampleData
4
+ module LoadersList
5
+ def loaders_list
6
+ @_loaders_list ||= [
7
+ SampleData::Common::DatabaseCleanupService,
8
+ SampleData::Common::OrganizationService,
9
+ SampleData::Common::AdminService,
10
+ SampleData::UserService,
11
+ ]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SampleData
4
+ class UserService < Common::Base
5
+ def process!
6
+ create_users!
7
+ end
8
+
9
+ private
10
+
11
+ def create_users!
12
+ users = 99.times.map do |i|
13
+ {
14
+ organization:,
15
+ first_name: Faker::Name.first_name,
16
+ last_name: Faker::Name.last_name,
17
+ email: Faker::Internet.email,
18
+ experience: rand(1..10),
19
+ timezone: ActiveSupport::TimeZone.all.sample.formatted_offset
20
+ }
21
+ end
22
+
23
+ User.create! users
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ <%= react_component "App" %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Neeto Jwt</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <%= javascript_pack_tag "application" %>
10
+ </head>
11
+
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
+ </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 @@
1
+ <%= yield %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.users do
4
+ json.array! @users do |user|
5
+ json.id user.id
6
+ json.name "#{user.first_name} #{user.last_name}"
7
+ json.email user.email
8
+ json.organization user.organization.name
9
+ json.experience user.experience
10
+ json.timezone user.timezone
11
+ json.created_at user.created_at
12
+ json.updated_at user.updated_at
13
+ end
14
+ end
15
+
16
+ json.count @pagy.count
17
+ json.total_count @total_count
18
+ json.emails @emails
19
+ json.names @names.map { |name| "#{name[0]} #{name[1]}" }
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path("../config/application", __dir__)
5
+ require_relative "../config/boot"
6
+ require "rails/commands"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../config/boot"
5
+ require "rake"
6
+ Rake.application.run
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "fileutils"
5
+
6
+ # path to your application root.
7
+ APP_ROOT = File.expand_path("..", __dir__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ FileUtils.chdir APP_ROOT do
14
+ # This script is a way to set up or update your development environment automatically.
15
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
16
+ # Add necessary setup steps to this file.
17
+ puts "== Installing dependencies =="
18
+ cmd = "gem install bundler --conservative"
19
+ puts "Executing #{cmd}"
20
+ system! cmd
21
+ system("bundle check") || system!("bundle install")
22
+
23
+ puts "\n== Creating config/database.yml file =="
24
+ if !ENV["DOCKER_ENV"]
25
+ system! "rm -f config/database.yml"
26
+ system! "cp config/database.yml.postgresql config/database.yml"
27
+ end
28
+
29
+ puts "\n== Executing rake setup =="
30
+ system! "bundle exec rake setup"
31
+
32
+ puts "\n== Removing old logs and tempfiles =="
33
+ system! "bin/rails log:clear tmp:clear"
34
+
35
+ puts "\n== Restarting application server =="
36
+ system! "bin/rails restart"
37
+ end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "pathname"
5
+ require "bundler/setup"
6
+ require "webpacker"
7
+ require "webpacker/webpack_runner"
8
+
9
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
10
+ ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpat)
12
+
13
+ APP_ROOT = File.expand_path("..", __dir__)
14
+ Dir.chdir(APP_ROOT) do
15
+ Webpacker::WebpackRunner.run(ARGV)
16
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
5
+ ENV["NODE_ENV"] ||= "development"
6
+
7
+ require "pathname"
8
+ require "bundler/setup"
9
+ require "webpacker"
10
+ require "webpacker/dev_server_runner"
11
+
12
+ ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
13
+ ENV["NODE_ENV"] ||= (ENV["RAILS_ENV"] == "production") ? "production" : "development"
14
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpat)
15
+
16
+ APP_ROOT = File.expand_path("..", __dir__)
17
+ Dir.chdir(APP_ROOT) do
18
+ Webpacker::DevServerRunner.run(ARGV)
19
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "boot"
4
+
5
+ require "rails/all"
6
+ require "rack"
7
+ require "rack/cors"
8
+
9
+ # Require the gems listed in Gemfile, including any gems
10
+ # you've limited to :test, :development, or :production.
11
+ Bundler.require(*Rails.groups)
12
+ require "neeto-jwt-engine"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ config.load_defaults Rails::VERSION::STRING.to_f
17
+
18
+ Rails.application.config.generators do |g|
19
+ g.orm :active_record, primary_key_type: :uuid
20
+ end
21
+
22
+ config.middleware.insert_before 0, Rack::Cors do
23
+ allow do
24
+ origins "*"
25
+ resource "*", headers: :any, methods: [:get, :post, :delete, :put, :patch]
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
5
+
6
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
7
+ $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -0,0 +1,17 @@
1
+ <% branch_name = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '') %>
2
+ <% repository_name = `git rev-parse --show-toplevel`.split('/').last.strip %>
3
+
4
+ default: &default
5
+ adapter: postgresql
6
+ encoding: unicode
7
+ host: localhost
8
+ pool: 5
9
+ password:
10
+
11
+ development:
12
+ <<: *default
13
+ database: <%= "#{repository_name}_development" %>
14
+
15
+ test:
16
+ <<: *default
17
+ database: <%= "#{repository_name}_test" %>
@@ -0,0 +1,17 @@
1
+ <% branch_name = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '') %>
2
+ <% repository_name = `git rev-parse --show-toplevel`.split('/').last.strip %>
3
+
4
+ default: &default
5
+ adapter: postgresql
6
+ encoding: unicode
7
+ host: localhost
8
+ pool: 5
9
+ password:
10
+
11
+ development:
12
+ <<: *default
13
+ database: <%= "#{repository_name}_development" %>
14
+
15
+ test:
16
+ <<: *default
17
+ database: <%= "#{repository_name}_test" %>
@@ -0,0 +1,17 @@
1
+ <% branch_name = `git symbolic-ref HEAD 2>/dev/null`.chomp.sub('refs/heads/', '') %>
2
+ <% repository_name = `git rev-parse --show-toplevel`.split('/').last.strip %>
3
+
4
+ default: &default
5
+ adapter: postgresql
6
+ encoding: unicode
7
+ host: localhost
8
+ pool: 5
9
+ password:
10
+
11
+ development:
12
+ <<: *default
13
+ database: <%= "#{repository_name}_development" %>
14
+
15
+ test:
16
+ <<: *default
17
+ database: <%= "#{repository_name}_test" %>
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative "application"
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/integer/time"
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
10
+ # since you don't have to restart the web server when you make code changes.
11
+ config.cache_classes = false
12
+
13
+ # Do not eager load code on boot.
14
+ config.eager_load = false
15
+
16
+ # Show full error reports.
17
+ config.consider_all_requests_local = true
18
+
19
+ # Enable/disable caching. By default caching is disabled.
20
+ # Run rails dev:cache to toggle caching.
21
+ if Rails.root.join("tmp", "caching-dev.txt").exist?
22
+ config.action_controller.perform_caching = true
23
+ config.action_controller.enable_fragment_cache_logging = true
24
+
25
+ config.cache_store = :memory_store
26
+ config.public_file_server.headers = {
27
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
28
+ }
29
+ else
30
+ config.action_controller.perform_caching = false
31
+
32
+ config.cache_store = :null_store
33
+ end
34
+
35
+ # Store uploaded files on the local file system (see config/storage.yml for options).
36
+ config.active_storage.service = :local
37
+
38
+ # Don't care if the mailer can't send.
39
+ config.action_mailer.raise_delivery_errors = false
40
+
41
+ config.action_mailer.perform_caching = false
42
+
43
+ # Print deprecation notices to the Rails logger.
44
+ config.active_support.deprecation = :log
45
+
46
+ # Raise exceptions for disallowed deprecations.
47
+ config.active_support.disallowed_deprecation = :raise
48
+
49
+ # Tell Active Support which deprecation messages to disallow.
50
+ config.active_support.disallowed_deprecation_warnings = []
51
+
52
+ # Raise an error on page load if there are pending migrations.
53
+ config.active_record.migration_error = :page_load
54
+
55
+ # Highlight code that triggered database queries in logs.
56
+ config.active_record.verbose_query_logs = true
57
+
58
+ # Raises error for missing translations.
59
+ # config.i18n.raise_on_missing_translations = true
60
+
61
+ # Annotate rendered view with file names.
62
+ # config.action_view.annotate_rendered_view_with_filenames = true
63
+
64
+ # Use an evented file watcher to asynchronously detect changes in source code,
65
+ # routes, locales, etc. This feature depends on the listen gem.
66
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
67
+
68
+ # Uncomment if you wish to allow Action Cable access from any origin.
69
+ # config.action_cable.disable_request_forgery_protection = true
70
+ end