auto 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/gemspec.rb CHANGED
@@ -15,5 +15,5 @@ GEM_SPEC = Gem::Specification.new do |s|
15
15
  s.name = GEM_NAME
16
16
  s.platform = Gem::Platform::RUBY
17
17
  s.require_path = "lib"
18
- s.version = "0.1.2"
18
+ s.version = "0.1.3"
19
19
  end
data/lib/auto/plugins.rb CHANGED
@@ -14,8 +14,13 @@ module Auto
14
14
 
15
15
  class <<self
16
16
 
17
- # Add a directory to the plugin load paths.
17
+ # Add a plugin base directory
18
18
  def add(path)
19
+ Runner.require! Plugin.new(path)
20
+ end
21
+
22
+ # Add a directory to the plugin load paths.
23
+ def add_directory(path)
19
24
  @@directories = [] if $testing
20
25
  @@directories << path
21
26
  @@directories.uniq!
data/lib/auto/runner.rb CHANGED
@@ -21,15 +21,20 @@ module Auto
21
21
 
22
22
  class <<self
23
23
 
24
- def require!
24
+ def require!(plugin=nil)
25
+ require_all! and return unless plugin
26
+ if plugin.library
27
+ require plugin.library
28
+ end
29
+ begin
30
+ include eval(plugin.module)
31
+ rescue
32
+ end
33
+ end
34
+
35
+ def require_all!
25
36
  Plugins.plugins.each do |plugin|
26
- if plugin.library
27
- require plugin.library
28
- end
29
- begin
30
- include eval(plugin.module)
31
- rescue
32
- end
37
+ require! plugin
33
38
  end
34
39
  end
35
40
  end
@@ -4,7 +4,7 @@ module Auto
4
4
  describe Auto::Plugins do
5
5
 
6
6
  before(:all) do
7
- Plugins.add @fixtures = "#{SPEC}/plugins"
7
+ Plugins.add_directory @fixtures = "#{SPEC}/plugins"
8
8
  @libraries = Plugins.libraries
9
9
  @modules = Plugins.modules
10
10
  @tasks = Plugins.tasks
@@ -4,7 +4,7 @@ module Auto
4
4
  describe Auto::Runner do
5
5
 
6
6
  before(:all) do
7
- Plugins.add @fixtures = "#{SPEC}/plugins"
7
+ Plugins.add_directory @fixtures = "#{SPEC}/plugins"
8
8
  @runner = Runner.new
9
9
  end
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh