metasploit-concern 0.0.4 → 0.1.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzYzMTU5MmEzNWYwZjI0MWM1NDVlNTJmYThhYWU5ZjVmMmYxMmU5Yw==
4
+ NDE0ZDAxOTA3YjBlNGUwNzk0MTZhMGZkZjhjMjg1MTY0YTE2NjU5YQ==
5
5
  data.tar.gz: !binary |-
6
- NjdjZDdlYzRlN2JjNTJmOWQyMTJiNTI2YTZlYzA3YTAzNDFiNDZlMw==
6
+ OWNiOWExZWJkYWZlYzU2ZWZkMTc2OTZkN2VkYjM4N2FmZjU1NDNhNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTIwZDRmNmZiNmNhODA4NDExYmRlNWQ4MDJjZTFhOWE1MDQ2NjRiYzUxYTIz
10
- ZWRkZGU2ZDgxMzhhNDZjZGFiYzI5NWRkNTgyNzhkNGYwYWMxY2NlNGU5YmJh
11
- OWQ1YjdhYjRiNzQyMGU0NWM2ODU1NWE0ZjdiMmRkZDBjYjIyNzk=
9
+ NDVhZDc1YTY5OTYwNTY3M2QyZGZmMDY1OGFhN2MzMDZiNDc3YjhkY2UwNmQw
10
+ NjllZmFjOGE0YjNjZDU0ZDdhZTg2NTM1OTQzNGMxN2UyNGI5M2ZiMzc5ZTQx
11
+ MDc1ZmQ5YmU4YTZlM2M4OThlZDVjOTZmOWExMjI5NDhjMDNjZmY=
12
12
  data.tar.gz: !binary |-
13
- NjUzY2U3YjkwNWNmMmJmNWE0MGI2NDkwZWUwMmIxNDk0ZDVmZTkwOGM3ODVk
14
- ODJhMDk4YzZmZmIxZTEzMWU2Y2M3MjA4MjU1YTkzOTg4NGE3NTE4MDZhNDAz
15
- NDIwM2FmYjQ3NDdiNTRiZmVmYjZhODJiM2VjNjI0MDE3YjVlNzQ=
13
+ YzRmNGZhZTc5YTI3NGMwNTIyMDUxNGIyZWFmZGUyZWZkZjcxODk5NDIwN2Q4
14
+ NDU2YzllZGUxMmVkMGI3Y2M1NDlhN2JkMDZlNWYxYTAzM2E3Yjc1NDA5Yjcy
15
+ MjNmZDQyM2Y5NGEyOTJhMDVjMmYxNmFiOTFmMDRiMzg3M2ZiOTg=
data/README.md CHANGED
@@ -118,4 +118,16 @@ Using `ActiveSupport::Concern` allow you to add new associations and or validati
118
118
  dependent: :destroy,
119
119
  inverse_of :gem_namespace_gem_class
120
120
  end
121
- end
121
+ end
122
+
123
+ ### initializers
124
+
125
+ `Metasploit::Concern::Engine` defines the `'metasploit_concern.load_concerns'` initializer, which sets up
126
+ `ActiveSupport.on_load` callbacks. If you depend on a feature from a concern in your initializers, it is best to have
127
+ the initializer declare that it needs to be run after `'metasploit_concern.load_concerns`:
128
+
129
+ initializer 'application_or_engine_namespace.depends_on_concerns', after: 'metasploit_concern.load_concerns' do
130
+ if GemNamespace::GemClass.primary.widgets.empty?
131
+ logger.info('No Widgets on the primary GemClass!')
132
+ end
133
+ end
@@ -6,6 +6,10 @@ else
6
6
  module Metasploit
7
7
  module Concern
8
8
  class Engine < ::Rails::Engine
9
+ #
10
+ # `config`
11
+ #
12
+
9
13
  # @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
10
14
  config.generators do |g|
11
15
  g.assets false
@@ -13,6 +17,35 @@ else
13
17
  g.test_framework :rspec, fixture: false
14
18
  end
15
19
 
20
+ #
21
+ # `initializer`s
22
+ #
23
+
24
+ initializer 'metasploit_concern.load_concerns' do
25
+ application = Rails.application
26
+ engines = application.railties.engines
27
+
28
+ # application is an engine
29
+ engines = [application, *engines]
30
+
31
+ engines.each do |engine|
32
+ concerns_path = engine.paths['app/concerns']
33
+
34
+ if concerns_path
35
+ concerns_directories = concerns_path.existent_directories
36
+ else
37
+ # app/concerns is not set, so just derive it from root. Cannot derive from app because it will glob app/models too
38
+ concerns_directories = [engine.root.join('app', 'concerns').to_path]
39
+ end
40
+
41
+ concerns_directories.each do |concerns_directory|
42
+ concerns_pathname = Pathname.new(concerns_directory)
43
+ loader = Metasploit::Concern::Loader.new(root: concerns_pathname)
44
+ loader.register
45
+ end
46
+ end
47
+ end
48
+
16
49
  isolate_namespace Metasploit::Concern
17
50
  end
18
51
  end
@@ -5,9 +5,9 @@ module Metasploit
5
5
  # The major version number.
6
6
  MAJOR = 0
7
7
  # The minor version number, scoped to the {MAJOR} version number.
8
- MINOR = 0
8
+ MINOR = 1
9
9
  # The patch number, scoped to the {MINOR} version number.
10
- PATCH = 4
10
+ PATCH = 0
11
11
 
12
12
  # The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
13
13
  # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-concern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Imhoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -39,15 +39,14 @@ executables: []
39
39
  extensions: []
40
40
  extra_rdoc_files: []
41
41
  files:
42
- - LICENSE
43
- - README.md
44
- - Rakefile
45
42
  - app/models/metasploit/concern/loader.rb
46
- - config/initializers/load_concerns.rb
47
- - lib/metasploit/concern.rb
48
43
  - lib/metasploit/concern/engine.rb
49
44
  - lib/metasploit/concern/version.rb
45
+ - lib/metasploit/concern.rb
50
46
  - lib/tasks/yard.rake
47
+ - LICENSE
48
+ - Rakefile
49
+ - README.md
51
50
  - spec/support/shared/examples/metasploit/concern/run.rb
52
51
  homepage: https://github.com/rapid7/metasploit-concern
53
52
  licenses:
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
68
  version: '0'
70
69
  requirements: []
71
70
  rubyforge_project:
72
- rubygems_version: 2.2.2
71
+ rubygems_version: 2.1.11
73
72
  signing_key:
74
73
  specification_version: 4
75
74
  summary: Automatically include Modules from app/concerns
@@ -1,23 +0,0 @@
1
- application = Rails.application
2
- engines = application.railties.engines
3
-
4
- # application is an engine
5
- engines = [application, *engines]
6
-
7
- engines.each do |engine|
8
- concerns_path = engine.paths['app/concerns']
9
-
10
- if concerns_path
11
- concerns_directories = concerns_path.existent_directories
12
- else
13
- # app/concerns is not set, so just derive it from root. Cannot derive from app because it will glob app/models too
14
- concerns_directories = [engine.root.join('app', 'concerns').to_path]
15
- end
16
-
17
- concerns_directories.each do |concerns_directory|
18
- concerns_pathname = Pathname.new(concerns_directory)
19
- loader = Metasploit::Concern::Loader.new(root: concerns_pathname)
20
- loader.register
21
- end
22
- end
23
-