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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51452aeb2f968f78ee1d065681a84ab46b664c05
4
- data.tar.gz: 9eef038151f9d3d52a1cc29fac87e1e0a32e8916
3
+ metadata.gz: 7c00fe908fd5599cbb94d5a615cecf762997f11b
4
+ data.tar.gz: bbf7f5b6db821da870c9566f1a77647e606e0951
5
5
  SHA512:
6
- metadata.gz: a489cc0e49a5131e775dcb0ea828bd2fa335b2defb160ecfa676244bfabd21f43e0a16caf3831387752e14bcee4e2cddbd8bfa4cb84f6b627636fb6a17e2f65f
7
- data.tar.gz: 33e4987dce1cc7cb9cdc61086dd54d07606d51af1f20d02c6dea86b597f38f68f0173f6c4f62b0a9d7a5745749a7cba057a1e94b395d90fa0e13ba7f725d772f
6
+ metadata.gz: 4cc3c44681058d634557db4ca8a2f390fddd76494fbf9dac8df657e924853f4812917e878254b0a7cc3748ec284ae70a26e9d8b86d65589e854d7c643305f59a
7
+ data.tar.gz: 3aaa3778b43d634ebdf88569fa47eb1606a5ade7536b17162d227bd5eb4b6b80a2292f9a5a35f7737eb7fadf85feba318961862f22900864bcc71a5157077d15
@@ -1,3 +1,3 @@
1
1
  module MaterialRaingular
2
- VERSION = "0.0.2.4.2.alpha"
2
+ VERSION = "0.0.2.4.3.alpha"
3
3
  end
@@ -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
- action = (route.parts - [:id, :format]).present? ? "#{(route.parts - [:id, :format])[0][0..-4]}_#{route.defaults[:action]}" : route.defaults[:action]
14
- controllers[route.defaults[:controller]][action] = {url: route.path.spec.to_s.gsub('(.:format)',''), method: route.constraints[:request_method].inspect.delete('/^$')}
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|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_raingular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.4.2.alpha
4
+ version: 0.0.2.4.3.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Moody