fedux_org-stdlib 0.6.53 → 0.6.54

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
  SHA1:
3
- metadata.gz: 55fd690e1993fb0ea38a2db5aea87638165cd445
4
- data.tar.gz: f94235c4b8947666e00e7b7e23e61c29a7da3064
3
+ metadata.gz: ab784af842eb076d1daf729f886e73eaacb42553
4
+ data.tar.gz: 9aa883cd9e21d5250198d77ab77cfae52dac709e
5
5
  SHA512:
6
- metadata.gz: e894c4ed319b7c0d93e719f34ae7a2d4e383e29a2508478774b4281dfab44ec859bce9d893300b554ac788f9f9492b706f748f997a910bd7908bb819a8d0d7d8
7
- data.tar.gz: 2f307014a989fb64eb4c523b6ffe76c5ad25d56ea92202763e5d9634f854f379824afe9c94eebc7a5fb6c552e1a7860fc2e37e2d69d71d64ebcad17129f8e122
6
+ metadata.gz: 80579d9e5ad8076e62cd8868d29ab8abd3fcef84ba14f4da31188739130093140bf273959e8f931f7b552df1175461262cb6587da9793c510ea615764a21dc6f
7
+ data.tar.gz: 6f1423f64e8c31b4252ab5d2eb96eac6064491955bbd938905496e07089ae194ee06e6c7e54cbac864cb53ad293ac05e3806336a55ca7fada2c03021f0122291
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.6.52)
4
+ fedux_org-stdlib (0.6.53)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -11,15 +11,33 @@ module FeduxOrgStdlib
11
11
  # Make sure you've got a class method `.plugin_prefix` on your main module
12
12
  #
13
13
  # @example
14
+ # # -- main.rb --
14
15
  # # main module
15
- # module FeduxOrgStdlib
16
+ # module YourApplication
17
+ # # The manager
16
18
  # @plugin_manager = PluginManager.new
17
- # @plugin_prefix = Regexp.new("^#{self.name.downcase.underscore}-")
19
+ #
20
+ # # This regex depends on your application's plugins file system structure
21
+ # @plugin_prefix = Regexp.new("^#{self.name.underscore.gsub(/\//, '-')}-")
18
22
  #
19
23
  # class << self
20
24
  # attr_reader :plugin_prefix, :plugin_manager
25
+ #
26
+ # def load_plugins
27
+ # self.plugin_manager.locate_plugins
28
+ # self.plugin_manager.load_plugins
29
+ # end
21
30
  # end
22
31
  # end
32
+ #
33
+ # At some place you need to load your plugins.
34
+ #
35
+ # @example
36
+ #
37
+ # # -- runner.rb --
38
+ #
39
+ # YourApplication.load_plugins
40
+ #
23
41
  class PluginManager
24
42
  private
25
43
 
@@ -36,7 +54,7 @@ module FeduxOrgStdlib
36
54
  Gem.refresh
37
55
 
38
56
  (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|
39
- next if gem.name !~ self.class.deconstantize.plugin_prefix
57
+ next if gem.name !~ plugin_prefix
40
58
 
41
59
  plugin_name = gem.name.split('-', 2).last
42
60
  @plugins << Plugin.new(plugin_name, gem.name, gem, true) if !gem_located?(gem.name)
@@ -69,6 +87,16 @@ module FeduxOrgStdlib
69
87
  def gem_located?(gem_name)
70
88
  @plugins.any? { |plugin| plugin.gem_name == gem_name }
71
89
  end
90
+
91
+ def plugin_prefix
92
+ module_name = if self.class.name.deconstantize.blank?
93
+ self.class.name
94
+ else
95
+ self.class.name.deconstantize
96
+ end
97
+
98
+ module_name.constantize.plugin_prefix
99
+ end
72
100
  end
73
101
  end
74
102
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.6.53'
4
+ VERSION = '0.6.54'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.53
4
+ version: 0.6.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer