auto 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/gemspec.rb +1 -1
- data/lib/auto/plugins.rb +28 -28
- data/spec/auto/plugins_spec.rb +1 -1
- data/spec/auto/runner_spec.rb +1 -1
- metadata +2 -2
data/gemspec.rb
CHANGED
data/lib/auto/plugins.rb
CHANGED
@@ -1,53 +1,52 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
1
|
module Auto
|
4
2
|
class Plugins
|
5
3
|
|
6
|
-
@@
|
7
|
-
Gem.dir + "/gems",
|
8
|
-
"~/.auto",
|
9
|
-
"#{File.dirname(__FILE__)}/../../vendor/plugins"
|
10
|
-
]
|
4
|
+
@@plugin_paths = []
|
11
5
|
@@plugins = nil
|
12
6
|
|
13
7
|
cattr_accessor :directories
|
14
8
|
|
15
9
|
class <<self
|
16
10
|
|
17
|
-
# Add a plugin
|
11
|
+
# Add a plugin directory
|
18
12
|
def add(path)
|
19
|
-
|
13
|
+
@@plugin_paths << path
|
14
|
+
@@plugins = nil
|
20
15
|
end
|
21
16
|
|
22
|
-
# Add a
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@@plugins = nil
|
17
|
+
# Add a repository of plugins
|
18
|
+
def add_repository(path)
|
19
|
+
Dir["#{path}/auto-*"].each do |plugin|
|
20
|
+
Plugins.add plugin
|
21
|
+
end
|
28
22
|
end
|
29
23
|
|
30
24
|
# Returns an array of Plugin instances.
|
31
25
|
def plugins
|
32
26
|
return @@plugins if @@plugins
|
33
|
-
|
34
|
-
|
27
|
+
unless $testing
|
28
|
+
specs = Gem.source_index.latest_specs.select do |spec|
|
29
|
+
spec.name =~ /^auto-.+/
|
30
|
+
end
|
31
|
+
@@plugin_paths += specs.collect &:full_gem_path
|
32
|
+
# Treat the home directory like a plugin for the .auto directory
|
33
|
+
@@plugin_paths << File.expand_path('~')
|
34
|
+
@@plugin_paths.compact!
|
35
35
|
end
|
36
|
-
@@plugins = Dir[
|
36
|
+
@@plugins = Dir[*@@plugin_paths].collect do |d|
|
37
37
|
Plugin.new(d)
|
38
38
|
end
|
39
|
-
@@plugins
|
40
|
-
@@plugins
|
39
|
+
@@plugins || []
|
41
40
|
end
|
42
41
|
|
43
42
|
# Returns an array of library file paths.
|
44
43
|
def libraries
|
45
|
-
collector
|
44
|
+
collector &:library
|
46
45
|
end
|
47
46
|
|
48
47
|
# Returns an array of modules.
|
49
48
|
def modules
|
50
|
-
collector
|
49
|
+
collector &:module
|
51
50
|
end
|
52
51
|
|
53
52
|
# Returns a sorted array of hashes that describe tasks.
|
@@ -56,9 +55,7 @@ module Auto
|
|
56
55
|
if task
|
57
56
|
tasks.select { |t| t[:name] == task.downcase }.first
|
58
57
|
else
|
59
|
-
|
60
|
-
t = t.flatten
|
61
|
-
t.sort do |a, b|
|
58
|
+
collector(&:tasks).flatten.sort do |a, b|
|
62
59
|
a[:name].gsub(':', '0') <=> b[:name].gsub(':', '0')
|
63
60
|
end
|
64
61
|
end
|
@@ -85,8 +82,11 @@ module Auto
|
|
85
82
|
name = File.basename(directory)
|
86
83
|
name = name.split('-')
|
87
84
|
|
88
|
-
|
89
|
-
|
85
|
+
if name.include?('auto')
|
86
|
+
@name = name[name.index('auto') + 1]
|
87
|
+
else
|
88
|
+
@name = nil
|
89
|
+
end
|
90
90
|
|
91
91
|
# ~/.auto/auto-plugin/lib/plugin.rb
|
92
92
|
@library = "#{directory}/lib/auto/#{@name}.rb"
|
@@ -99,7 +99,7 @@ module Auto
|
|
99
99
|
@module = nil
|
100
100
|
end
|
101
101
|
|
102
|
-
# ~/.auto/auto-plugin
|
102
|
+
# ~/.auto/auto-plugin/.auto/task.rb
|
103
103
|
@tasks = Dir["#{directory}/.auto/**/*.rb"].sort.collect do |path|
|
104
104
|
relative = path.gsub("#{directory}/.auto/", '')
|
105
105
|
{
|
data/spec/auto/plugins_spec.rb
CHANGED
data/spec/auto/runner_spec.rb
CHANGED
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-16 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|