can_can_dry 0.5.5 → 0.5.6

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
  SHA256:
3
- metadata.gz: e3123c56acacc6e01dbe6c3cd4ce831347ccac334cceeb6eafe9610fd78face1
4
- data.tar.gz: 33e2403585776da110ed6b7fbe6963b52ee7f6e3d5c4a065ceb5783e885a539a
3
+ metadata.gz: 8862115914dca56a65d42050c0af7feec70958bcea882e5d99f25efb7c99429f
4
+ data.tar.gz: 8f5858f9368e5f41ceede0fc6585443752310f649cd06a8b4daa408e9289c6dd
5
5
  SHA512:
6
- metadata.gz: 577c3b16894fc8608551cad7c9313a19b06c2ae950cd408daa8bf5e2c2cb67625a6c14c1d7af39a8ce67c68de512ff73641dfbf52ddb10acf4d5bf0432ac5825
7
- data.tar.gz: a2bb9597dae8b3eebd62f52fd096301491a40655c740f12c86f4f9d533e778fa3448f47d36eb98244f14b3ff0c824cc762594164ec60e8480c608cc1e840f9b1
6
+ metadata.gz: 1a16c1d38b43cf27fb4c638992c50a5190d2f611de64421e85b37c3e0ed74ea52bcd51c7e3c6eb5d5f2190355d237f08e103c8fe7682654451bf66dbedf13653
7
+ data.tar.gz: bbbdf3abcadd8bf9d80e3a39a8233dc130e802c636b43b3df92fe44ab2e38eb2873eab945ee4a891d39f6b5531fcc337d88ef1c922e1cb164e0e936187500063
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CanCanDryHelper
4
4
  def ability_mapping
5
- @ability_mapping ||= ::AbilityMapping.new # rubocop:disable Rails/HelperInstanceVariable
5
+ @ability_mapping ||= ::AbilityMapping.new
6
6
  end
7
7
 
8
8
  def can_by_path?(path, method = :get)
@@ -5,7 +5,7 @@ module CanCanDry
5
5
  class ActionMappingNotFound < RuntimeError
6
6
  def initialize(controller, action)
7
7
  super('Nenhum mapeamento de controle de acesso encontrado ' \
8
- "para a action \"#{controller}##{action}\"")
8
+ "para a action \"#{controller}##{action}\"")
9
9
  end
10
10
  end
11
11
  end
@@ -98,11 +98,11 @@ module CanCanDry
98
98
  private
99
99
 
100
100
  def find_by_action
101
- return mapping[controller][action] if mapping[controller][action]
101
+ mapping[controller][action]
102
102
  end
103
103
 
104
104
  def find_by_all_action
105
- return mapping[controller][ALL_ACTION] if mapping[controller][ALL_ACTION]
105
+ mapping[controller][ALL_ACTION]
106
106
  end
107
107
 
108
108
  def mapping_has_controller?
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module CanCanDry
6
+ module AbilityMappingSets
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'cancancan'
4
+ require 'eac_rails_utils/engine'
5
+
3
6
  module CanCanDry
4
- class Engine < ::Rails::Engine; end
7
+ class Engine < ::Rails::Engine
8
+ include ::EacRailsUtils::EngineHelper
9
+ end
5
10
  end
@@ -52,7 +52,7 @@ module CanCanDry
52
52
  begin
53
53
  return engine.instance.routes.recognize_path(engine_path, options)
54
54
  rescue ActionController::RoutingError => e
55
- Rails.logger.debug "[#{engine}] ActionController::RoutingError: #{e.message}"
55
+ Rails.logger.debug { "[#{engine}] ActionController::RoutingError: #{e.message}" }
56
56
  end
57
57
  nil
58
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CanCanDry
4
- VERSION = '0.5.5'
4
+ VERSION = '0.5.6'
5
5
  end
data/lib/can_can_dry.rb CHANGED
@@ -1,18 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/dependencies'
4
3
  require 'cancancan'
4
+ require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module CanCanDry
7
- require 'can_can_dry/railtie'
8
- require_dependency 'can_can_dry/controller_authorization'
9
- require_dependency 'can_can_dry/ability_mapping_sets/active_scaffold'
10
- require_dependency 'can_can_dry/ability_mapping_sets/devise'
11
- require_dependency 'can_can_dry/ability_mapping_sets/devise_invitable'
12
- require_dependency 'can_can_dry/ability_mapping'
13
- require_dependency 'can_can_dry/ability_mapping/path_mapping_not_found'
14
- require_dependency 'can_can_dry/ability_mapping/action_mapping_not_found'
15
- require_dependency 'can_can_dry/engine'
16
- require_dependency 'can_can_dry/no_controller_can_can_additions'
17
- require_dependency 'can_can_dry/path_recognizer'
7
+ require_sub __FILE__
18
8
  end
@@ -13,8 +13,7 @@ namespace :can_can_dry do
13
13
 
14
14
  desc 'Inform the path and receive the controller/action.'
15
15
  task :path_recognize, [:path] => :environment do |_t, args|
16
- Aranha::AddressesController.new
17
- r = ::CanCanDry::PathRecognizer.recognize('', args.path)
16
+ r = CanCanDry::PathRecognizer.recognize('', args.path)
18
17
  Rails.logger.info("Result: #{r}")
19
18
  end
20
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: can_can_dry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2024-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -16,68 +16,68 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.4'
19
+ version: '3.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.4'
26
+ version: '3.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: eac_ruby_utils
28
+ name: eac_rails_utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.95'
34
- - - ">="
33
+ version: '0.22'
34
+ - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: 0.95.1
36
+ version: 0.22.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0.95'
44
- - - ">="
43
+ version: '0.22'
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.95.1
46
+ version: 0.22.3
47
47
  - !ruby/object:Gem::Dependency
48
- name: rails
48
+ name: eac_ruby_utils
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 4.2.1
53
+ version: '0.121'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 4.2.1
60
+ version: '0.121'
61
61
  - !ruby/object:Gem::Dependency
62
- name: eac_ruby_gem_support
62
+ name: eac_rails_gem_support
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.4'
67
+ version: '0.9'
68
68
  - - ">="
69
69
  - !ruby/object:Gem::Version
70
- version: 0.4.1
70
+ version: 0.9.2
71
71
  type: :development
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: '0.4'
77
+ version: '0.9'
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: 0.4.1
80
+ version: 0.9.2
81
81
  description:
82
82
  email:
83
83
  executables: []
@@ -89,6 +89,7 @@ files:
89
89
  - lib/can_can_dry/ability_mapping.rb
90
90
  - lib/can_can_dry/ability_mapping/action_mapping_not_found.rb
91
91
  - lib/can_can_dry/ability_mapping/path_mapping_not_found.rb
92
+ - lib/can_can_dry/ability_mapping_sets.rb
92
93
  - lib/can_can_dry/ability_mapping_sets/active_scaffold.rb
93
94
  - lib/can_can_dry/ability_mapping_sets/devise.rb
94
95
  - lib/can_can_dry/ability_mapping_sets/devise_invitable.rb
@@ -96,12 +97,8 @@ files:
96
97
  - lib/can_can_dry/engine.rb
97
98
  - lib/can_can_dry/no_controller_can_can_additions.rb
98
99
  - lib/can_can_dry/path_recognizer.rb
99
- - lib/can_can_dry/railtie.rb
100
100
  - lib/can_can_dry/version.rb
101
101
  - lib/tasks/can_can_dry.rake
102
- - spec/lib/can_can_dry/path_recognizer_spec.rb
103
- - spec/lib/rubocop_check_spec.rb
104
- - spec/spec_helper.rb
105
102
  homepage: https://github.com/esquilo-azul/can_can_dry
106
103
  licenses: []
107
104
  metadata:
@@ -114,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
111
  requirements:
115
112
  - - ">="
116
113
  - !ruby/object:Gem::Version
117
- version: '0'
114
+ version: '2.7'
118
115
  required_rubygems_version: !ruby/object:Gem::Requirement
119
116
  requirements:
120
117
  - - ">="
@@ -125,7 +122,4 @@ rubygems_version: 3.1.6
125
122
  signing_key:
126
123
  specification_version: 4
127
124
  summary: DRY authorization with CanCanCan.
128
- test_files:
129
- - spec/lib/can_can_dry/path_recognizer_spec.rb
130
- - spec/lib/rubocop_check_spec.rb
131
- - spec/spec_helper.rb
125
+ test_files: []
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CanCanDry
4
- require 'rails'
5
-
6
- class Railtie < Rails::Railtie
7
- rake_tasks { load 'tasks/can_can_dry.rake' }
8
- end
9
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'can_can_dry/path_recognizer'
4
-
5
- RSpec.describe ::CanCanDry::PathRecognizer do
6
- describe '#remove_root_path' do
7
- [%w[/path/to/action /prefix/ /prefix/path/to/action],
8
- %w[/path/to/action /prefix /prefix/path/to/action],
9
- %w[/path / /path],
10
- ['/path', '', '/path'],
11
- %w[/unknown/path /abc /unknown/path]].each do |s|
12
- it do
13
- expect(described_class.send(:remove_root_path, s[1], s[2])).to eq(s[0])
14
- end
15
- end
16
- end
17
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
data/spec/spec_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))