mactag 0.0.4 → 0.0.5
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.
- data/README.markdown +3 -3
- data/VERSION +1 -1
- data/lib/mactag/tag/gem.rb +5 -3
- data/lib/mactag/tag/plugin.rb +10 -8
- data/test/mactag/tag/gem_test.rb +3 -1
- data/test/mactag/tag/plugin_test.rb +48 -38
- metadata +2 -2
data/README.markdown
CHANGED
@@ -16,15 +16,15 @@ that you are using **Exuberant Ctags** and not some other version.
|
|
16
16
|
# Installation
|
17
17
|
|
18
18
|
## Rails 2.x
|
19
|
-
Version 0.0.
|
19
|
+
Version 0.0.5 is the latest version supporting Rails 2.x.
|
20
20
|
|
21
21
|
### Plugin
|
22
22
|
Install the plugin:
|
23
|
-
$ ./script/plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.0.
|
23
|
+
$ ./script/plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.0.5'
|
24
24
|
|
25
25
|
### Gem
|
26
26
|
Install the gem:
|
27
|
-
$ sudo gem install mactag --version='0.0.
|
27
|
+
$ sudo gem install mactag --version='0.0.5'
|
28
28
|
|
29
29
|
Load the gem in **config/environments/development.rb**:
|
30
30
|
config.gem 'mactag'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/mactag/tag/gem.rb
CHANGED
@@ -30,19 +30,21 @@ module Mactag
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def files
|
33
|
-
|
33
|
+
result = []
|
34
|
+
@gems.each do |gem_name|
|
34
35
|
if version = @options[:version]
|
35
36
|
gem = File.join(Mactag::Config.gem_home, "#{gem_name}-#{version}")
|
36
37
|
else
|
37
38
|
gem = latest(gem_name)
|
38
39
|
end
|
39
|
-
|
40
|
+
|
40
41
|
if gem
|
41
|
-
File.join(gem, "lib", "**", "*.rb")
|
42
|
+
result << File.join(gem, "lib", "**", "*.rb")
|
42
43
|
else
|
43
44
|
$stderr.puts "Gem #{gem_name} not found"
|
44
45
|
end
|
45
46
|
end
|
47
|
+
result
|
46
48
|
end
|
47
49
|
|
48
50
|
end
|
data/lib/mactag/tag/plugin.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Mactag
|
2
2
|
module Tag
|
3
|
-
|
3
|
+
|
4
4
|
# Tag for the current project plugins.
|
5
5
|
#
|
6
6
|
# ==== Examples
|
@@ -12,25 +12,27 @@ module Mactag
|
|
12
12
|
# plugins "thinking-sphinx", "formtastic"
|
13
13
|
# do
|
14
14
|
class Plugin
|
15
|
-
|
15
|
+
|
16
16
|
PLUGIN_PATH = File.join("vendor", "plugins")
|
17
|
-
|
17
|
+
|
18
18
|
def initialize(*plugins)
|
19
19
|
@plugins = plugins
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def files
|
23
23
|
return File.join(PLUGIN_PATH, "*", "lib", "**", "*.rb") if @plugins.empty?
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
result = []
|
26
|
+
@plugins.each do |plugin|
|
27
|
+
if File.exist?(File.join(PLUGIN_PATH, plugin))
|
28
|
+
result << File.join(PLUGIN_PATH, plugin, "lib", "**", "*.rb")
|
28
29
|
else
|
29
30
|
$stderr.puts "Plugin #{plugin} not found"
|
30
31
|
end
|
31
32
|
end
|
33
|
+
result
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
data/test/mactag/tag/gem_test.rb
CHANGED
@@ -2,49 +2,59 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class PluginTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
5
|
+
should "have correct plugin path" do
|
6
|
+
assert_equal "vendor/plugins", Mactag::Tag::Plugin::PLUGIN_PATH
|
7
|
+
end
|
8
|
+
|
9
|
+
context "without arguments" do
|
10
|
+
setup do
|
11
|
+
File.stubs(:exist?).returns(true)
|
12
|
+
|
13
|
+
@plugin = Mactag::Tag::Plugin.new
|
14
|
+
end
|
15
|
+
|
16
|
+
should "return all plugins as path" do
|
17
|
+
assert_equal @plugin.files, "vendor/plugins/*/lib/**/*.rb"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with one plugin argument" do
|
22
|
+
setup do
|
23
|
+
File.stubs(:exist?).returns(true)
|
24
|
+
|
25
|
+
@plugin = Mactag::Tag::Plugin.new("thinking-sphinx")
|
26
|
+
end
|
27
|
+
|
28
|
+
should "return the path to that plugin" do
|
29
|
+
assert_equal ["vendor/plugins/thinking-sphinx/lib/**/*.rb"], @plugin.files
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with more thatn one plugin argument" do
|
34
|
+
setup do
|
35
|
+
File.stubs(:exist?).returns(true)
|
36
|
+
|
37
|
+
@plugin = Mactag::Tag::Plugin.new("thinking-sphinx", "formtastic")
|
38
|
+
end
|
39
|
+
|
40
|
+
should "return the paths to those plugins" do
|
41
|
+
assert_contains @plugin.files, "vendor/plugins/thinking-sphinx/lib/**/*.rb"
|
42
|
+
assert_contains @plugin.files, "vendor/plugins/formtastic/lib/**/*.rb"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
40
46
|
context "plugin that does not exist" do
|
41
47
|
setup do
|
42
|
-
|
48
|
+
File.stubs(:exist?).returns(false)
|
49
|
+
|
50
|
+
@plugin = Mactag::Tag::Plugin.new("typo")
|
43
51
|
end
|
44
52
|
|
45
53
|
should "not raise exception because no such plugin" do
|
46
|
-
assert_nothing_raised
|
54
|
+
assert_nothing_raised do
|
55
|
+
assert_equal [], @plugin.files
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
|
-
|
59
|
+
|
50
60
|
end
|