mactag 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.4 is the latest version supporting Rails 2.x.
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.4'
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.4'
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.4
1
+ 0.0.5
@@ -30,19 +30,21 @@ module Mactag
30
30
  end
31
31
 
32
32
  def files
33
- @gems.collect do |gem_name|
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
@@ -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
- @plugins.collect do |plugin|
26
- if plugin
27
- File.join(PLUGIN_PATH, plugin, "lib", "**", "*.rb")
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
@@ -47,7 +47,9 @@ class GemTest < ActiveSupport::TestCase
47
47
  end
48
48
 
49
49
  should "not raise exception because no such gem" do
50
- assert_nothing_raised { @gem.files }
50
+ assert_nothing_raised do
51
+ assert_equal [], @gem.files
52
+ end
51
53
  end
52
54
  end
53
55
 
@@ -2,49 +2,59 @@ require 'test_helper'
2
2
 
3
3
  class PluginTest < ActiveSupport::TestCase
4
4
 
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
- # @plugin = Mactag::Tag::Plugin.new
12
- # end
13
-
14
- # should "return all plugins as path" do
15
- # assert_equal @plugin.files, "vendor/plugins/*/lib/**/*.rb"
16
- # end
17
- # end
18
-
19
- # context "with one plugin argument" do
20
- # setup do
21
- # @plugin = Mactag::Tag::Plugin.new("thinking-sphinx")
22
- # end
23
-
24
- # should "return the path to that plugin" do
25
- # assert_equal ["vendor/plugins/thinking-sphinx/lib/**/*.rb"], @plugin.files
26
- # end
27
- # end
28
-
29
- # context "with more thatn one plugin argument" do
30
- # setup do
31
- # @plugin = Mactag::Tag::Plugin.new("thinking-sphinx", "formtastic")
32
- # end
33
-
34
- # should "return the paths to those plugins" do
35
- # assert_contains @plugin.files, "vendor/plugins/thinking-sphinx/lib/**/*.rb"
36
- # assert_contains @plugin.files, "vendor/plugins/formtastic/lib/**/*.rb"
37
- # end
38
- # end
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
- @plugin = Mactag::Tag::Plugin.new(nil)
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 { @plugin.files }
54
+ assert_nothing_raised do
55
+ assert_equal [], @plugin.files
56
+ end
47
57
  end
48
58
  end
49
-
59
+
50
60
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Johan Andersson