material_raingular 0.0.2.4.2.alpha → 0.0.2.4.3.alpha
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 +9 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c00fe908fd5599cbb94d5a615cecf762997f11b
|
4
|
+
data.tar.gz: bbf7f5b6db821da870c9566f1a77647e606e0951
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc3c44681058d634557db4ca8a2f390fddd76494fbf9dac8df657e924853f4812917e878254b0a7cc3748ec284ae70a26e9d8b86d65589e854d7c643305f59a
|
7
|
+
data.tar.gz: 3aaa3778b43d634ebdf88569fa47eb1606a5ade7536b17162d227bd5eb4b6b80a2292f9a5a35f7737eb7fadf85feba318961862f22900864bcc71a5157077d15
|
@@ -3,15 +3,21 @@ namespace :material_raingular do
|
|
3
3
|
task factories: :environment do
|
4
4
|
variances = Rails.application.config.raingular_variances rescue {}
|
5
5
|
puts "Rewriting angular factories:"
|
6
|
-
controllers = HashWithIndifferentAccess.new
|
7
6
|
factories = "angular.factories = angular.module('Factories', [])\n"
|
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
10
|
controllers[route.defaults[:controller]] ||= {}
|
11
11
|
controllers[route.defaults[:controller]][:parent_model_name_and_format_symbol] ||= []
|
12
12
|
controllers[route.defaults[:controller]][:parent_model_name_and_format_symbol] |= route.parts
|
13
|
-
|
14
|
-
|
13
|
+
(route.parts - [:id, :format]).each do |parent|
|
14
|
+
action = route.defaults[:action].to_sym
|
15
|
+
method = [:index, :show].include?(action) ? '' : "#{action}_"
|
16
|
+
method += route.defaults[:controller].send(action == :index ? :pluralize : :singularize)
|
17
|
+
controllers[parent[0..-4].pluralize] ||= {}
|
18
|
+
controllers[parent[0..-4].pluralize][method] = {url: route.path.spec.to_s.gsub('(.:format)',''), method: route.constraints[:request_method].inspect.delete('/^$')}
|
19
|
+
end
|
20
|
+
controllers[route.defaults[:controller]][route.defaults[:action]] = {url: route.path.spec.to_s.gsub('(.:format)',''), method: route.constraints[:request_method].inspect.delete('/^$')}
|
15
21
|
end
|
16
22
|
end
|
17
23
|
controllers.each do |controller,routes|
|