activeadmin-tom_select 4.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.
- checksums.yaml +7 -0
- data/.actrc +20 -0
- data/.claude/commands/fix-tests.md +203 -0
- data/.github/workflows/ci.yml +174 -0
- data/.github/workflows/npm-publish.yml +50 -0
- data/.gitignore +35 -0
- data/.npmignore +58 -0
- data/.rspec +1 -0
- data/.rubocop.yml +75 -0
- data/.yardopts +2 -0
- data/AGENTS.md +39 -0
- data/Appraisals +9 -0
- data/CHANGELOG.md +64 -0
- data/CLAUDE.md +157 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +368 -0
- data/LICENSE.txt +25 -0
- data/README.md +483 -0
- data/Rakefile +4 -0
- data/activeadmin-tom_select.gemspec +43 -0
- data/bin/rspec +17 -0
- data/config/database.yml +16 -0
- data/docs/activeadmin-4-detailed-reference.md +932 -0
- data/docs/activeadmin-4-gem-migration-guide.md +313 -0
- data/docs/combustion.md +213 -0
- data/docs/fail.png +0 -0
- data/docs/guide-update-your-app.md +283 -0
- data/docs/normal.png +0 -0
- data/docs/propshaft-readme.md +320 -0
- data/docs/propshaft-upgrade.md +484 -0
- data/docs/setup-activeadmin-app.md +552 -0
- data/docs/setup-activeadmin-gem.md +535 -0
- data/docs/tailwind/blog-page.md +341 -0
- data/docs/tailwind/upgrade-guide-enhanced.md +438 -0
- data/docs/tailwind/upgrade-guide.md +416 -0
- data/docs/tailwind-4/active_admin.rake +38 -0
- data/docs/tailwind-4/active_admin.tailwind.css +415 -0
- data/docs/tailwind-4/tailwind-active_admin.config.js +18 -0
- data/docs/test-app-change.md +154 -0
- data/docs/test-environment-fixes.md +58 -0
- data/docs/update-tom-select.md +184 -0
- data/docs/upload-system.md +225 -0
- data/gemfiles/rails_7.x_active_admin_4.x.gemfile +10 -0
- data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +377 -0
- data/gemfiles/rails_8.x_active_admin_4.x.gemfile +10 -0
- data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +372 -0
- data/lefthook.yml +17 -0
- data/lib/activeadmin/inputs/filters/searchable_select_input.rb +19 -0
- data/lib/activeadmin/inputs/searchable_select_input.rb +16 -0
- data/lib/activeadmin/tom_select/engine.rb +17 -0
- data/lib/activeadmin/tom_select/option_collection.rb +128 -0
- data/lib/activeadmin/tom_select/resource_dsl_extension.rb +56 -0
- data/lib/activeadmin/tom_select/resource_extension.rb +10 -0
- data/lib/activeadmin/tom_select/select_input_extension.rb +168 -0
- data/lib/activeadmin/tom_select/version.rb +5 -0
- data/lib/activeadmin/tom_select.rb +20 -0
- data/lib/activeadmin-tom_select.rb +5 -0
- data/lib/generators/active_admin/tom_select/install/install_generator.rb +180 -0
- data/npm-package/package-lock.json +51 -0
- data/npm-package/package.json +43 -0
- data/npm-package/src/index.js +153 -0
- data/npm-package/src/tom-select-tailwind.css +392 -0
- data/sonar-project.properties +25 -0
- data/spec/features/ajax_params_spec.rb +31 -0
- data/spec/features/asset_pipeline_diagnostic_spec.rb +155 -0
- data/spec/features/end_to_end_spec.rb +273 -0
- data/spec/features/filter_input_spec.rb +144 -0
- data/spec/features/form_input_spec.rb +122 -0
- data/spec/features/inline_ajax_setting_spec.rb +26 -0
- data/spec/features/input_errors_spec.rb +76 -0
- data/spec/features/input_html_options_spec.rb +30 -0
- data/spec/features/options_dsl_spec.rb +230 -0
- data/spec/features/production_build_spec.rb +108 -0
- data/spec/internal/.node-version +1 -0
- data/spec/internal/Gemfile +43 -0
- data/spec/internal/Gemfile.lock +333 -0
- data/spec/internal/Procfile.dev +3 -0
- data/spec/internal/README.md +24 -0
- data/spec/internal/Rakefile +6 -0
- data/spec/internal/app/admin/categories.rb +26 -0
- data/spec/internal/app/admin/dashboard.rb +29 -0
- data/spec/internal/app/admin/option_types.rb +19 -0
- data/spec/internal/app/admin/option_values.rb +30 -0
- data/spec/internal/app/admin/posts.rb +27 -0
- data/spec/internal/app/admin/products.rb +22 -0
- data/spec/internal/app/admin/rgb_colors.rb +25 -0
- data/spec/internal/app/admin/tag_names.rb +21 -0
- data/spec/internal/app/admin/test_ajax_params_category.rb +10 -0
- data/spec/internal/app/admin/test_ajax_params_post.rb +20 -0
- data/spec/internal/app/admin/test_form_post_class.rb +7 -0
- data/spec/internal/app/admin/test_form_post_custom.rb +11 -0
- data/spec/internal/app/admin/test_form_post_resource.rb +11 -0
- data/spec/internal/app/admin/test_form_post_resource_custom.rb +12 -0
- data/spec/internal/app/admin/test_inline_ajax_post.rb +9 -0
- data/spec/internal/app/admin/test_input_html_post.rb +11 -0
- data/spec/internal/app/admin/test_posts_display_text.rb +9 -0
- data/spec/internal/app/admin/test_posts_filter.rb +9 -0
- data/spec/internal/app/admin/test_posts_named.rb +9 -0
- data/spec/internal/app/admin/test_posts_pagination.rb +9 -0
- data/spec/internal/app/admin/test_posts_payload_lambda.rb +11 -0
- data/spec/internal/app/admin/test_posts_payload_proc.rb +9 -0
- data/spec/internal/app/admin/test_posts_scope_lambda.rb +8 -0
- data/spec/internal/app/admin/test_posts_scope_params.rb +8 -0
- data/spec/internal/app/admin/test_posts_scope_user.rb +8 -0
- data/spec/internal/app/admin/test_posts_text_attr.rb +5 -0
- data/spec/internal/app/admin/users.rb +23 -0
- data/spec/internal/app/admin/variants.rb +31 -0
- data/spec/internal/app/assets/config/manifest.js +2 -0
- data/spec/internal/app/assets/images/.keep +0 -0
- data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +16 -0
- data/spec/internal/app/assets/stylesheets/application.tailwind.css +15 -0
- data/spec/internal/app/controllers/application_controller.rb +9 -0
- data/spec/internal/app/controllers/concerns/.keep +0 -0
- data/spec/internal/app/helpers/application_helper.rb +2 -0
- data/spec/internal/app/javascript/active_admin.js +19 -0
- data/spec/internal/app/javascript/application.js +2 -0
- data/spec/internal/app/jobs/application_job.rb +7 -0
- data/spec/internal/app/mailers/application_mailer.rb +4 -0
- data/spec/internal/app/models/admin_user.rb +9 -0
- data/spec/internal/app/models/application_record.rb +3 -0
- data/spec/internal/app/models/article.rb +12 -0
- data/spec/internal/app/models/category.rb +12 -0
- data/spec/internal/app/models/color.rb +9 -0
- data/spec/internal/app/models/concerns/.keep +0 -0
- data/spec/internal/app/models/internal/tag_name.rb +14 -0
- data/spec/internal/app/models/internal_tag_name.rb +11 -0
- data/spec/internal/app/models/option_type.rb +12 -0
- data/spec/internal/app/models/option_value.rb +4 -0
- data/spec/internal/app/models/post.rb +15 -0
- data/spec/internal/app/models/product.rb +12 -0
- data/spec/internal/app/models/rgb_color.rb +16 -0
- data/spec/internal/app/models/tag.rb +12 -0
- data/spec/internal/app/models/tagging.rb +12 -0
- data/spec/internal/app/models/user.rb +12 -0
- data/spec/internal/app/models/variant.rb +12 -0
- data/spec/internal/app/views/layouts/application.html.erb +28 -0
- data/spec/internal/app/views/layouts/mailer.html.erb +13 -0
- data/spec/internal/app/views/layouts/mailer.text.erb +1 -0
- data/spec/internal/app/views/pwa/manifest.json.erb +22 -0
- data/spec/internal/app/views/pwa/service-worker.js +26 -0
- data/spec/internal/bin/bundle +117 -0
- data/spec/internal/bin/dev +11 -0
- data/spec/internal/bin/rackup +27 -0
- data/spec/internal/bin/rails +4 -0
- data/spec/internal/bin/rake +4 -0
- data/spec/internal/bin/setup +37 -0
- data/spec/internal/config/application.rb +50 -0
- data/spec/internal/config/boot.rb +3 -0
- data/spec/internal/config/credentials.yml.enc +1 -0
- data/spec/internal/config/database.yml +32 -0
- data/spec/internal/config/environment.rb +5 -0
- data/spec/internal/config/environments/development.rb +63 -0
- data/spec/internal/config/environments/production.rb +86 -0
- data/spec/internal/config/environments/test.rb +50 -0
- data/spec/internal/config/initializers/active_admin.rb +54 -0
- data/spec/internal/config/initializers/assets.rb +8 -0
- data/spec/internal/config/initializers/content_security_policy.rb +25 -0
- data/spec/internal/config/initializers/devise.rb +315 -0
- data/spec/internal/config/initializers/filter_parameter_logging.rb +8 -0
- data/spec/internal/config/initializers/inflections.rb +16 -0
- data/spec/internal/config/initializers/searchable_select.rb +6 -0
- data/spec/internal/config/locales/devise.en.yml +65 -0
- data/spec/internal/config/locales/en.yml +31 -0
- data/spec/internal/config/master.key +1 -0
- data/spec/internal/config/puma.rb +38 -0
- data/spec/internal/config/routes.rb +17 -0
- data/spec/internal/config.ru +6 -0
- data/spec/internal/db/schema.rb +174 -0
- data/spec/internal/db/seeds.rb +167 -0
- data/spec/internal/esbuild.config.js +34 -0
- data/spec/internal/lib/tasks/.keep +0 -0
- data/spec/internal/lib/tasks/active_admin.rake +55 -0
- data/spec/internal/log/.keep +0 -0
- data/spec/internal/package-lock.json +1954 -0
- data/spec/internal/package.json +21 -0
- data/spec/internal/public/400.html +114 -0
- data/spec/internal/public/404.html +114 -0
- data/spec/internal/public/406-unsupported-browser.html +114 -0
- data/spec/internal/public/422.html +114 -0
- data/spec/internal/public/500.html +114 -0
- data/spec/internal/public/icon.png +0 -0
- data/spec/internal/public/icon.svg +3 -0
- data/spec/internal/public/robots.txt +1 -0
- data/spec/internal/script/.keep +0 -0
- data/spec/internal/storage/.keep +0 -0
- data/spec/internal/tailwind.config.js +23 -0
- data/spec/internal/vendor/.keep +0 -0
- data/spec/internal/yarn.lock +824 -0
- data/spec/rails_helper.rb +62 -0
- data/spec/spec_helper.rb +138 -0
- data/spec/support/active_admin_helpers.rb +17 -0
- data/spec/support/capybara.rb +8 -0
- data/spec/support/models.rb +11 -0
- data/spec/support/pluck_polyfill.rb +12 -0
- data/spec/support/reset_settings.rb +5 -0
- metadata +497 -0
@@ -0,0 +1,117 @@
|
|
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($PROGRAM_NAME) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV.fetch('BUNDLER_VERSION', nil)
|
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
|
+
|
28
|
+
bundler_version = nil
|
29
|
+
update_index = nil
|
30
|
+
ARGV.each_with_index do |a, i|
|
31
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
32
|
+
bundler_version = a
|
33
|
+
end
|
34
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
35
|
+
|
36
|
+
bundler_version = Regexp.last_match(1)
|
37
|
+
update_index = i
|
38
|
+
end
|
39
|
+
bundler_version
|
40
|
+
end
|
41
|
+
|
42
|
+
def gemfile
|
43
|
+
gemfile = ENV.fetch('BUNDLE_GEMFILE', nil)
|
44
|
+
return gemfile if gemfile && !gemfile.empty?
|
45
|
+
|
46
|
+
File.expand_path('../Gemfile', __dir__)
|
47
|
+
end
|
48
|
+
|
49
|
+
def lockfile
|
50
|
+
lockfile =
|
51
|
+
case File.basename(gemfile)
|
52
|
+
when 'gems.rb' then gemfile.sub(/\.rb$/, '.locked')
|
53
|
+
else "#{gemfile}.lock"
|
54
|
+
end
|
55
|
+
File.expand_path(lockfile)
|
56
|
+
end
|
57
|
+
|
58
|
+
def lockfile_version
|
59
|
+
return unless File.file?(lockfile)
|
60
|
+
|
61
|
+
lockfile_contents = File.read(lockfile)
|
62
|
+
unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
63
|
+
return
|
64
|
+
end
|
65
|
+
|
66
|
+
Regexp.last_match(1)
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
@bundler_requirement ||=
|
71
|
+
env_var_version ||
|
72
|
+
cli_arg_version ||
|
73
|
+
bundler_requirement_for(lockfile_version)
|
74
|
+
end
|
75
|
+
|
76
|
+
def bundler_requirement_for(version)
|
77
|
+
return "#{Gem::Requirement.default}.a" unless version
|
78
|
+
|
79
|
+
bundler_gem_version = Gem::Version.new(version)
|
80
|
+
|
81
|
+
bundler_gem_version.approximate_recommendation
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_bundler!
|
85
|
+
ENV['BUNDLE_GEMFILE'] ||= gemfile
|
86
|
+
|
87
|
+
activate_bundler
|
88
|
+
end
|
89
|
+
|
90
|
+
def activate_bundler
|
91
|
+
gem_error = activation_error_handling do
|
92
|
+
gem 'bundler', bundler_requirement
|
93
|
+
end
|
94
|
+
return if gem_error.nil?
|
95
|
+
|
96
|
+
require_error = activation_error_handling do
|
97
|
+
require 'bundler/version'
|
98
|
+
end
|
99
|
+
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
100
|
+
return
|
101
|
+
end
|
102
|
+
|
103
|
+
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}'`"
|
104
|
+
exit 42
|
105
|
+
end
|
106
|
+
|
107
|
+
def activation_error_handling
|
108
|
+
yield
|
109
|
+
nil
|
110
|
+
rescue StandardError, LoadError => e
|
111
|
+
e
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
m.load_bundler!
|
116
|
+
|
117
|
+
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
3
|
+
if gem list --no-installed --exact --silent foreman; then
|
4
|
+
echo "Installing foreman..."
|
5
|
+
gem install foreman
|
6
|
+
fi
|
7
|
+
|
8
|
+
# Default to port 3000 if not specified
|
9
|
+
export PORT="${PORT:-3000}"
|
10
|
+
|
11
|
+
exec foreman start -f Procfile.dev --env /dev/null "$@"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rackup' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'bundler/setup'
|
26
|
+
|
27
|
+
load Gem.bin_path('rackup', 'rackup')
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
APP_ROOT = File.expand_path('..', __dir__)
|
5
|
+
|
6
|
+
def system!(*args)
|
7
|
+
system(*args, exception: true)
|
8
|
+
end
|
9
|
+
|
10
|
+
FileUtils.chdir APP_ROOT do
|
11
|
+
# This script is a way to set up or update your development environment automatically.
|
12
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
13
|
+
# Add necessary setup steps to this file.
|
14
|
+
|
15
|
+
puts '== Installing dependencies =='
|
16
|
+
system('bundle check') || system!('bundle install')
|
17
|
+
|
18
|
+
# Install JavaScript dependencies
|
19
|
+
system('yarn install --check-files')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?("config/database.yml")
|
23
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:prepare'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
unless ARGV.include?('--skip-server')
|
33
|
+
puts "\n== Starting development server =="
|
34
|
+
$stdout.flush # flush the output before exec(2) so that it displays
|
35
|
+
exec 'bin/dev'
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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 Propshaft for asset pipeline
|
18
|
+
require 'propshaft'
|
19
|
+
require 'propshaft/railtie'
|
20
|
+
|
21
|
+
# Require the gems listed in Gemfile, including any gems
|
22
|
+
# you've limited to :test, :development, or :production.
|
23
|
+
Bundler.require(*Rails.groups)
|
24
|
+
|
25
|
+
module Internal
|
26
|
+
class Application < Rails::Application
|
27
|
+
# Initialize configuration defaults for originally generated Rails version.
|
28
|
+
if Rails::VERSION::MAJOR >= 8
|
29
|
+
config.load_defaults 8.0
|
30
|
+
else
|
31
|
+
config.load_defaults 7.1
|
32
|
+
end
|
33
|
+
|
34
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
35
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
36
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
37
|
+
config.autoload_lib(ignore: %w[assets tasks]) if config.respond_to?(:autoload_lib)
|
38
|
+
|
39
|
+
# Configuration for the application, engines, and railties goes here.
|
40
|
+
#
|
41
|
+
# These settings can be overridden in specific environments using the files
|
42
|
+
# in config/environments, which are processed later.
|
43
|
+
#
|
44
|
+
# config.time_zone = "Central Time (US & Canada)"
|
45
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
46
|
+
|
47
|
+
# Don't generate system test files.
|
48
|
+
config.generators.system_tests = nil
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2xxT6vxAV1tgaMwV8mRq5QyOASTMQB3JbSUZfp1uzJ+Abflb8GC997L5/z9vEkaf9I4eswytS2fBzwOVVxuNJbbCA+X98YyR1CJVFdhtb+iHN4mInAZdZ7QdF25L7KQ0hwJfAvZGxE86SV6hCTpm+15H44Cdwzypoc+YzuKab1L+z6lEX4PuMdv2hM1n+Mb1KK2TJMH76hM+KEP3D6PNzAhtpCWqVRc77f/sKMUgrLclT3dEbmz4SsY65ngpvkcsmzAojqd6m0LsCms4w+0rUEe5ISXncdH/CaNA44d0YofywVcfQuqY2ZccMW5NgdGIYiDc53/kpSwMCKDkEvDkp8/9LwBZoOAaizxsiOYK3pdzyypsvOmeLWmiek0ShEmrNYpD486GeZBTZz68neOik0RFQoc1iYArCUHiBcSygUUB0yWEzLuTtO18N7Q1xjYvTfTKK+mTQ9KxD1dgxbKtadaINRASdg2fbbiTosaX9CSfGSoNh2Dw/JiJ--9ia3a0PwZ1jZzmi/--zBMxD/P0jFkedDvpDlToeg==
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem "sqlite3"
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: storage/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: storage/test.sqlite3
|
22
|
+
|
23
|
+
|
24
|
+
# SQLite3 write its data on the local filesystem, as such it requires
|
25
|
+
# persistent disks. If you are deploying to a managed service, you should
|
26
|
+
# make sure it provides disk persistence, as many don't.
|
27
|
+
#
|
28
|
+
# Similarly, if you deploy your application as a Docker container, you must
|
29
|
+
# ensure the database is located in a persisted volume.
|
30
|
+
production:
|
31
|
+
<<: *default
|
32
|
+
# database: path/to/persistent/storage/production.sqlite3
|
@@ -0,0 +1,63 @@
|
|
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
|
+
# Make code changes take effect immediately without server restart.
|
7
|
+
config.enable_reloading = true
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable server timing.
|
16
|
+
config.server_timing = true
|
17
|
+
|
18
|
+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
19
|
+
# Run rails dev:cache to toggle Action Controller caching.
|
20
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
21
|
+
config.action_controller.perform_caching = true
|
22
|
+
config.action_controller.enable_fragment_cache_logging = true
|
23
|
+
config.public_file_server.headers = { 'cache-control' => "public, max-age=#{2.days.to_i}" }
|
24
|
+
else
|
25
|
+
config.action_controller.perform_caching = false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Change to :null_store to avoid any caching.
|
29
|
+
config.cache_store = :memory_store
|
30
|
+
|
31
|
+
# Don't care if the mailer can't send.
|
32
|
+
config.action_mailer.raise_delivery_errors = false
|
33
|
+
|
34
|
+
# Make template changes take effect immediately.
|
35
|
+
config.action_mailer.perform_caching = false
|
36
|
+
|
37
|
+
# Set localhost to be used by links generated in mailer templates.
|
38
|
+
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
39
|
+
|
40
|
+
# Print deprecation notices to the Rails logger.
|
41
|
+
config.active_support.deprecation = :log
|
42
|
+
|
43
|
+
# Raise an error on page load if there are pending migrations.
|
44
|
+
config.active_record.migration_error = :page_load
|
45
|
+
|
46
|
+
# Highlight code that triggered database queries in logs.
|
47
|
+
config.active_record.verbose_query_logs = true
|
48
|
+
|
49
|
+
# Append comments with runtime information tags to SQL queries in logs.
|
50
|
+
config.active_record.query_log_tags_enabled = true
|
51
|
+
|
52
|
+
# Highlight code that enqueued background job in logs.
|
53
|
+
config.active_job.verbose_enqueue_logs = true
|
54
|
+
|
55
|
+
# Raises error for missing translations.
|
56
|
+
# config.i18n.raise_on_missing_translations = true
|
57
|
+
|
58
|
+
# Annotate rendered view with file names.
|
59
|
+
config.action_view.annotate_rendered_view_with_filenames = true
|
60
|
+
|
61
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
62
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
63
|
+
end
|
@@ -0,0 +1,86 @@
|
|
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.enable_reloading = false
|
8
|
+
|
9
|
+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
10
|
+
config.eager_load = true
|
11
|
+
|
12
|
+
# Full error reports are disabled.
|
13
|
+
config.consider_all_requests_local = false
|
14
|
+
|
15
|
+
# Turn on fragment caching in view templates.
|
16
|
+
config.action_controller.perform_caching = true
|
17
|
+
|
18
|
+
# Cache assets for far-future expiry since they are all digest stamped.
|
19
|
+
config.public_file_server.headers = { 'cache-control' => "public, max-age=#{1.year.to_i}" }
|
20
|
+
|
21
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
22
|
+
# config.asset_host = "http://assets.example.com"
|
23
|
+
|
24
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
25
|
+
config.assume_ssl = true
|
26
|
+
|
27
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
28
|
+
config.force_ssl = true
|
29
|
+
|
30
|
+
# Skip http-to-https redirect for the default health check endpoint.
|
31
|
+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
32
|
+
|
33
|
+
# Log to STDOUT with the current request id as a default log tag.
|
34
|
+
config.log_tags = [:request_id]
|
35
|
+
config.logger = ActiveSupport::TaggedLogging.logger($stdout)
|
36
|
+
|
37
|
+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
38
|
+
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
|
39
|
+
|
40
|
+
# Prevent health checks from clogging up the logs.
|
41
|
+
config.silence_healthcheck_path = '/up'
|
42
|
+
|
43
|
+
# Don't log any deprecations.
|
44
|
+
config.active_support.report_deprecations = false
|
45
|
+
|
46
|
+
# Replace the default in-process memory cache store with a durable alternative.
|
47
|
+
# config.cache_store = :mem_cache_store
|
48
|
+
|
49
|
+
# Replace the default in-process and non-durable queuing backend for Active Job.
|
50
|
+
# config.active_job.queue_adapter = :resque
|
51
|
+
|
52
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
53
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
54
|
+
# config.action_mailer.raise_delivery_errors = false
|
55
|
+
|
56
|
+
# Set host to be used by links generated in mailer templates.
|
57
|
+
config.action_mailer.default_url_options = { host: 'example.com' }
|
58
|
+
|
59
|
+
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
|
60
|
+
# config.action_mailer.smtp_settings = {
|
61
|
+
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
|
62
|
+
# password: Rails.application.credentials.dig(:smtp, :password),
|
63
|
+
# address: "smtp.example.com",
|
64
|
+
# port: 587,
|
65
|
+
# authentication: :plain
|
66
|
+
# }
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation cannot be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Do not dump schema after migrations.
|
73
|
+
config.active_record.dump_schema_after_migration = false
|
74
|
+
|
75
|
+
# Only use :id for inspections in production.
|
76
|
+
config.active_record.attributes_for_inspect = [:id]
|
77
|
+
|
78
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
79
|
+
# config.hosts = [
|
80
|
+
# "example.com", # Allow requests from example.com
|
81
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
82
|
+
# ]
|
83
|
+
#
|
84
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
85
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
86
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
5
|
+
|
6
|
+
Rails.application.configure do
|
7
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
8
|
+
|
9
|
+
# While tests run files are not watched, reloading is not necessary.
|
10
|
+
config.enable_reloading = false
|
11
|
+
|
12
|
+
# Eager loading loads your entire application. When running a single test locally,
|
13
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
14
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
15
|
+
# loading is working properly before deploying your code.
|
16
|
+
config.eager_load = false
|
17
|
+
|
18
|
+
# Configure public file server for tests with cache-control for performance.
|
19
|
+
config.public_file_server.headers = { 'cache-control' => 'public, max-age=3600' }
|
20
|
+
|
21
|
+
# Show full error reports.
|
22
|
+
config.consider_all_requests_local = true
|
23
|
+
config.cache_store = :null_store
|
24
|
+
|
25
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
26
|
+
config.action_dispatch.show_exceptions = :rescuable
|
27
|
+
|
28
|
+
# Disable request forgery protection in test environment.
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
30
|
+
|
31
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
32
|
+
# The :test delivery method accumulates sent emails in the
|
33
|
+
# ActionMailer::Base.deliveries array.
|
34
|
+
config.action_mailer.delivery_method = :test
|
35
|
+
|
36
|
+
# Set host to be used by links generated in mailer templates.
|
37
|
+
config.action_mailer.default_url_options = { host: 'example.com' }
|
38
|
+
|
39
|
+
# Print deprecation notices to the stderr.
|
40
|
+
config.active_support.deprecation = :stderr
|
41
|
+
|
42
|
+
# Raises error for missing translations.
|
43
|
+
# config.i18n.raise_on_missing_translations = true
|
44
|
+
|
45
|
+
# Annotate rendered view with file names.
|
46
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
47
|
+
|
48
|
+
# Raise error when a before_action's only/except options reference missing actions.
|
49
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
50
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
ActiveAdmin.setup do |config|
|
2
|
+
config.site_title = 'Test Admin'
|
3
|
+
config.authentication_method = false
|
4
|
+
config.current_user_method = false
|
5
|
+
config.batch_actions = true
|
6
|
+
config.filter_attributes = %i[encrypted_password password password_confirmation]
|
7
|
+
config.localize_format = :long
|
8
|
+
# Avoid rendering ActiveAdmin comments (routes are not mounted in Rails 8 test app)
|
9
|
+
config.comments = false
|
10
|
+
end
|
11
|
+
|
12
|
+
# Load the tom_select module first
|
13
|
+
require 'activeadmin/tom_select'
|
14
|
+
|
15
|
+
# Register custom inputs with Formtastic
|
16
|
+
require 'activeadmin/inputs/searchable_select_input'
|
17
|
+
require 'activeadmin/inputs/filters/searchable_select_input'
|
18
|
+
|
19
|
+
# ActiveAdmin 4 expects importmap-rails in host apps. The Rails 8 test app uses
|
20
|
+
# esbuild instead, so provide minimal no-op shims so rendering
|
21
|
+
# doesn't error when calling `javascript_importmap_tags` and `ActiveAdmin.importmap`.
|
22
|
+
module ActiveAdmin
|
23
|
+
# Provide a stub importmap accessor to satisfy `ActiveAdmin.importmap` calls
|
24
|
+
def self.importmap
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
module Importmap
|
29
|
+
def self.draw(*)
|
30
|
+
# no-op in tests
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Provide a working `javascript_importmap_tags` helper that includes required JS for tests
|
36
|
+
module ActionView
|
37
|
+
module Helpers
|
38
|
+
module ImportmapHelperShim
|
39
|
+
def javascript_importmap_tags(*, **)
|
40
|
+
# In tests/dev, include built assets via Rails helpers so Propshaft
|
41
|
+
# can resolve digested paths. Use proper Rails asset helpers for Propshaft.
|
42
|
+
safe_join([
|
43
|
+
stylesheet_link_tag('active_admin', 'data-turbo-track': 'reload'),
|
44
|
+
javascript_include_tag('active_admin', 'data-turbo-track': 'reload',
|
45
|
+
defer: true)
|
46
|
+
], "\n")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
ActiveSupport.on_load(:action_view) do
|
53
|
+
include ActionView::Helpers::ImportmapHelperShim
|
54
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Rails 8 uses Propshaft by default, no assets configuration needed
|
4
|
+
# Version of your assets, change this if you want to expire all your assets.
|
5
|
+
# Rails.application.config.assets.version = "1.0"
|
6
|
+
|
7
|
+
# Add additional assets to the asset load path.
|
8
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Define an application-wide content security policy.
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
6
|
+
|
7
|
+
# Rails.application.configure do
|
8
|
+
# config.content_security_policy do |policy|
|
9
|
+
# policy.default_src :self, :https
|
10
|
+
# policy.font_src :self, :https, :data
|
11
|
+
# policy.img_src :self, :https, :data
|
12
|
+
# policy.object_src :none
|
13
|
+
# policy.script_src :self, :https
|
14
|
+
# policy.style_src :self, :https
|
15
|
+
# # Specify URI for violation reports
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
22
|
+
#
|
23
|
+
# # Report violations without enforcing the policy.
|
24
|
+
# # config.content_security_policy_report_only = true
|
25
|
+
# end
|