material_raingular 0.0.2.4.999999999 → 0.0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/material_raingular/version.rb +1 -1
- data/lib/tasks/material_raingular.rake +13 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125a7e255ed4e92d524c6e6e0b53bac6d66fffaf
|
4
|
+
data.tar.gz: 699bf72e9ee0574492759883f917b6f193b04b97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d446c1e3b4eaff3dd36a496b00811efd454f43e7576592bbfedd0462558f755c4765ea371cd193b1196357989b19a7d89a90923a1f7e16d5998d99064679b0cc
|
7
|
+
data.tar.gz: 498591693acdcc0c493598fec41a64d403efd166569fec633833ac8cebd00ed4dfbc2a19fbe0d24065c9eb5aa37948c0e78573530b83b686c63f64017e55b8bc
|
@@ -7,19 +7,27 @@ namespace :material_raingular do
|
|
7
7
|
controllers = HashWithIndifferentAccess.new
|
8
8
|
Rails.application.routes.routes.each do |route|
|
9
9
|
unless route.constraints[:request_method].nil? || route.defaults[:controller].nil? || (route.app.constraints.present? rescue false)
|
10
|
-
|
11
|
-
controllers[
|
12
|
-
controllers[
|
10
|
+
controller = route.defaults[:controller]
|
11
|
+
controllers[controller] ||= {}
|
12
|
+
controllers[controller][:parent_model_name_and_format_symbol] ||= []
|
13
|
+
controllers[controller][:parent_model_name_and_format_symbol] |= route.parts
|
13
14
|
(route.parts - [:id, :format]).each do |parent|
|
14
15
|
action = route.defaults[:action].to_sym
|
15
16
|
method = [:index, :show].include?(action) ? '' : "#{action}_"
|
16
|
-
method +=
|
17
|
+
method += controller.send(action == :index ? :pluralize : :singularize).gsub(/[^0-9A-Za-z]/, '_')
|
17
18
|
controllers[parent[0..-4].pluralize] ||= {}
|
18
19
|
controllers[parent[0..-4].pluralize][:parent_model_name_and_format_symbol] ||= []
|
19
20
|
controllers[parent[0..-4].pluralize][:parent_model_name_and_format_symbol] |= route.parts
|
21
|
+
controllers[parent[0..-4].pluralize][method] ||= {}
|
20
22
|
controllers[parent[0..-4].pluralize][method] = {url: route.path.spec.to_s.gsub('(.:format)',''), method: route.constraints[:request_method].inspect.delete('/^$')}
|
21
23
|
end
|
22
|
-
|
24
|
+
action = route.defaults[:action].gsub(/[^0-9A-Za-z]/, '_')
|
25
|
+
controllers[controller][action] ||= {}
|
26
|
+
current_url = controllers[controller][action][:url]
|
27
|
+
proposed_url = route.path.spec.to_s.gsub('(.:format)','')
|
28
|
+
if current_url.nil? || (current_url.to_s.length > proposed_url.length)
|
29
|
+
controllers[controller][action] = {url: proposed_url, method: route.constraints[:request_method].inspect.delete('/^$')}
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
controllers.each do |controller,routes|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: material_raingular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2.
|
4
|
+
version: 0.0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|