rails-dev-tweaks 0.6.0.preview.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -3,7 +3,7 @@ A collection of tweaks to improve your Rails (3.1+) development experience.
|
|
3
3
|
|
4
4
|
To install, simply add it to your gemfile:
|
5
5
|
|
6
|
-
gem 'rails-dev-tweaks', '~> 0.6.0
|
6
|
+
gem 'rails-dev-tweaks', '~> 0.6.0'
|
7
7
|
|
8
8
|
At the moment, the current tweaks center around speeding up requests by giving granular control over which requests
|
9
9
|
cause the Rails reloader to kick in.
|
@@ -1,17 +1,36 @@
|
|
1
1
|
class RailsDevTweaks::GranularAutoload::Matchers::AssetMatcher
|
2
2
|
|
3
3
|
def call(request)
|
4
|
-
|
4
|
+
route_engine = request.headers['action_dispatch.routes']
|
5
|
+
|
6
|
+
if route_engine.respond_to?(:router)
|
7
|
+
mounted_app = journey_find_app(route_engine.router, request)
|
8
|
+
else
|
9
|
+
mounted_app = rack_find_app(route_engine.set.dup, request)
|
10
|
+
end
|
11
|
+
|
12
|
+
# What do we have?
|
13
|
+
mounted_app.is_a? Sprockets::Base
|
14
|
+
end
|
15
|
+
|
16
|
+
def journey_find_app(router, request)
|
17
|
+
router.recognize(request) do |route|
|
18
|
+
return route.app
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def rack_find_app(router, request)
|
23
|
+
main_mount = router.recognize(request)
|
5
24
|
|
6
25
|
# Unwind until we have an actual app
|
7
26
|
while main_mount != nil
|
8
|
-
if main_mount.
|
27
|
+
if main_mount.is_a? Array
|
9
28
|
main_mount = main_mount.first
|
10
29
|
|
11
|
-
elsif main_mount.
|
30
|
+
elsif main_mount.is_a? Rack::Mount::Route
|
12
31
|
main_mount = main_mount.app
|
13
32
|
|
14
|
-
elsif main_mount.
|
33
|
+
elsif main_mount.is_a? Rack::Mount::Prefix
|
15
34
|
# Bah, no accessor here
|
16
35
|
main_mount = main_mount.instance_variable_get(:@app)
|
17
36
|
|
@@ -21,8 +40,7 @@ class RailsDevTweaks::GranularAutoload::Matchers::AssetMatcher
|
|
21
40
|
end
|
22
41
|
end
|
23
42
|
|
24
|
-
|
25
|
-
main_mount.kind_of? Sprockets::Base
|
43
|
+
main_mount
|
26
44
|
end
|
27
45
|
|
28
46
|
end
|
metadata
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-dev-tweaks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Wavii, Inc.
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement: &
|
16
|
+
requirement: &70312544577820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.1
|
21
|
+
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70312544577820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: actionpack
|
27
|
-
requirement: &
|
27
|
+
requirement: &70312544576380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.1
|
32
|
+
version: '3.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70312544576380
|
36
36
|
description: A collection of tweaks to improve your Rails (3.1+) development experience.
|
37
37
|
email:
|
38
38
|
- info@wavii.com
|
@@ -65,15 +65,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- - ! '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
|
-
segments:
|
69
|
-
- 0
|
70
|
-
hash: 3262540460766667647
|
71
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
69
|
none: false
|
73
70
|
requirements:
|
74
|
-
- - ! '
|
71
|
+
- - ! '>='
|
75
72
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
73
|
+
version: '0'
|
77
74
|
requirements: []
|
78
75
|
rubyforge_project: rails-dev-tweaks
|
79
76
|
rubygems_version: 1.8.11
|