graphiql-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/javascripts/graphiql/rails/application.js +4 -0
- data/app/assets/javascripts/graphiql/rails/fetch-0.10.1.js +381 -0
- data/app/assets/javascripts/graphiql/rails/graphiql-0.4.5.js +25949 -0
- data/app/assets/javascripts/graphiql/rails/react-0.14.4.js +18796 -0
- data/app/assets/javascripts/graphiql/rails/react-dom-0.14.4.js +42 -0
- data/app/assets/stylesheets/graphiql/rails/application.css +3 -0
- data/app/assets/stylesheets/graphiql/rails/graphiql-0.4.5.css +1129 -0
- data/app/controllers/graphiql/rails/editors_controller.rb +13 -0
- data/app/views/graphiql/rails/editors/show.html.erb +82 -0
- data/config/routes.rb +3 -0
- data/lib/graphiql/rails/engine.rb +7 -0
- data/lib/graphiql/rails/version.rb +5 -0
- data/lib/graphiql/rails/welcome_message.rb +19 -0
- data/lib/graphiql/rails.rb +23 -0
- data/readme.md +42 -0
- data/test/controllers/editors_controller_test.rb +45 -0
- data/test/dummy/config/application.rb +15 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/test.log +255 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/1ODY0DQ_ANmCpmLHVw-UiUNedcqRH6ImiwraD-KSxmU.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/1War8wEt1WB20cDivlUtmLJerXVjqviIoF8z6rqT8Ks.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/4afUNpWO5PKPxu8ou16ONcr5t-fGUZ2Shr4G8Df72YA.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/4uKBwHz0rzsw3ojNBNu9y5_uCi8J-R25B-ulDbod0ac.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/6L5bwqSkEwSagAwfXFO_BHlhr-_mvwg_lgpT3A3JbN0.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/9WBVwGkXlR0wCsNKUohikZZp8DR2hCht4PC4HgUpVtE.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/D6JFGS9ijELU5G9m1CfXCX8rWJkohiAMkuv8YC6xUjw.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/F5qrQYWr9yyxwBAqe2TQJQ80nVmH5_i6afl5PMp6Z8U.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/FBkf4qNXTD-K2DutfFs6Zf9i5H9hjdJloZPy1grMXAE.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/KdaFp_G3QwcgCbdUZsL9ERPiz2zPHLWUhEnEQ9unDEk.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/LW2Js2OuBRJvwb8wIDyZiUmxDiktnV0klq55abg8Yvc.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/QFCa105_BZXNgKGSe-v9Jf_AvhbTDjIkGQGzEb-Vy30.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/T86TPGUlBfOM9KZj9oYg6ixlwd0tHGUCJutAZFY1gCU.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/TGrsg_69egMpvuFwg0oH2vvET7aA-FRmlCjoLRIydHc.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/UYTk5zEFerusuYX_FIGABGYtIFVy570hoqVn6fp4Hf0.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/VbHRo0ICd88LdUrVUQR8ZJqMqH1IObHIAWqbecGFZ6Q.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/WtewLeu-yAjYJXYBEdyWkiz1hMDrx_bY3cX9n2AjPDg.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/WwJ37E-kUxtDgxvSx_3O5YaHEoWJftzFzuNSGXIlsaI.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/Yz7xid4a42sQZ3rupYo5gpJ9oip15QSrXsaEsgCWMiE.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/Z7xvl4QQk2iWzQ22z2eYhPN2nmaKmistpZEnfcbseII.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/ZRl7-s5kXR-yC2mcuDoSOpLrt84TlvO5s-cYh9dPz14.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/cL6ZrXE1HfAZSwt39igMHt_vxShjSAAd2VzP2XmFjmw.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/dKvwS0jAbddDiur_8v76DBm-vIYC10o0GRKZETpSAR8.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/eRGERGKDp2NYy2HoC_meEQGqDi19WjrGxu2nnaGIcuA.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/fr6QWODYhpQ8atcpXcDO6v5h6BOarqt8SKw2FSPznCA.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/hQiz6pgkjKTcBzpg6HxImHPEn_gJnNexHa93Uqf06C4.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/hZjnBRtszTef59Um5ZCsKPKni61XffqsmNbcFyEHt18.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/k8dK469Rg8A3Vy6LuTNHpwXi-DL1q9hU1ycx5Wepy0o.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/kNn8zrGAYzFMb9nV4jNn_hIWuRyRyf2WwQ0PJNNitDc.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/o67fWawCsaNbsqQ_0cc88iV6xiIrMvkkAWNbVL0f2PQ.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/r1BfxqwrxBJjF2iyMWPpMrJJ4x3id-oue7o_4u4Gs88.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/urFQAPpM6EpglGPluq2htIfR2Xyj38lKiU9yZcyQDlk.cache +0 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/vHuLTiNtDGbZ0WmXVRXzE9sjC1uytC3VHPfIsJjWPXI.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/xJGUXwL_WUBjqcf8fWNmNx7AJfGg-KPJqE5kVwPZg68.cache +1 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/yLVqhPCNcVTbpUt7K66-E4rXgH9sPDxfNXqMWF_eM44.cache +2 -0
- data/test/dummy/tmp/cache/sprockets/v3.0/yjDlbfNxhC1OMh3gMlUezFGgrplZ0G80J6ury8BWdHk.cache +2 -0
- data/test/graphiql/rails/engine_test.rb +7 -0
- data/test/graphiql/rails_test.rb +12 -0
- data/test/test_helper.rb +12 -0
- metadata +258 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
module GraphiQL
|
2
|
+
module Rails
|
3
|
+
class EditorsController < ActionController::Base
|
4
|
+
def show
|
5
|
+
end
|
6
|
+
|
7
|
+
helper_method :graphql_endpoint_path
|
8
|
+
def graphql_endpoint_path
|
9
|
+
params[:graphql_path] || raise(%|You must include `graphql_path: "/my/endpoint"` when mounting GraphiQL::Rails::Engine|)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>GraphiQL</title>
|
5
|
+
<%= stylesheet_link_tag("graphiql/rails/application") %>
|
6
|
+
<%= javascript_include_tag("graphiql/rails/application") %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
Loading...
|
10
|
+
<script>
|
11
|
+
var parameters = {
|
12
|
+
query: "<%= GraphiQL::Rails.config.initial_query.gsub(/\n/, "\\n") %>"
|
13
|
+
};
|
14
|
+
|
15
|
+
<% if GraphiQL::Rails.config.query_params %>
|
16
|
+
// Parse the search string to get url parameters.
|
17
|
+
var search = window.location.search;
|
18
|
+
search.substr(1).split('&').forEach(function (entry) {
|
19
|
+
var eq = entry.indexOf('=');
|
20
|
+
if (eq >= 0) {
|
21
|
+
parameters[decodeURIComponent(entry.slice(0, eq))] =
|
22
|
+
decodeURIComponent(entry.slice(eq + 1));
|
23
|
+
}
|
24
|
+
});
|
25
|
+
// if variables was provided, try to format it.
|
26
|
+
if (parameters.variables) {
|
27
|
+
try {
|
28
|
+
parameters.variables =
|
29
|
+
JSON.stringify(JSON.parse(parameters.variables), null, 2);
|
30
|
+
} catch (e) {
|
31
|
+
// Do nothing, we want to display the invalid JSON as a string, rather
|
32
|
+
// than present an error.
|
33
|
+
}
|
34
|
+
}
|
35
|
+
// When the query and variables string is edited, update the URL bar so
|
36
|
+
// that it can be easily shared
|
37
|
+
function onEditQuery(newQuery) {
|
38
|
+
parameters.query = newQuery;
|
39
|
+
updateURL();
|
40
|
+
}
|
41
|
+
function onEditVariables(newVariables) {
|
42
|
+
parameters.variables = newVariables;
|
43
|
+
updateURL();
|
44
|
+
}
|
45
|
+
function updateURL() {
|
46
|
+
var newSearch = '?' + Object.keys(parameters).map(function (key) {
|
47
|
+
return encodeURIComponent(key) + '=' +
|
48
|
+
encodeURIComponent(parameters[key]);
|
49
|
+
}).join('&');
|
50
|
+
history.replaceState(null, null, newSearch);
|
51
|
+
}
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
// Defines a GraphQL fetcher using the fetch API.
|
55
|
+
var graphQLEndpoint = "<%= graphql_endpoint_path %>";
|
56
|
+
function graphQLFetcher(graphQLParams) {
|
57
|
+
return fetch(graphQLEndpoint, {
|
58
|
+
method: 'post',
|
59
|
+
headers: { 'Content-Type': 'application/json' },
|
60
|
+
body: JSON.stringify(graphQLParams),
|
61
|
+
credentials: 'include',
|
62
|
+
}).then(function (response) {
|
63
|
+
return response.json()
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
// Render <GraphiQL /> into the body.
|
68
|
+
ReactDOM.render(
|
69
|
+
React.createElement(GraphiQL, {
|
70
|
+
fetcher: graphQLFetcher,
|
71
|
+
query: parameters.query,
|
72
|
+
<% if GraphiQL::Rails.config.query_params %>
|
73
|
+
variables: parameters.variables,
|
74
|
+
onEditQuery: onEditQuery,
|
75
|
+
onEditVariables: onEditVariables
|
76
|
+
<% end %>
|
77
|
+
}),
|
78
|
+
document.body
|
79
|
+
);
|
80
|
+
</script>
|
81
|
+
</body>
|
82
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module GraphiQL
|
2
|
+
module Rails
|
3
|
+
WELCOME_MESSAGE = %|
|
4
|
+
# Welcome to GraphiQL
|
5
|
+
#
|
6
|
+
# GraphiQL is an in-browser IDE for writing, validating, and
|
7
|
+
# testing GraphQL queries.
|
8
|
+
#
|
9
|
+
# Type queries into this side of the screen, and you will
|
10
|
+
# see intelligent typeaheads aware of the current GraphQL type schema and
|
11
|
+
# live syntax and validation errors highlighted within the text.
|
12
|
+
#
|
13
|
+
# To bring up the auto-complete at any point, just press Ctrl-Space.
|
14
|
+
#
|
15
|
+
# Press the run button above, or Cmd-Enter to execute the query, and the result
|
16
|
+
# will appear in the pane to the right.
|
17
|
+
|
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "rails"
|
2
|
+
|
3
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
4
|
+
inflect.acronym("GraphiQL")
|
5
|
+
end
|
6
|
+
|
7
|
+
require "graphiql/rails/engine"
|
8
|
+
require "graphiql/rails/version"
|
9
|
+
require "graphiql/rails/welcome_message"
|
10
|
+
|
11
|
+
|
12
|
+
module GraphiQL
|
13
|
+
module Rails
|
14
|
+
class << self
|
15
|
+
attr_accessor :config
|
16
|
+
end
|
17
|
+
|
18
|
+
self.config = OpenStruct.new({
|
19
|
+
query_params: false,
|
20
|
+
initial_query: GraphiQL::Rails::WELCOME_MESSAGE
|
21
|
+
})
|
22
|
+
end
|
23
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# GraphiQL-Rails [![Gem Version](https://badge.fury.io/rb/graphiql-rails.svg)](https://badge.fury.io/rb/graphiql-rails) [![Build Status](https://travis-ci.org/rmosolgo/graphiql-rails.svg)](https://travis-ci.org/rmosolgo/graphiql-rails)
|
2
|
+
|
3
|
+
Mount the [GraphiQL IDE](https://github.com/graphql/graphiql) in Ruby on Rails.
|
4
|
+
|
5
|
+
![image](https://cloud.githubusercontent.com/assets/2231765/12101544/4779ed54-b303-11e5-918e-9f3d3e283170.png)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add to your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "graphiql-rails"
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
### Mount the Engine
|
18
|
+
|
19
|
+
Add the engine to `routes.rb`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# config/routes.rb
|
23
|
+
Rails.application.routes.draw do
|
24
|
+
# ...
|
25
|
+
if Rails.env.development?
|
26
|
+
mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/your/endpoint"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
- `at:` is the path where GraphiQL will be served. You can access GraphiQL by visiting that path in your app.
|
32
|
+
- `graphql_path:` is the path to the GraphQL endpoint. GraphiQL will send queries to this path.
|
33
|
+
|
34
|
+
### Configuration
|
35
|
+
|
36
|
+
You can override `GraphiQL::Rails` configs in an initializer (eg, `config/initializers/graphiql.rb`). The configs are:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# These are the default values:
|
40
|
+
GraphiQL::Rails.config.query_params = false # if true, the GraphQL query string will be persisted the page's query params.
|
41
|
+
GraphiQL::Rails.config.initial_query = GraphiQL::Rails::WELCOME_MESSAGE # This string is presented to a new user
|
42
|
+
```
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
puts GraphiQL::Rails.constants
|
4
|
+
|
5
|
+
module GraphiQL
|
6
|
+
module Rails
|
7
|
+
class EditorsControllerTest < ActionController::TestCase
|
8
|
+
setup do
|
9
|
+
@routes = GraphiQL::Rails::Engine.routes
|
10
|
+
end
|
11
|
+
|
12
|
+
teardown do
|
13
|
+
GraphiQL::Rails.config.query_params = false
|
14
|
+
GraphiQL::Rails.config.initial_query = GraphiQL::Rails::WELCOME_MESSAGE
|
15
|
+
end
|
16
|
+
|
17
|
+
test "renders GraphiQL" do
|
18
|
+
get :show, graphql_path: "/my/endpoint"
|
19
|
+
assert_response(:success)
|
20
|
+
assert_includes(@response.body, "React.createElement(GraphiQL", "it renders GraphiQL")
|
21
|
+
assert_includes(@response.body, "my/endpoint", "it uses the provided path")
|
22
|
+
assert_match(/application-\w+\.js/, @response.body, "it includes assets")
|
23
|
+
end
|
24
|
+
|
25
|
+
test "it uses initial_query config" do
|
26
|
+
get :show, graphql_path: "/my/endpoint"
|
27
|
+
assert_includes(@response.body, "Welcome to GraphiQL")
|
28
|
+
|
29
|
+
GraphiQL::Rails.config.initial_query = "{ customQuery }"
|
30
|
+
get :show, graphql_path: "/my/endpoint"
|
31
|
+
refute_includes(@response.body, "Welcome to GraphiQL")
|
32
|
+
assert_includes(@response.body, "{ customQuery }")
|
33
|
+
end
|
34
|
+
|
35
|
+
test "it uses query_params config" do
|
36
|
+
get :show, graphql_path: "/my/endpoint"
|
37
|
+
refute_includes(@response.body, "onEditQuery")
|
38
|
+
|
39
|
+
GraphiQL::Rails.config.query_params = true
|
40
|
+
get :show, graphql_path: "/my/endpoint"
|
41
|
+
assert_includes(@response.body, "onEditQuery")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "sprockets/railtie"
|
6
|
+
require "rails/test_unit/railtie"
|
7
|
+
|
8
|
+
# Require the gems listed in Gemfile, including any gems
|
9
|
+
# you've limited to :test, :development, or :production.
|
10
|
+
Bundler.require(*Rails.groups)
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
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
|
38
|
+
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
41
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
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
|
+
# Disable serving static files from the `/public` folder by default since
|
24
|
+
# Apache or NGINX already handles this.
|
25
|
+
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
|
+
|
27
|
+
# Compress JavaScripts and CSS.
|
28
|
+
config.assets.js_compressor = :uglifier
|
29
|
+
# config.assets.css_compressor = :sass
|
30
|
+
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
|
+
config.assets.compile = false
|
33
|
+
|
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
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
|
+
|
40
|
+
# Specifies the header that your server uses for sending files.
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
|
+
|
44
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
|
+
# config.force_ssl = true
|
46
|
+
|
47
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
48
|
+
# when problems arise.
|
49
|
+
config.log_level = :debug
|
50
|
+
|
51
|
+
# Prepend all log lines with the following tags.
|
52
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
53
|
+
|
54
|
+
# Use a different logger for distributed setups.
|
55
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
56
|
+
|
57
|
+
# Use a different cache store in production.
|
58
|
+
# config.cache_store = :mem_cache_store
|
59
|
+
|
60
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
61
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
62
|
+
|
63
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
65
|
+
# config.action_mailer.raise_delivery_errors = false
|
66
|
+
|
67
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
69
|
+
config.i18n.fallbacks = true
|
70
|
+
|
71
|
+
# Send deprecation notices to registered listeners.
|
72
|
+
config.active_support.deprecation = :notify
|
73
|
+
|
74
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
|
+
config.log_formatter = ::Logger::Formatter.new
|
76
|
+
|
77
|
+
# Do not dump schema after migrations.
|
78
|
+
config.active_record.dump_schema_after_migration = false
|
79
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static file server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_files = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Randomize the order test cases are executed.
|
35
|
+
config.active_support.test_order = :random
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr.
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Raises error for missing translations
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
42
|
+
end
|