push_type_core 0.8.2 → 0.9.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/fields/push_type/tag_list_field.rb +2 -2
- data/app/models/concerns/push_type/unexposable.rb +1 -1
- data/lib/push_type/testing/common_rake.rb +2 -1
- data/lib/push_type/testing/setup.rb +6 -0
- data/lib/push_type/testing/support/expectations.rb +11 -0
- data/lib/push_type/version.rb +1 -1
- data/test/controllers/front_end_controller_test.rb +2 -2
- data/test/dummy/{README.rdoc → README.md} +1 -5
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/config/manifest.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +3 -3
- 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 +0 -2
- data/test/dummy/app/jobs/application_job.rb +2 -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/views/layouts/application.html.erb +8 -8
- 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 +1 -1
- data/test/dummy/bin/setup +17 -12
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/database.yml +2 -2
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +24 -11
- data/test/dummy/config/environments/production.rb +24 -17
- data/test/dummy/config/environments/test.rb +6 -6
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +2 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
- data/test/dummy/config/initializers/push_type.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +1 -54
- data/test/dummy/config/secrets.yml +3 -3
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +2 -1
- data/test/dummy/db/schema.rb +6 -8
- data/test/dummy/db/seeds.rb +3 -3
- data/test/dummy/log/test.log +9411 -9376
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/{aP/aP9ugnoyKROpCcS7YL5bnUT1O0JwWQh4eL-lJguHJNk.cache → Jb/Jb810SiOuJVuKRcwOdnHdyrHDD_hWIWvSHrcSPoaQPU.cache} +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/{g7/g7hfivsQMUCaQEqa3fNXHP8Tmbv72q85IeMZlKz1A1w.cache → SO/SOZa21InoBC05GGCDAcckZrbpHSOC_C1x_8gdUutdjs.cache} +2 -2
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/{1l/1lgqDTR9gGukdSENXZntwdNqC1WI44OdFXB_mYW5yuk.cache → T4/T4GQ8YD0DmTbkGOBb9_FXxyAS4d4bTyDY2ZNaOFrZYI.cache} +0 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/XK/XKi7NI277oX6OL-scTKJX0mD8ETpeTWUmd0qOhAh48c.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/cS/cSFgEM3CjGY-WL5BvUliuazHXS93pXySDc_urG4lNaE.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/{TP/TPUoo4sX7sBfMJ_HNNIt2WhWmTzsgu_ywRm1et0eoN0.cache → ff/ffkN8ZBG66BGCq-xL4PHZZAsspgxBQNa9shBPn9Wiqg.cache} +2 -2
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/hy/hyqofDaeg-q9IihEOLw2JbC6hGbwuYdXFRM9oFc1J64.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/nq/nquxPPDMFQdTs8eGDT2OwFDhyUXTjCiTzy-AK0OiruM.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/og/og2Zl6GnhduLl0YJf4C9T6H-QZ3xbeND4jjCS_Iz6D8.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/qQ/qQ8c5p2po-w6U57egs5gQy5iUvn5Y5bQH3HPJslC4XU.cache +1 -0
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/{LY/LY-K3FTDpqOZfFSZb1BgnzI6IcwgEe-qVq2cB5Wo7hc.cache → rI/rIrIe053W7_bEOF2UU8uE2-YdjmGhP_XyEll7fNAGHQ.cache} +0 -0
- data/test/dummy/tmp/generators/app/models/location.rb +7 -0
- metadata +128 -64
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/-K/-KRPVoCYVzbfzLXlXQogpskJSnZ0HfVou2e5tQHIJ94.cache +0 -1
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/4b/4b1XF5NcBp9ea4U91OkH7OnGb5yBXnLRobZUVnrYQZY.cache +0 -1
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/8Z/8Z8NReKmNGw_LKGJrqMi57iLalYxRSsCz8C0HyUBcFw.cache +0 -1
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/Gr/Groxd22-2x3-TgwJofLgyj5xpGqSBuMVuOClCEoZ7A0.cache +0 -1
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/PI/PIywb8-2j1FZKWFRWNm49KKYUju4qPDiXj2R60gZwEs.cache +0 -1
- data/test/dummy/tmp/cache/assets/sprockets/v3.0/un/unRcQxp09TEeuHjcQZuF4a-j7CErQidN8Iv_7LmuiXg.cache +0 -1
- data/test/dummy/tmp/generators/config/initializers/push_type.rb +0 -50
- data/test/dummy/tmp/generators/config/routes.rb +0 -59
- /data/test/dummy/db/migrate/{20160615180803_create_push_type_users.push_type.rb → 20160725104431_create_push_type_users.push_type.rb} +0 -0
- /data/test/dummy/db/migrate/{20160615180804_create_push_type_nodes.push_type.rb → 20160725104432_create_push_type_nodes.push_type.rb} +0 -0
- /data/test/dummy/db/migrate/{20160615180805_create_push_type_node_hierarchies.push_type.rb → 20160725104433_create_push_type_node_hierarchies.push_type.rb} +0 -0
- /data/test/dummy/db/migrate/{20160615180806_create_push_type_assets.push_type.rb → 20160725104434_create_push_type_assets.push_type.rb} +0 -0
- /data/test/dummy/db/migrate/{20160615180807_add_field_store_default_values.push_type.rb → 20160725104435_add_field_store_default_values.push_type.rb} +0 -0
- /data/test/dummy/db/migrate/{20160615180808_drop_legacy_push_type_taxonomies.push_type.rb → 20160725104436_drop_legacy_push_type_taxonomies.push_type.rb} +0 -0
- /data/test/dummy/tmp/cache/assets/sprockets/v3.0/{5d/5dQrPu4rI_K7R9AV8N5XURWY_1Pk_XDrx1_TgEiPJwA.cache → FY/FYTJbeYszISifBF_e9V_McV0ypFX5D_qRidBDUSyduE.cache} +0 -0
- /data/test/dummy/tmp/cache/assets/sprockets/v3.0/{OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache → n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache} +0 -0
- /data/test/dummy/tmp/cache/assets/sprockets/v3.0/{5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache → nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4248c5eec8369360f65248a023d70266e0d89861
|
4
|
+
data.tar.gz: 3ab7e1fabd695beb650a424ba3afc3fbf52f7203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44634098799932d30610325cad9881357f2638adf1d5429f37cbfb67320de4317d7f6e1dc223f9794fe33010e8e1f725fab01ab172cdb5e12898d0213df76af0
|
7
|
+
data.tar.gz: c7ab96bbd3e172d98593b54e86db92d98df623162831fb56e086d100f917189e9174a4bf9cf040158b0610ef38c43f42136cad50860d0fca0f72f3bd12bc7646
|
@@ -49,8 +49,8 @@ module PushType
|
|
49
49
|
block.respond_to?(:call) ? block.call : all
|
50
50
|
).where(["field_store->'#{ field_name }' ?| ARRAY[:tags]", { tags: tags }])
|
51
51
|
|
52
|
-
t = Arel::Table.new('t'
|
53
|
-
ct = Arel::Table.new('ct'
|
52
|
+
t = Arel::Table.new('t')
|
53
|
+
ct = Arel::Table.new('ct')
|
54
54
|
|
55
55
|
arr_sql = Arel.sql "ARRAY[#{ tags.map { |t| Arel::Nodes::Quoted.new(t).to_sql }.join(', ') }]"
|
56
56
|
any_tags_func = Arel::Nodes::NamedFunction.new('ANY', [arr_sql])
|
@@ -14,7 +14,8 @@ namespace :common do
|
|
14
14
|
PushType::DummyGenerator.start opts
|
15
15
|
|
16
16
|
Dir.chdir File.join(args[:base_path], args[:dummy_path]) do
|
17
|
-
system '
|
17
|
+
system 'bin/rails db:environment:set RAILS_ENV=test'
|
18
|
+
system 'bin/rails db:drop db:create'
|
18
19
|
PushType::InstallGenerator.start ['--quiet']
|
19
20
|
PushType::NodeGenerator.start ['page', '--quiet']
|
20
21
|
PushType::StructureGenerator.start ['location', '--quiet']
|
@@ -2,6 +2,7 @@ require 'minitest-spec-rails'
|
|
2
2
|
require 'minitest/mock'
|
3
3
|
require 'minitest/pride'
|
4
4
|
require 'database_cleaner'
|
5
|
+
require 'rails-controller-testing'
|
5
6
|
|
6
7
|
# Load support files
|
7
8
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
@@ -25,6 +26,7 @@ class ActiveSupport::TestCase
|
|
25
26
|
after :each do
|
26
27
|
DatabaseCleaner.clean
|
27
28
|
end
|
29
|
+
|
28
30
|
# Add more helper methods to be used by all tests here...
|
29
31
|
end
|
30
32
|
|
@@ -32,4 +34,8 @@ class ActionController::TestCase
|
|
32
34
|
before :each do
|
33
35
|
@routes = PushType::Core::Engine.routes
|
34
36
|
end
|
37
|
+
|
38
|
+
include ::Rails::Controller::Testing::TestProcess
|
39
|
+
include ::Rails::Controller::Testing::TemplateAssertions
|
40
|
+
include ::Rails::Controller::Testing::Integration
|
35
41
|
end
|
@@ -13,3 +13,14 @@ class ActionController::TestResponse
|
|
13
13
|
infect_an_assertion :assert_select_email, :must_select_email
|
14
14
|
infect_an_assertion :assert_select_encoded, :must_select_encoded
|
15
15
|
end
|
16
|
+
|
17
|
+
class ActionDispatch::TestResponse
|
18
|
+
infect_an_assertion :assert_response, :must_respond_with
|
19
|
+
infect_an_assertion :assert_redirected_to, :must_redirect_to
|
20
|
+
infect_an_assertion :assert_template, :must_render_template
|
21
|
+
infect_an_assertion :assert_tag, :must_have_tag
|
22
|
+
infect_an_assertion :assert_no_tag, :wont_have_tag
|
23
|
+
infect_an_assertion :assert_select, :must_select
|
24
|
+
infect_an_assertion :assert_select_email, :must_select_email
|
25
|
+
infect_an_assertion :assert_select_encoded, :must_select_encoded
|
26
|
+
end
|
data/lib/push_type/version.rb
CHANGED
@@ -7,7 +7,7 @@ class FrontEndControllerTest < ActionController::TestCase
|
|
7
7
|
describe 'GET #show' do
|
8
8
|
let(:page) { Page.create attributes }
|
9
9
|
let(:permalink) { page.permalink }
|
10
|
-
let(:action!) { get :show, permalink: permalink }
|
10
|
+
let(:action!) { get :show, params: { permalink: permalink } }
|
11
11
|
|
12
12
|
describe 'when node does not exist' do
|
13
13
|
let(:permalink) { 'does/not/exist' }
|
@@ -45,7 +45,7 @@ class FrontEndControllerTest < ActionController::TestCase
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
let(:page) { FactoryGirl.create :published_node, type: 'Page' }
|
48
|
-
before { get :show, permalink: page.permalink }
|
48
|
+
before { get :show, params: { permalink: page.permalink } }
|
49
49
|
it { assigns[:foo].must_be_instance_of Hash }
|
50
50
|
it { assigns[:foo][:node_action].must_equal true }
|
51
51
|
it { assigns[:foo][:page_action].must_equal true }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# README
|
2
2
|
|
3
3
|
This README would normally document whatever steps are necessary to get the
|
4
4
|
application up and running.
|
@@ -22,7 +22,3 @@ Things you may want to cover:
|
|
22
22
|
* Deployment instructions
|
23
23
|
|
24
24
|
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
3
|
|
4
|
-
|
4
|
+
require_relative 'config/application'
|
5
5
|
|
6
6
|
Rails.application.load_tasks
|
@@ -6,9 +6,9 @@
|
|
6
6
|
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
7
|
*
|
8
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
|
10
|
-
*
|
11
|
-
* file per style scope.
|
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
12
|
*
|
13
13
|
*= require_tree .
|
14
14
|
*= require_self
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
<%= csrf_meta_tags %>
|
7
|
-
</head>
|
8
|
-
<body>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= csrf_meta_tags %>
|
9
6
|
|
10
|
-
<%=
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
8
|
+
</head>
|
11
9
|
|
12
|
-
|
10
|
+
<body>
|
11
|
+
<%= yield %>
|
12
|
+
</body>
|
13
13
|
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/test/dummy/bin/rails
CHANGED
data/test/dummy/bin/setup
CHANGED
@@ -1,29 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
3
5
|
|
4
6
|
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../',
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
8
|
|
7
|
-
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
8
14
|
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file
|
15
|
+
# Add necessary setup steps to this file.
|
10
16
|
|
11
|
-
puts
|
12
|
-
system
|
13
|
-
system
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
14
20
|
|
15
21
|
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?(
|
17
|
-
#
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
18
24
|
# end
|
19
25
|
|
20
26
|
puts "\n== Preparing database =="
|
21
|
-
system
|
27
|
+
system! 'bin/rails db:setup'
|
22
28
|
|
23
29
|
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system
|
25
|
-
system "rm -rf tmp/cache"
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
31
|
|
27
32
|
puts "\n== Restarting application server =="
|
28
|
-
system
|
33
|
+
system! 'bin/rails restart'
|
29
34
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# PostgreSQL. Versions
|
1
|
+
# PostgreSQL. Versions 9.1 and up are supported.
|
2
2
|
#
|
3
3
|
# Install the pg driver:
|
4
4
|
# gem install pg
|
@@ -19,7 +19,7 @@ default: &default
|
|
19
19
|
encoding: unicode
|
20
20
|
# For details on connection pooling, see rails configuration guide
|
21
21
|
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
22
|
-
pool: 5
|
22
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
23
23
|
|
24
24
|
development:
|
25
25
|
<<: *default
|
@@ -9,13 +9,28 @@ Rails.application.configure do
|
|
9
9
|
# Do not eager load code on boot.
|
10
10
|
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports
|
13
|
-
config.consider_all_requests_local
|
14
|
-
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
config.cache_store = :memory_store
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => 'public, max-age=172800'
|
22
|
+
}
|
23
|
+
else
|
24
|
+
config.action_controller.perform_caching = false
|
25
|
+
|
26
|
+
config.cache_store = :null_store
|
27
|
+
end
|
15
28
|
|
16
29
|
# Don't care if the mailer can't send.
|
17
30
|
config.action_mailer.raise_delivery_errors = false
|
18
31
|
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
19
34
|
# Print deprecation notices to the Rails logger.
|
20
35
|
config.active_support.deprecation = :log
|
21
36
|
|
@@ -27,15 +42,13 @@ Rails.application.configure do
|
|
27
42
|
# number of complex assets.
|
28
43
|
config.assets.debug = true
|
29
44
|
|
30
|
-
#
|
31
|
-
|
32
|
-
config.assets.digest = true
|
33
|
-
|
34
|
-
# Adds additional error checking when serving assets at runtime.
|
35
|
-
# Checks for improperly declared sprockets dependencies.
|
36
|
-
# Raises helpful error messages.
|
37
|
-
config.assets.raise_runtime_errors = true
|
45
|
+
# Suppress logger output for asset requests.
|
46
|
+
config.assets.quiet = true
|
38
47
|
|
39
48
|
# Raises error for missing translations
|
40
49
|
# config.action_view.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
41
54
|
end
|
@@ -14,15 +14,9 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
17
|
# Disable serving static files from the `/public` folder by default since
|
24
18
|
# Apache or NGINX already handles this.
|
25
|
-
config.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
20
|
|
27
21
|
# Compress JavaScripts and CSS.
|
28
22
|
config.assets.js_compressor = :uglifier
|
@@ -31,16 +25,20 @@ Rails.application.configure do
|
|
31
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
26
|
config.assets.compile = false
|
33
27
|
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
-
# yet still be able to expire them through the digest params.
|
36
|
-
config.assets.digest = true
|
37
|
-
|
38
28
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
29
|
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
40
33
|
# Specifies the header that your server uses for sending files.
|
41
34
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
35
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
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
|
+
|
44
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
43
|
# config.force_ssl = true
|
46
44
|
|
@@ -49,16 +47,15 @@ Rails.application.configure do
|
|
49
47
|
config.log_level = :debug
|
50
48
|
|
51
49
|
# Prepend all log lines with the following tags.
|
52
|
-
|
53
|
-
|
54
|
-
# Use a different logger for distributed setups.
|
55
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
50
|
+
config.log_tags = [ :request_id ]
|
56
51
|
|
57
52
|
# Use a different cache store in production.
|
58
53
|
# config.cache_store = :mem_cache_store
|
59
54
|
|
60
|
-
#
|
61
|
-
# config.
|
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_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
62
59
|
|
63
60
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
61
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -74,6 +71,16 @@ Rails.application.configure do
|
|
74
71
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
72
|
config.log_formatter = ::Logger::Formatter.new
|
76
73
|
|
74
|
+
# Use a different logger for distributed setups.
|
75
|
+
# require 'syslog/logger'
|
76
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
+
|
78
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
79
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
+
logger.formatter = config.log_formatter
|
81
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
+
end
|
83
|
+
|
77
84
|
# Do not dump schema after migrations.
|
78
85
|
config.active_record.dump_schema_after_migration = false
|
79
86
|
end
|
@@ -12,9 +12,11 @@ Rails.application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
# Configure
|
16
|
-
config.
|
17
|
-
config.
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => 'public, max-age=3600'
|
19
|
+
}
|
18
20
|
|
19
21
|
# Show full error reports and disable caching.
|
20
22
|
config.consider_all_requests_local = true
|
@@ -25,15 +27,13 @@ Rails.application.configure do
|
|
25
27
|
|
26
28
|
# Disable request forgery protection in test environment.
|
27
29
|
config.action_controller.allow_forgery_protection = false
|
30
|
+
config.action_mailer.perform_caching = false
|
28
31
|
|
29
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
30
33
|
# The :test delivery method accumulates sent emails in the
|
31
34
|
# ActionMailer::Base.deliveries array.
|
32
35
|
config.action_mailer.delivery_method = :test
|
33
36
|
|
34
|
-
# Randomize the order test cases are executed.
|
35
|
-
config.active_support.test_order = :random
|
36
|
-
|
37
37
|
# Print deprecation notices to the stderr.
|
38
38
|
config.active_support.deprecation = :stderr
|
39
39
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
#
|
3
|
+
# This file contains migration options to ease your Rails 5.0 upgrade.
|
4
|
+
#
|
5
|
+
# Read the Rails 5.0 release notes for more info on each option.
|
6
|
+
|
7
|
+
# Enable per-form CSRF tokens. Previous versions had false.
|
8
|
+
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
9
|
+
|
10
|
+
# Enable origin-checking CSRF mitigation. Previous versions had false.
|
11
|
+
Rails.application.config.action_controller.forgery_protection_origin_check = true
|
12
|
+
|
13
|
+
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
|
14
|
+
# Previous versions had false.
|
15
|
+
ActiveSupport.to_time_preserves_timezone = true
|
16
|
+
|
17
|
+
# Require `belongs_to` associations by default. Previous versions had false.
|
18
|
+
Rails.application.config.active_record.belongs_to_required_by_default = true
|
19
|
+
|
20
|
+
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
21
|
+
ActiveSupport.halt_callback_chains_on_return_false = false
|
22
|
+
|
23
|
+
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
24
|
+
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
@@ -45,6 +45,6 @@ PushType.setup do |config|
|
|
45
45
|
# secret_access_key: ENV['SECRET_ACCESS_KEY_ID']
|
46
46
|
# }
|
47
47
|
|
48
|
-
# config.dragonfly_secret = '
|
48
|
+
# config.dragonfly_secret = '60e854c4cd380c55bf9fd3af016dd8ad82ca8bc52988d807b180f4e50f72202f'
|
49
49
|
|
50
50
|
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
|
11
11
|
# To enable root element in JSON for ActiveRecord objects.
|
12
12
|
# ActiveSupport.on_load(:active_record) do
|
13
|
-
#
|
13
|
+
# self.include_root_in_json = true
|
14
14
|
# end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum, this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
8
|
+
threads threads_count, threads_count
|
9
|
+
|
10
|
+
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
11
|
+
#
|
12
|
+
port ENV.fetch("PORT") { 3000 }
|
13
|
+
|
14
|
+
# Specifies the `environment` that Puma will run in.
|
15
|
+
#
|
16
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
17
|
+
|
18
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
19
|
+
# Workers are forked webserver processes. If using threads and workers together
|
20
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
21
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
22
|
+
# processes).
|
23
|
+
#
|
24
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
25
|
+
|
26
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
27
|
+
# This directive tells Puma to first boot the application and load code
|
28
|
+
# before forking the application. This takes advantage of Copy On Write
|
29
|
+
# process behavior so workers use less memory. If you use this option
|
30
|
+
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
31
|
+
# block.
|
32
|
+
#
|
33
|
+
# preload_app!
|
34
|
+
|
35
|
+
# The code in the `on_worker_boot` will be called if you are using
|
36
|
+
# clustered mode by specifying a number of `workers`. After each worker
|
37
|
+
# process is booted this block will be run, if you are using `preload_app!`
|
38
|
+
# option you will want to use this block to reconnect to any threads
|
39
|
+
# or connections that may have been created at application boot, Ruby
|
40
|
+
# cannot share connections between processes.
|
41
|
+
#
|
42
|
+
# on_worker_boot do
|
43
|
+
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
44
|
+
# end
|
45
|
+
|
46
|
+
# Allow puma to be restarted by `rails restart` command.
|
47
|
+
plugin :tmp_restart
|