geokit-rails 2.3.2 → 2.5.1
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 +4 -4
- data/.github/workflows/ci.yml +80 -0
- data/.gitignore +44 -37
- data/CHANGELOG.md +106 -96
- data/CONFIG.markdown +67 -67
- data/Gemfile +3 -3
- data/MIT-LICENSE +19 -19
- data/README.markdown +726 -726
- data/Rakefile +17 -17
- data/gemfiles/rails7.1.gemfile +11 -0
- data/gemfiles/{rails3.gemfile → rails7.2.gemfile} +7 -7
- data/gemfiles/{rails4.gemfile → rails8.0.gemfile} +7 -8
- data/gemfiles/{rails5.gemfile → rails8.1.gemfile} +7 -8
- data/geokit-rails.gemspec +34 -33
- data/lib/generators/geokit_rails/install_generator.rb +13 -13
- data/lib/generators/templates/geokit_config.rb +100 -100
- data/lib/geokit-rails/acts_as_mappable/class_methods.rb +299 -0
- data/lib/geokit-rails/acts_as_mappable/glue.rb +54 -0
- data/lib/geokit-rails/acts_as_mappable.rb +78 -425
- data/lib/geokit-rails/adapters/abstract.rb +30 -30
- data/lib/geokit-rails/adapters/mysql.rb +21 -21
- data/lib/geokit-rails/adapters/mysql2.rb +8 -8
- data/lib/geokit-rails/adapters/mysql2spatial.rb +8 -8
- data/lib/geokit-rails/adapters/oracleenhanced.rb +32 -32
- data/lib/geokit-rails/adapters/postgresql.rb +21 -21
- data/lib/geokit-rails/adapters/sqlite.rb +53 -53
- data/lib/geokit-rails/adapters/sqlserver.rb +45 -45
- data/lib/geokit-rails/{core_extensions.rb → distance_collection.rb} +8 -8
- data/lib/geokit-rails/geocoder_control.rb +19 -19
- data/lib/geokit-rails/ip_geocode_lookup.rb +44 -48
- data/lib/geokit-rails/railtie.rb +37 -37
- data/lib/geokit-rails/version.rb +3 -3
- data/lib/geokit-rails.rb +11 -9
- data/test/acts_as_mappable_test.rb +486 -478
- data/test/adapter_resolution_test.rb +46 -0
- data/test/boot.rb +40 -32
- data/test/database.yml +31 -28
- data/test/distance_collection_test.rb +42 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +1 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/location_aware_controller.rb +43 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +68 -0
- data/test/dummy/config/environments/production.rb +87 -0
- data/test/dummy/config/environments/test.rb +60 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/permissions_policy.rb +11 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +43 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +6 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/storage/.keep +0 -0
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/dummy/tmp/storage/.keep +0 -0
- data/test/fixtures/companies.yml +9 -9
- data/test/fixtures/custom_locations.yml +61 -61
- data/test/fixtures/locations.yml +61 -61
- data/test/fixtures/mock_addresses.yml +16 -16
- data/test/fixtures/mock_families.yml +2 -2
- data/test/fixtures/mock_houses.yml +8 -8
- data/test/fixtures/mock_organizations.yml +4 -4
- data/test/fixtures/mock_people.yml +4 -4
- data/test/ip_geocode_lookup_test.rb +53 -0
- data/test/models/company.rb +2 -2
- data/test/models/custom_location.rb +11 -11
- data/test/models/location.rb +3 -3
- data/test/models/mock_address.rb +3 -3
- data/test/models/mock_family.rb +4 -4
- data/test/models/mock_house.rb +2 -2
- data/test/models/mock_organization.rb +5 -5
- data/test/models/mock_person.rb +6 -6
- data/test/models/store.rb +2 -2
- data/test/schema.rb +61 -61
- data/test/tasks.rake +37 -37
- data/test/test_helper.rb +83 -56
- metadata +137 -37
- data/.travis.yml +0 -29
- data/test/ip_geocode_lookup_test.disabled.rb +0 -82
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_helper'
|
|
4
|
+
|
|
5
|
+
class AdapterResolutionTest < GeokitTestCase
|
|
6
|
+
def test_mysql2_adapter
|
|
7
|
+
begin
|
|
8
|
+
# Defines the top-level ::Mysql2 module, which must not be mistaken for
|
|
9
|
+
# the Geokit adapter of the same name.
|
|
10
|
+
require 'mysql2'
|
|
11
|
+
rescue LoadError
|
|
12
|
+
skip 'the mysql2 gem cannot be loaded here'
|
|
13
|
+
end
|
|
14
|
+
adapter = finder_adapter_for('Mysql2')
|
|
15
|
+
assert_instance_of Geokit::Adapters::Mysql2, adapter
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Database gems can define a top-level class named like an adapter, as the
|
|
19
|
+
# trilogy gem does with Trilogy.
|
|
20
|
+
def test_ignores_top_level_class_named_like_the_adapter
|
|
21
|
+
Object.const_set(:OracleEnhanced, Class.new)
|
|
22
|
+
adapter = finder_adapter_for('OracleEnhanced')
|
|
23
|
+
assert_instance_of Geokit::Adapters::OracleEnhanced, adapter
|
|
24
|
+
ensure
|
|
25
|
+
Object.send(:remove_const, :OracleEnhanced)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_unsupported_adapter
|
|
29
|
+
assert_raises(Geokit::ActsAsMappable::UnsupportedAdapter) do
|
|
30
|
+
finder_adapter_for('Unknown')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
# Resolves the adapter on a throwaway model whose connection reports the
|
|
37
|
+
# given adapter name, leaving Location's real connection and memoized
|
|
38
|
+
# adapter untouched.
|
|
39
|
+
def finder_adapter_for(adapter_name)
|
|
40
|
+
fake_connection = Struct.new(:adapter_name).new(adapter_name)
|
|
41
|
+
model = Class.new(Location) do
|
|
42
|
+
define_singleton_method(:connection) { fake_connection }
|
|
43
|
+
end
|
|
44
|
+
model.geokit_finder_adapter
|
|
45
|
+
end
|
|
46
|
+
end
|
data/test/boot.rb
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
require 'pathname'
|
|
2
|
-
|
|
3
|
-
require "active_support/version"
|
|
4
|
-
require 'active_support/test_case'
|
|
5
|
-
require "active_support/testing/autorun" if ActiveSupport::VERSION::MAJOR >= 4
|
|
6
|
-
|
|
7
|
-
require 'active_record'
|
|
8
|
-
require 'active_record/fixtures'
|
|
9
|
-
|
|
10
|
-
require 'action_controller'
|
|
11
|
-
# require 'action_dispatch'
|
|
12
|
-
# require 'action_dispatch/testing/test_process'
|
|
13
|
-
|
|
14
|
-
pwd = Pathname.new(File.dirname(__FILE__)).expand_path
|
|
15
|
-
|
|
16
|
-
PLUGIN_ROOT = pwd + '..'
|
|
17
|
-
ADAPTER = ENV['DB'] || 'sqlite'
|
|
18
|
-
|
|
19
|
-
$LOAD_PATH << (PLUGIN_ROOT + 'lib')
|
|
20
|
-
$LOAD_PATH << (PLUGIN_ROOT + 'test/models')
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
require 'pathname'
|
|
2
|
+
|
|
3
|
+
require "active_support/version"
|
|
4
|
+
require 'active_support/test_case'
|
|
5
|
+
require "active_support/testing/autorun" if ActiveSupport::VERSION::MAJOR >= 4
|
|
6
|
+
|
|
7
|
+
require 'active_record'
|
|
8
|
+
require 'active_record/fixtures'
|
|
9
|
+
|
|
10
|
+
require 'action_controller'
|
|
11
|
+
# require 'action_dispatch'
|
|
12
|
+
# require 'action_dispatch/testing/test_process'
|
|
13
|
+
|
|
14
|
+
pwd = Pathname.new(File.dirname(__FILE__)).expand_path
|
|
15
|
+
|
|
16
|
+
PLUGIN_ROOT = pwd + '..'
|
|
17
|
+
ADAPTER = ENV['DB'] || 'sqlite'
|
|
18
|
+
|
|
19
|
+
$LOAD_PATH << (PLUGIN_ROOT + 'lib')
|
|
20
|
+
$LOAD_PATH << (PLUGIN_ROOT + 'test/models')
|
|
21
|
+
|
|
22
|
+
require 'erb'
|
|
23
|
+
|
|
24
|
+
config_file = PLUGIN_ROOT + 'test/database.yml'
|
|
25
|
+
config_content = ERB.new(IO.read(config_file)).result
|
|
26
|
+
if defined?(YAML.safe_load)
|
|
27
|
+
db_config = YAML.safe_load(config_content, aliases: true)
|
|
28
|
+
else
|
|
29
|
+
# Fallback for older Ruby versions that don't support YAML.safe_load
|
|
30
|
+
db_config = YAML.load(config_content) # rubocop:disable Security/YAMLLoad
|
|
31
|
+
end
|
|
32
|
+
logger_file = PLUGIN_ROOT + "test/#{ADAPTER}-debug.log"
|
|
33
|
+
schema_file = PLUGIN_ROOT + 'test/schema.rb'
|
|
34
|
+
|
|
35
|
+
ActiveRecord::Base.configurations = db_config
|
|
36
|
+
ActiveRecord::Base.logger = Logger.new(logger_file)
|
|
37
|
+
ActiveRecord::Base.establish_connection(db_config[ADAPTER])
|
|
38
|
+
|
|
39
|
+
ActiveRecord::Migration.verbose = false
|
|
40
|
+
load schema_file
|
data/test/database.yml
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
base: &base
|
|
2
|
-
host: localhost
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
base: &base
|
|
2
|
+
host: <%= ENV.fetch('DB_HOST', 'localhost') %>
|
|
3
|
+
<% if ENV['DB_PORT'] %>
|
|
4
|
+
port: <%= ENV['DB_PORT'] %>
|
|
5
|
+
<% end %>
|
|
6
|
+
username: <%= ENV.fetch('DB_USERNAME', 'tests') %>
|
|
7
|
+
password: <%= ENV['DB_PASSWORD'] %>
|
|
8
|
+
|
|
9
|
+
mysql:
|
|
10
|
+
adapter: mysql2
|
|
11
|
+
database: geokit_rails_tests
|
|
12
|
+
<<: *base
|
|
13
|
+
|
|
14
|
+
mysql2spatial:
|
|
15
|
+
adapter: mysql2spatial
|
|
16
|
+
database: geokit_rails_tests
|
|
17
|
+
|
|
18
|
+
postgresql:
|
|
19
|
+
adapter: postgresql
|
|
20
|
+
database: geokit_rails_tests
|
|
21
|
+
<<: *base
|
|
22
|
+
|
|
23
|
+
sqlserver:
|
|
24
|
+
adapter: sqlserver
|
|
25
|
+
mode: ODBC
|
|
26
|
+
dsn: geokit_rails_tests
|
|
27
|
+
username: tests
|
|
28
|
+
|
|
29
|
+
sqlite:
|
|
30
|
+
adapter: sqlite3
|
|
31
|
+
database: test/test.sqlite3
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
Geokit::Geocoders::provider_order = [:google, :us]
|
|
4
|
+
|
|
5
|
+
class DistanceCollectionTest < GeokitTestCase
|
|
6
|
+
|
|
7
|
+
LOCATION_A_IP = "217.10.83.5"
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
@location_a = Geokit::GeoLoc.new
|
|
11
|
+
@location_a.lat = 32.918593
|
|
12
|
+
@location_a.lng = -96.958444
|
|
13
|
+
@location_a.city = "Irving"
|
|
14
|
+
@location_a.state = "TX"
|
|
15
|
+
@location_a.country_code = "US"
|
|
16
|
+
@location_a.success = true
|
|
17
|
+
|
|
18
|
+
@sw = Geokit::LatLng.new(32.91663,-96.982841)
|
|
19
|
+
@ne = Geokit::LatLng.new(32.96302,-96.919495)
|
|
20
|
+
@bounds_center=Geokit::LatLng.new((@sw.lat+@ne.lat)/2,(@sw.lng+@ne.lng)/2)
|
|
21
|
+
|
|
22
|
+
@starbucks = companies(:starbucks)
|
|
23
|
+
@loc_a = locations(:a)
|
|
24
|
+
@custom_loc_a = custom_locations(:a)
|
|
25
|
+
@loc_e = locations(:e)
|
|
26
|
+
@custom_loc_e = custom_locations(:e)
|
|
27
|
+
|
|
28
|
+
@barnes_and_noble = mock_organizations(:barnes_and_noble)
|
|
29
|
+
@address = mock_addresses(:address_barnes_and_noble)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_distance_collection
|
|
33
|
+
# Improve this test later on.
|
|
34
|
+
locations = Location.with_latlng.all
|
|
35
|
+
unsorted = [locations(:a), locations(:b), locations(:c), locations(:d), locations(:e), locations(:f)]
|
|
36
|
+
sorted_manually = locations.sort_by{|l| l.distance_to(locations(:a))}
|
|
37
|
+
sorted_automatically = DistanceCollection.new(unsorted)
|
|
38
|
+
sorted_automatically.set_distance_from(locations(:a))
|
|
39
|
+
assert_equal sorted_manually, sorted_automatically.sort_by(&:distance)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
data/test/dummy/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Application styles */
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
class LocationAwareController < ApplicationController #:nodoc: all
|
|
2
|
+
before_action :set_ip, only: [:index,:cookietest,:sessiontest]
|
|
3
|
+
before_action :set_ip_bad, only: [:failtest]
|
|
4
|
+
before_action :setup, only: [:cookietest,:sessiontest]
|
|
5
|
+
geocode_ip_address
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
render plain: ''
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def cookietest
|
|
12
|
+
cookies[:geo_location] = @success.to_json
|
|
13
|
+
render plain: ''
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def sessiontest
|
|
17
|
+
session[:geo_location] = @success.to_json
|
|
18
|
+
render plain: ''
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def failtest
|
|
22
|
+
render plain: ''
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def rescue_action(e) raise e end;
|
|
26
|
+
private
|
|
27
|
+
def set_ip
|
|
28
|
+
request.remote_ip = "good ip"
|
|
29
|
+
end
|
|
30
|
+
def set_ip_bad
|
|
31
|
+
request.remote_ip = "bad ip"
|
|
32
|
+
end
|
|
33
|
+
def setup
|
|
34
|
+
@success = Geokit::GeoLoc.new
|
|
35
|
+
@success.provider = "hostip"
|
|
36
|
+
@success.lat = 41.7696
|
|
37
|
+
@success.lng = -88.4588
|
|
38
|
+
@success.city = "Sugar Grove"
|
|
39
|
+
@success.state = "IL"
|
|
40
|
+
@success.country_code = "US"
|
|
41
|
+
@success.success = true
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
|
4
|
+
|
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
|
7
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>Dummy</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 @@
|
|
|
1
|
+
<%= yield %>
|
data/test/dummy/bin/rake
ADDED
|
@@ -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,22 @@
|
|
|
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
|
+
require "geokit-rails"
|
|
9
|
+
|
|
10
|
+
module Dummy
|
|
11
|
+
class Application < Rails::Application
|
|
12
|
+
config.load_defaults Rails::VERSION::STRING.to_f
|
|
13
|
+
|
|
14
|
+
# Configuration for the application, engines, and railties goes here.
|
|
15
|
+
#
|
|
16
|
+
# These settings can be overridden in specific environments using the files
|
|
17
|
+
# in config/environments, which are processed later.
|
|
18
|
+
#
|
|
19
|
+
# config.time_zone = "Central Time (US & Canada)"
|
|
20
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
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: db/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: db/test.sqlite3
|
|
22
|
+
|
|
23
|
+
production:
|
|
24
|
+
<<: *default
|
|
25
|
+
database: db/production.sqlite3
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
37
|
+
config.active_storage.service = :local
|
|
38
|
+
|
|
39
|
+
# Don't care if the mailer can't send.
|
|
40
|
+
config.action_mailer.raise_delivery_errors = false
|
|
41
|
+
|
|
42
|
+
config.action_mailer.perform_caching = false
|
|
43
|
+
|
|
44
|
+
# Print deprecation notices to the Rails logger.
|
|
45
|
+
config.active_support.deprecation = :log
|
|
46
|
+
|
|
47
|
+
# Raise exceptions for disallowed deprecations.
|
|
48
|
+
config.active_support.disallowed_deprecation = :raise
|
|
49
|
+
|
|
50
|
+
# Tell Active Support which deprecation messages to disallow.
|
|
51
|
+
config.active_support.disallowed_deprecation_warnings = []
|
|
52
|
+
|
|
53
|
+
# Raise an error on page load if there are pending migrations.
|
|
54
|
+
config.active_record.migration_error = :page_load
|
|
55
|
+
|
|
56
|
+
# Highlight code that triggered database queries in logs.
|
|
57
|
+
config.active_record.verbose_query_logs = true
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# Raises error for missing translations.
|
|
61
|
+
# config.i18n.raise_on_missing_translations = true
|
|
62
|
+
|
|
63
|
+
# Annotate rendered view with file names.
|
|
64
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
65
|
+
|
|
66
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
67
|
+
# config.action_cable.disable_request_forgery_protection = true
|
|
68
|
+
end
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
28
|
+
# config.asset_host = "http://assets.example.com"
|
|
29
|
+
|
|
30
|
+
# Specifies the header that your server uses for sending files.
|
|
31
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
|
32
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
|
33
|
+
|
|
34
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
35
|
+
config.active_storage.service = :local
|
|
36
|
+
|
|
37
|
+
# Mount Action Cable outside main process or domain.
|
|
38
|
+
# config.action_cable.mount_path = nil
|
|
39
|
+
# config.action_cable.url = "wss://example.com/cable"
|
|
40
|
+
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
|
41
|
+
|
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
43
|
+
# config.force_ssl = true
|
|
44
|
+
|
|
45
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
|
46
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
|
47
|
+
config.log_level = :info
|
|
48
|
+
|
|
49
|
+
# Prepend all log lines with the following tags.
|
|
50
|
+
config.log_tags = [ :request_id ]
|
|
51
|
+
|
|
52
|
+
# Use a different cache store in production.
|
|
53
|
+
# config.cache_store = :mem_cache_store
|
|
54
|
+
|
|
55
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
|
56
|
+
# config.active_job.queue_adapter = :resque
|
|
57
|
+
# config.active_job.queue_name_prefix = "dummy_production"
|
|
58
|
+
|
|
59
|
+
config.action_mailer.perform_caching = false
|
|
60
|
+
|
|
61
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
62
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
63
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
64
|
+
|
|
65
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
66
|
+
# the I18n.default_locale when a translation cannot be found).
|
|
67
|
+
config.i18n.fallbacks = true
|
|
68
|
+
|
|
69
|
+
# Don't log any deprecations.
|
|
70
|
+
config.active_support.report_deprecations = false
|
|
71
|
+
|
|
72
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
73
|
+
config.log_formatter = ::Logger::Formatter.new
|
|
74
|
+
|
|
75
|
+
# Use a different logger for distributed setups.
|
|
76
|
+
# require "syslog/logger"
|
|
77
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
|
78
|
+
|
|
79
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
80
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
|
81
|
+
logger.formatter = config.log_formatter
|
|
82
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Do not dump schema after migrations.
|
|
86
|
+
config.active_record.dump_schema_after_migration = false
|
|
87
|
+
end
|