route_downcaser 1.2.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +4 -4
- data/Rakefile +17 -19
- data/lib/route_downcaser/configuration.rb +19 -16
- data/lib/route_downcaser/downcase_route_middleware.rb +29 -29
- data/lib/route_downcaser/railtie.rb +2 -0
- data/lib/route_downcaser/version.rb +3 -1
- data/lib/route_downcaser.rb +6 -4
- data/lib/tasks/route_downcaser_tasks.rake +1 -0
- metadata +24 -245
- data/lib/route_downcaser/original_downcase_route_middleware.rb +0 -83
- data/test/integration/route_middleware_test.rb +0 -55
- data/test/rails421/Rakefile +0 -6
- data/test/rails421/app/assets/javascripts/application.js +0 -5
- data/test/rails421/app/assets/stylesheets/application.css +0 -15
- data/test/rails421/app/controllers/application_controller.rb +0 -5
- data/test/rails421/app/controllers/hello_controller.rb +0 -5
- data/test/rails421/app/helpers/application_helper.rb +0 -2
- data/test/rails421/app/views/layouts/application.html.erb +0 -14
- data/test/rails421/bin/bundle +0 -3
- data/test/rails421/bin/rails +0 -8
- data/test/rails421/bin/rake +0 -8
- data/test/rails421/bin/setup +0 -29
- data/test/rails421/bin/spring +0 -15
- data/test/rails421/config/application.rb +0 -29
- data/test/rails421/config/boot.rb +0 -3
- data/test/rails421/config/environment.rb +0 -5
- data/test/rails421/config/environments/development.rb +0 -41
- data/test/rails421/config/environments/production.rb +0 -79
- data/test/rails421/config/environments/test.rb +0 -42
- data/test/rails421/config/initializers/assets.rb +0 -11
- data/test/rails421/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails421/config/initializers/cookies_serializer.rb +0 -3
- data/test/rails421/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/rails421/config/initializers/inflections.rb +0 -16
- data/test/rails421/config/initializers/mime_types.rb +0 -4
- data/test/rails421/config/initializers/session_store.rb +0 -3
- data/test/rails421/config/initializers/wrap_parameters.rb +0 -14
- data/test/rails421/config/locales/en.yml +0 -23
- data/test/rails421/config/routes.rb +0 -59
- data/test/rails421/config/secrets.yml +0 -22
- data/test/rails421/config.ru +0 -4
- data/test/rails421/log/test.log +0 -1048
- data/test/rails421/public/404.html +0 -67
- data/test/rails421/public/422.html +0 -67
- data/test/rails421/public/500.html +0 -66
- data/test/rails421/public/favicon.ico +0 -0
- data/test/rails421/public/robots.txt +0 -5
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/-B/-Bgmyr63R89_vIyXN9mCNapfDXapBpDRck9XmKhL5CA.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/-W/-WQ3FNnhW7tLBOxo4aGnRb2Fve0zgOnoMYj6wqTNkbM.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/0E/0EDP1-KVZYBKHTAmflqiPVViMAVEG0SC-kK_5oEVZn0.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/0g/0gWM2CTzhg2x8y4_UP-Py0W4B9A-zr06u8OBmue8X1k.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/3K/3KLS9RO9SD43w2m7B37olZz-VRlZVFl3F98EcZ-T6OQ.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/3O/3OqO1F9b_ZzzrtlAoCMgvevQgZnwcUOgeLR8rv3IEic.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/4r/4rAedh6S2USq6-0-HuB_CCVHHLcpx52AIjXhD_2ZBGg.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/5C/5CT_8kIrhxIJ83JBc79GdAhqzTv5yYzmjQTu_6ALk50.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/5J/5Jhq8lUXayqrSHgYM1Q5MHGn-TiHuMjRmK_XV4M3UyI.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/5t/5tiqCRpLfxs-Y6ybOzuDwipvuUFossP-XvncvDt1beA.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/6H/6H_SytVX3LrLQVNblKfSUZm9U4zz0Hi3nC7zd2slWgE.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/7a/7aucnxDrWU2Wq9Gv2-MzRJ-TODqCU9XYtPF9yUAxzrA.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/7j/7jspo8CcT9uFS4H8PqxscgE3AlgXB7pTQyQIhMJPVg0.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/8b/8bGxiI7b1E3sXm_6Main4IVaCaNunTCJECvMivc6vao.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/91/91xRePltaCv1RzwqjVg8J1eDPpMSQzAP2xE0NfHN790.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Ag/AgHzzOWYl7FCzWVoy3hK75zrV0K8Fb-_06edGSVp2Ow.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Cf/CflQs9dwKZXgCIWoyonGUgbz8uPXLgmyP_FlcJScD7o.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Cg/CgOhJxWpn75PUgDhTSfe1qt0yvhVyPToVq13nv5zuZQ.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/EL/EL7MuqbmZFKYS_80bdvW6_Wn5UEiX3eu1r6N-7G8UEw.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/FV/FV8nUPacNnUiza7kOCqckUSyEGBdphbSPSuZtJUy8tE.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/GP/GPlQQXNQ-w_dTZRfo4-FYNUzSGE1cEKrXjS7crmzVG0.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Ig/Igg0gxUZFtM3hQ7W6dbvFXdZpIbV6tOiVPR2vEmQYXI.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Jf/JfAkIfafqJLEVZeAwe3NPmILKAxLTIaQMkBDQv9lgRs.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Jg/Jgz4YtR2FGBSwxB6thNOJDk7klfksp2yQy2XkBjht4g.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Ki/KiL7BwSVbz_z5w4y93R2R4LCkyj0b19GujTz6XIiarY.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/LU/LUAozPg7QdzK21QBqXW25-a5gN_7zLRAqQSupvkblSg.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Ln/LnFnKRPLxutlTQ7fOvRsapfgXEw5btGpLwFPbpRzRlM.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Ls/LsZJopR7cTyB7JsVfz5aSomahT3jHGL6Pa2CICmFoQg.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/PK/PKl6w1pmCXwfusuCnKunu1GYOTLNPwF7_K8p3ytcTgg.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Pi/PitG24Ap6XHTl1N62RP6JfNqaWJFxaUoe59hR-YXKPE.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Pm/PmYoMk9-uw3hPLN-bvhDGLKg6cTarLI8BYk3DhheO1k.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/SP/SPGmSZC6qS--XzWg1MdmEEgH6dRyXOgJMe2P9QBYQZY.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/V4/V440s0_NvNOTLoVbZrUe2eeHjF7uUg4OPlf9swcXXDA.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/WS/WSBIVButxIEVKNZe-7Nc4vJqenDzrMKArSNbIy7H8Cs.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/Xg/Xg64R_L39P2xqnexdmGDRYDzSTX8azFSAWBFOy2B5lU.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/YY/YYg4F7MwALcoY2sRAE6hl0-2rtVq5V-9JixAGfbxLF0.cache +0 -2
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/ZU/ZUn7d2k8KPMHyjjf6lnKTGwGfn2BO-IdyYXQ8wfkVIM.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/_n/_nYxMUNBMU9KjdTucuCyGutY4g7x8eJjbF9NwXdn1po.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/aW/aWW6yUInnVq44DuXVWtVU0Uu6MVqbDk_31S2NWl7K74.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/ap/aprbFEg82SGajctPy-pfnM30hK8PtEZrmsgk9pgRHRk.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/cy/cy6FSlBMXEvsU2hDor-RFfO7au2LngZ3WqI2vqa1r8U.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/du/duFUmZ4ysy7RyIkeiWtvwe6BtTfBJhNMuO2oRfkfoVo.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/ed/edkFBPusn0eAqYUpbC3hk4dVs45tYZg3w4p50PKPokk.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/fC/fCrT0zlSV767KPzO87GqdHMO_QsiEr19LLDZb0XFHfc.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/g3/g3DI9kbhIoXd-w_hDm4y5teEzaSmtyBGpP1zd-JWcek.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/g6/g6fovXx3tOX2i7BAnBDxcViTe4leaTm9Kkrfdl8wMQA.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/go/gorAkyJ6oqUlHs8L907X6eA5ORKpX19iQIIz85e1Om4.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/hD/hDxUuofMAs4S7GXborJiutJawcnl4o2LNudaxNbN4ec.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/hQ/hQj6p2AFknE_MgYgHnwoPOe91PEUgpn6Z_FiuyaJ82k.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/hw/hwHQHMDHwgnbAp8O9R8o4Q5POdU6sxLG89slbhtkmEk.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/iH/iH1r3bm_cqwvpfoFfd5cI3E2iqgJtmIed8lCZKieHx8.cache +0 -2
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/is/isbz3mXXlcEL2HMerIcSsLWpTN3D4lHiK2HOygFzss8.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/iw/iwUWP-Z82gbzpNgNohj70sxyUtc3xNWla6RKzVYItxg.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/j9/j9dS7uGziRYgnlks5CDCYPt1e_REM0RIz9UpIgMKgdg.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/jY/jYVt_HA9ZEkn6SDsjj7OSswwgRzN39gj7oCIcNhw6G4.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/jh/jh8Rd8uXzJsR5P4NG39_-VpLgRemhQ8CxX5_dw6lT8Y.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/kU/kUhgMRj0dXypOCVx0_3_wrOtw53hBixKcGLLqSxuw6w.cache +0 -3
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/ni/niGBqsssmceju94eXn6eko8N-B_Wd_TfuVca3esL0PA.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/oB/oBw4u1I-YHiDLfqGBonN5VMbTkmFJCA2IZIWABuZCZY.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/oN/oNYh-Q08FfdNyVFqXISNg8_l67G5FeBHokHp5greQLo.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/p0/p00KopyzwCidTtAuB76KK2QxTXFwOLwu-Ur8rkyHV1Q.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/pR/pRAbQ3DoSMCVan9vdc4o6gLmg2MfGWD_yjv6SwBjomc.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/pS/pSRyIy0fylBzoBIXuPbSt6NPfrO26fTTJ91cnBiYV5c.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/qy/qy5ffSUvVTPRKpXNBphBzko8sGj8Ce4dDXBu8rCvA_k.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/rj/rj9TDm5Ag9No-NQsnf_1jVYYLtMtHzwzJz0DBSS0JA0.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/sk/skD9Azvu31NegSi2oQtxsOd9ghnyKi7-4FHq4WwvWtE.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/sn/SnvXlg8cBOz55_kauZGh-V4IC5Zauq8JVhOlzJ02iSU.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/sn/snbk_vUdpRIi6RfNIaIjl1NOO3pWiCe6KFWZ30k1XL8.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/tn/tnnlCZmqi-M2TWOY6xMLnGBbKqxvkwkMHVJ8kHRBmik.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/u1/u1WQc8AMAiOmt_v_5_2yi3XbEaUf9yC4itiSk53jRGg.cache +0 -0
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/uH/uH1B6_PPjBQ_4l8KBo3b9ewINago1_K8JKjG1w0YKH4.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/v5/v56pz21chnsTcHF9GlXTNEdYxkn5O1M9WyIVgb17pzo.cache +0 -2
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/vS/vSW7CsUHjw-gbleWbQODWkGxCP7xL776KWz12vIsn5U.cache +0 -2
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/vm/vm9hQSEhxR6wE0cFbLeqVjYZax2SwNkord1DCAzA2xg.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/wi/wiOYNLAxWSE-RcUp0e8yyvwlXcrlSD3c8Hf_9mLum00.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/xu/xuHg3Ok3I6Ioa8MvbTYwIrYE_ECmwnU6iG9oIqi9Kw0.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/y3/y397xgx0zBU7JiqxnZxg555Z1CcnrG1svhgwJvZA6Fs.cache +0 -1
- data/test/rails421/tmp/cache/assets/sprockets/v3.0/y5/y5VE9EjY2KAk8NIkbwOZzYod3U0KM5Q5ZqJ_J0CmJIs.cache +0 -0
- data/test/route_downcaser_test.rb +0 -195
- data/test/test_helper.rb +0 -19
@@ -1,83 +0,0 @@
|
|
1
|
-
module RouteDowncaser
|
2
|
-
class OriginalDowncaseRouteMiddleware
|
3
|
-
def initialize(app)
|
4
|
-
@app = app
|
5
|
-
end
|
6
|
-
|
7
|
-
def call(env)
|
8
|
-
dup._call(env)
|
9
|
-
end
|
10
|
-
|
11
|
-
def _call(env)
|
12
|
-
request_uri = env['REQUEST_URI']
|
13
|
-
path_info = env['PATH_INFO']
|
14
|
-
|
15
|
-
# Don't touch anything, if uri/path is part of exclude_patterns
|
16
|
-
return @app.call(env) if excluded?([request_uri, path_info])
|
17
|
-
|
18
|
-
# Downcase request_uri and/or path_info if applicable
|
19
|
-
request_uri = downcased_uri(request_uri)
|
20
|
-
path_info = downcased_uri(path_info)
|
21
|
-
|
22
|
-
# If redirect configured, then return redirect request,
|
23
|
-
# if either request_uri or path_info has changed
|
24
|
-
if RouteDowncaser.redirect && env['REQUEST_METHOD'] == 'GET'
|
25
|
-
if request_uri.present? && request_uri != env['REQUEST_URI']
|
26
|
-
return redirect_header(request_uri)
|
27
|
-
end
|
28
|
-
|
29
|
-
if path_info.present? && path_info != env['PATH_INFO']
|
30
|
-
return redirect_header(path_info)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
env['PATH_INFO'] = path_info.to_s if path_info
|
35
|
-
env['REQUEST_URI'] = request_uri.to_s if request_uri
|
36
|
-
|
37
|
-
# Default just move to next chain in Rack callstack
|
38
|
-
# calling with downcased uri if needed
|
39
|
-
@app.call(env)
|
40
|
-
end
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def exclude_patterns_match?(uri)
|
45
|
-
uri.match(Regexp.union(RouteDowncaser.exclude_patterns)) if uri && RouteDowncaser.exclude_patterns
|
46
|
-
end
|
47
|
-
|
48
|
-
def excluded?(paths)
|
49
|
-
paths.any? do |path|
|
50
|
-
exclude_patterns_match?(path)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def downcased_uri(uri)
|
55
|
-
return nil unless uri.present?
|
56
|
-
if has_querystring?(uri)
|
57
|
-
"#{path(uri).mb_chars.downcase}?#{querystring(uri)}"
|
58
|
-
else
|
59
|
-
path(uri).mb_chars.downcase
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def path(uri)
|
64
|
-
uri_items(uri).first
|
65
|
-
end
|
66
|
-
|
67
|
-
def querystring(uri)
|
68
|
-
uri_items(uri).last
|
69
|
-
end
|
70
|
-
|
71
|
-
def has_querystring?(uri)
|
72
|
-
uri_items(uri).length > 1
|
73
|
-
end
|
74
|
-
|
75
|
-
def uri_items(uri)
|
76
|
-
uri.split('?')
|
77
|
-
end
|
78
|
-
|
79
|
-
def redirect_header(uri)
|
80
|
-
[301, { 'Location' => uri, 'Content-Type' => 'text/html' }, []]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class RouteMiddlewareTest < ActionDispatch::IntegrationTest
|
4
|
-
test "Middleware is installed and working" do
|
5
|
-
RouteDowncaser.configuration do |config|
|
6
|
-
config.redirect = false
|
7
|
-
end
|
8
|
-
|
9
|
-
get "/HELLO/WORLD"
|
10
|
-
assert_response :success
|
11
|
-
assert_equal("anybody out there?", @response.body)
|
12
|
-
end
|
13
|
-
|
14
|
-
test "Assets are served correctly" do
|
15
|
-
RouteDowncaser.configuration do |config|
|
16
|
-
config.redirect = false
|
17
|
-
end
|
18
|
-
|
19
|
-
get "/assets/application.js"
|
20
|
-
assert_response :success
|
21
|
-
assert(@response.body.include?("fancy manifest file"))
|
22
|
-
end
|
23
|
-
|
24
|
-
test "Redirect instead of rewrite" do
|
25
|
-
RouteDowncaser.configuration do |config|
|
26
|
-
config.redirect = true
|
27
|
-
end
|
28
|
-
|
29
|
-
get "/HELLO/WORLD"
|
30
|
-
assert_equal 301, response.status
|
31
|
-
assert_equal "/hello/world", response.location
|
32
|
-
end
|
33
|
-
|
34
|
-
test "Only GET requests should be redirected, POST should rewrite" do
|
35
|
-
RouteDowncaser.configuration do |config|
|
36
|
-
config.redirect = true
|
37
|
-
end
|
38
|
-
|
39
|
-
post "/HELLO/WORLD"
|
40
|
-
assert_response :success
|
41
|
-
assert_equal("anybody out there?", @response.body)
|
42
|
-
end
|
43
|
-
|
44
|
-
test 'Input and output env are the same' do
|
45
|
-
class App
|
46
|
-
def call(env) env; end
|
47
|
-
end
|
48
|
-
|
49
|
-
middleware = RouteDowncaser::DowncaseRouteMiddleware.new(App.new)
|
50
|
-
|
51
|
-
env = {}
|
52
|
-
new_env = middleware.call env
|
53
|
-
assert(new_env.equal? env)
|
54
|
-
end
|
55
|
-
end
|
data/test/rails421/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Rails421</title>
|
5
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
data/test/rails421/bin/bundle
DELETED
data/test/rails421/bin/rails
DELETED
data/test/rails421/bin/rake
DELETED
data/test/rails421/bin/setup
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
-
|
7
|
-
Dir.chdir APP_ROOT do
|
8
|
-
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file:
|
10
|
-
|
11
|
-
puts "== Installing dependencies =="
|
12
|
-
system "gem install bundler --conservative"
|
13
|
-
system "bundle check || bundle install"
|
14
|
-
|
15
|
-
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?("config/database.yml")
|
17
|
-
# system "cp config/database.yml.sample config/database.yml"
|
18
|
-
# end
|
19
|
-
|
20
|
-
puts "\n== Preparing database =="
|
21
|
-
system "bin/rake db:setup"
|
22
|
-
|
23
|
-
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system "rm -f log/*"
|
25
|
-
system "rm -rf tmp/cache"
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system "touch tmp/restart.txt"
|
29
|
-
end
|
data/test/rails421/bin/spring
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# This file loads spring without using Bundler, in order to be fast.
|
4
|
-
# It gets overwritten when you run the `spring binstub` command.
|
5
|
-
|
6
|
-
unless defined?(Spring)
|
7
|
-
require "rubygems"
|
8
|
-
require "bundler"
|
9
|
-
|
10
|
-
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
|
11
|
-
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
|
12
|
-
gem "spring", match[1]
|
13
|
-
require "spring/binstub"
|
14
|
-
end
|
15
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
#require 'rails/all'
|
4
|
-
require "action_controller/railtie"
|
5
|
-
require "action_mailer/railtie"
|
6
|
-
require "sprockets/railtie"
|
7
|
-
require "rails/test_unit/railtie"
|
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 Rails421
|
13
|
-
class Application < Rails::Application
|
14
|
-
# Settings in config/environments/* take precedence over those specified here.
|
15
|
-
# Application configuration should go into files in config/initializers
|
16
|
-
# -- all .rb files in that directory are automatically loaded.
|
17
|
-
|
18
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
19
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
20
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
21
|
-
|
22
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
23
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
24
|
-
# config.i18n.default_locale = :de
|
25
|
-
|
26
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
27
|
-
#config.active_record.raise_in_transactional_callbacks = true
|
28
|
-
end
|
29
|
-
end
|
@@ -1,41 +0,0 @@
|
|
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
|
@@ -1,79 +0,0 @@
|
|
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
|
@@ -1,42 +0,0 @@
|
|
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
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = '1.0'
|
5
|
-
|
6
|
-
# Add additional assets to the asset load path
|
7
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
-
|
9
|
-
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
-
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format. Inflections
|
4
|
-
# are locale specific, and you may define rules for as many different
|
5
|
-
# locales as you wish. All of these examples are active by default:
|
6
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
-
# inflect.singular /^(ox)en/i, '\1'
|
9
|
-
# inflect.irregular 'person', 'people'
|
10
|
-
# inflect.uncountable %w( fish sheep )
|
11
|
-
# end
|
12
|
-
|
13
|
-
# These inflection rules are supported but not enabled by default:
|
14
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
-
# inflect.acronym 'RESTful'
|
16
|
-
# end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
en:
|
23
|
-
hello: "Hello world"
|
@@ -1,59 +0,0 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
get "hello/world"
|
3
|
-
post "hello/world"
|
4
|
-
|
5
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
6
|
-
# See how all your routes lay out with "rake routes".
|
7
|
-
|
8
|
-
# You can have the root of your site routed with "root"
|
9
|
-
# root 'welcome#index'
|
10
|
-
|
11
|
-
# Example of regular route:
|
12
|
-
# get 'products/:id' => 'catalog#view'
|
13
|
-
|
14
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
15
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
16
|
-
|
17
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
18
|
-
# resources :products
|
19
|
-
|
20
|
-
# Example resource route with options:
|
21
|
-
# resources :products do
|
22
|
-
# member do
|
23
|
-
# get 'short'
|
24
|
-
# post 'toggle'
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# collection do
|
28
|
-
# get 'sold'
|
29
|
-
# end
|
30
|
-
# end
|
31
|
-
|
32
|
-
# Example resource route with sub-resources:
|
33
|
-
# resources :products do
|
34
|
-
# resources :comments, :sales
|
35
|
-
# resource :seller
|
36
|
-
# end
|
37
|
-
|
38
|
-
# Example resource route with more complex sub-resources:
|
39
|
-
# resources :products do
|
40
|
-
# resources :comments
|
41
|
-
# resources :sales do
|
42
|
-
# get 'recent', on: :collection
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
|
46
|
-
# Example resource route with concerns:
|
47
|
-
# concern :toggleable do
|
48
|
-
# post 'toggle'
|
49
|
-
# end
|
50
|
-
# resources :posts, concerns: :toggleable
|
51
|
-
# resources :photos, concerns: :toggleable
|
52
|
-
|
53
|
-
# Example resource route within a namespace:
|
54
|
-
# namespace :admin do
|
55
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
56
|
-
# # (app/controllers/admin/products_controller.rb)
|
57
|
-
# resources :products
|
58
|
-
# end
|
59
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: 073e6e992d19b0dbd4b81b262b055f96275afb361065c6a7279d651730e7bc36640e4d5b3d2cac5a02139d15c72018a14fe8cef742c179bf08f8864cf6ab6061
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: 3a18e688b4eccc227fd8beb8bdc63f3d07417ddf635089cb498ce6617348714a0e7b25fbf153ceac70bb04423489f37f43257e36ce826ec005e2f476e0e25824
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|