metasploit-concern 4.0.5 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3be630fb8cb4600f2f037eaab42c0dfff18213332092215ce650b5f19ab016f0
4
- data.tar.gz: 7d85b09c76f6ef2c7cb4cba53f6cf6d923898ac58a78efb03373593e4d3142e5
3
+ metadata.gz: ff99cb753f6000ae296a36694acdde163312774daf920c0f4f4b87eb8b718ead
4
+ data.tar.gz: 5690e170ac10caf4acf543026ce066abde76c76b2aca5468a5766faac05cc27c
5
5
  SHA512:
6
- metadata.gz: bcb972c3cc42b0462bab6d1292db9615f1b14a6cd99d5639ab2adfcacf8fe32b2293528d77ea3cc2dcdd99be43f6f892ed3e63533251644bc9956d81f9be1444
7
- data.tar.gz: 22902a1e5afb1845932b35fb0fce799ff9c8a8f337d5c228a0f2cd3a31800e0b42a7c405f45cda70d4e0443691b8abdc19de65936507ea76ed9dff1994f1f74f
6
+ metadata.gz: 5d1a7bd44f83d327491e04548a1da814aefafd3d8ae01c52fabba2bcad60016e79feac2abb8d8b2cfa2b85884e34f1ab25105f0f73913247008322e6a829bad5
7
+ data.tar.gz: 9139fdc9619ed2db171bad235cc41499b92d4a06a63100dc0ab6148d95a99bc9eeed8e673333aa5733df0dfd8d649db61755c746bea84e037b467e44a899620d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -41,12 +41,16 @@ module Metasploit
41
41
  raise Metasploit::Concern::Error::SkipAutoload, engine
42
42
  end
43
43
 
44
- concerns_directories = concerns_path.existent_directories
44
+ ActiveSupport::Reloader.to_prepare do
45
+ # wrap engine configs changes in to_prepare to ensure they get recreated if classes are reloaded by zeitwerk
46
+ concerns_directories = concerns_path.existent_directories
45
47
 
46
- concerns_directories.each do |concerns_directory|
47
- concerns_pathname = Pathname.new(concerns_directory)
48
- loader = Metasploit::Concern::Loader.new(root: concerns_pathname)
49
- loader.register
48
+ concerns_directories.each do |concerns_directory|
49
+ concerns_pathname = Pathname.new(concerns_directory)
50
+
51
+ loader = Metasploit::Concern::Loader.new(root: concerns_pathname)
52
+ loader.register
53
+ end
50
54
  end
51
55
  end
52
56
  end
@@ -32,10 +32,9 @@ class Metasploit::Concern::Loader
32
32
  # @yieldparam constant [Module] constant declared under `parent_pathname`.
33
33
  # @yieldreturn [void]
34
34
  # @return [void]
35
- def each_pathname_constant(mechanism:, parent_pathname:)
35
+ def each_pathname_constant(parent_pathname:)
36
36
  parent_pathname.each_child do |child_pathname|
37
37
  constant = constantize_pathname(
38
- mechanism: mechanism,
39
38
  pathname: child_pathname
40
39
  )
41
40
 
@@ -87,14 +86,8 @@ class Metasploit::Concern::Loader
87
86
  loader = self
88
87
 
89
88
  ActiveSupport.on_load(on_load_name) do
90
- if ActiveSupport::Dependencies.autoloaded? self
91
- mechanism = :constantize
92
- else
93
- mechanism = :require
94
- end
95
-
96
- loader.each_pathname_constant(mechanism: mechanism, parent_pathname: module_pathname) do |concern|
97
- include concern
89
+ loader.each_pathname_constant(parent_pathname: module_pathname) do |concern|
90
+ include concern unless self.ancestors.map(&:name).include?(concern.to_s)
98
91
  end
99
92
  end
100
93
  end
@@ -109,19 +102,25 @@ class Metasploit::Concern::Loader
109
102
  # @param pathname [Pathname] a Pathname under {#root}.
110
103
  # @return [Object] if {#pathname_to_constant_name} returns a constant name
111
104
  # @return [nil] otherwise
112
- def constantize_pathname(mechanism:, pathname:)
105
+ def constantize_pathname(pathname:)
113
106
  constant_name = pathname_to_constant_name(pathname)
114
107
 
115
108
  constant = nil
116
109
 
117
110
  if constant_name
118
- # require before calling constantize so that the constant isn't recorded as unloadable.
119
- if mechanism == :require
120
- require pathname
111
+ begin
112
+ # constantize either way as the the constant_name still needs to be converted to Module
113
+ constant = constant_name.constantize
114
+ rescue => e # rescue any here should probably be more specific
115
+ if e.kind_of?(NameError)
116
+ begin
117
+ require pathname
118
+ constant = constant_name.constantize
119
+ rescue NameError => _e
120
+ _e # left for debugging breakpoint
121
+ end
122
+ end
121
123
  end
122
-
123
- # constantize either way as the the constant_name still needs to be converted to Module
124
- constant = constant_name.constantize
125
124
  end
126
125
 
127
126
  constant
@@ -1,7 +1,7 @@
1
1
  module Metasploit
2
2
  module Concern
3
3
  # VERSION is managed by GemRelease
4
- VERSION = '4.0.5'
4
+ VERSION = '5.0.0'
5
5
 
6
6
  # @return [String]
7
7
  #
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-concern
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metasploit Hackers
@@ -93,7 +93,7 @@ cert_chain:
93
93
  EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
94
94
  9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
95
95
  -----END CERTIFICATE-----
96
- date: 2022-09-02 00:00:00.000000000 Z
96
+ date: 2022-11-29 00:00:00.000000000 Z
97
97
  dependencies:
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: metasploit-yard
@@ -129,42 +129,56 @@ dependencies:
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '6.0'
132
+ version: '7.0'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '6.0'
139
+ version: '7.0'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: activesupport
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '6.0'
146
+ version: '7.0'
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: '6.0'
153
+ version: '7.0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: railties
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '6.0'
160
+ version: '7.0'
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '6.0'
167
+ version: '7.0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: zeitwerk
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :runtime
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
168
182
  description: Automatically includes Modules from app/concerns/<module_with_concerns>/<concern>.rb
169
183
  into <module_with_concerns> to ease monkey-patching associations and validations
170
184
  on ActiveRecord::Base descendents from other gems when layering schemas.
@@ -199,15 +213,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
199
213
  requirements:
200
214
  - - ">="
201
215
  - !ruby/object:Gem::Version
202
- version: 2.4.0
216
+ version: 2.7.0
203
217
  required_rubygems_version: !ruby/object:Gem::Requirement
204
218
  requirements:
205
219
  - - ">="
206
220
  - !ruby/object:Gem::Version
207
221
  version: '0'
208
222
  requirements: []
209
- rubyforge_project:
210
- rubygems_version: 2.7.10
223
+ rubygems_version: 3.3.26
211
224
  signing_key:
212
225
  specification_version: 4
213
226
  summary: Automatically include Modules from app/concerns
metadata.gz.sig CHANGED
Binary file