mactag 0.0.3 → 0.0.4
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 +37 -11
- data/TODO +8 -0
- data/VERSION +1 -1
- data/features/app.feature +19 -10
- data/features/gem.feature +28 -13
- data/features/plugin.feature +18 -9
- data/features/rails_gem.feature +35 -15
- data/features/rails_vendor.feature +21 -10
- data/features/step_definitions/gem_steps.rb +0 -18
- data/features/step_definitions/mactab_steps.rb +4 -0
- data/features/step_definitions/plugin_steps.rb +0 -12
- data/features/step_definitions/rails_steps.rb +0 -42
- data/features/support/env.rb +1 -0
- data/features/support/rails_app.rb +3 -3
- data/lib/mactag/tag/gem.rb +12 -7
- data/lib/mactag/tag/plugin.rb +5 -1
- data/test/mactag/tag/gem_test.rb +20 -8
- data/test/mactag/tag/plugin_test.rb +35 -25
- metadata +14 -7
- data/features/step_definitions/app_steps.rb +0 -11
- data/features/support/core_ext.rb +0 -5
data/README.markdown
CHANGED
@@ -5,39 +5,65 @@ an editor that supports Ctags (Emacs, Vim, TextMate, jEdit, ...). With
|
|
5
5
|
Ctags you can follow tags (of functions, variables, macros, whatever)
|
6
6
|
to their definitions.
|
7
7
|
|
8
|
+
|
8
9
|
# Exuberant Ctags
|
9
10
|
First off you must install [Ctags](http://ctags.sourceforge.net/).
|
10
11
|
Some systems comes with a ctags command already. If you have the ctags
|
11
12
|
executable, but have problems creating the tags file. Then make sure
|
12
13
|
that you are using **Exuberant Ctags** and not some other version.
|
13
14
|
|
15
|
+
|
14
16
|
# Installation
|
15
17
|
|
16
|
-
##
|
18
|
+
## Rails 2.x
|
19
|
+
Version 0.0.4 is the latest version supporting Rails 2.x.
|
17
20
|
|
21
|
+
### Plugin
|
18
22
|
Install the plugin:
|
23
|
+
$ ./script/plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.0.4'
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
## Gem
|
23
|
-
|
25
|
+
### Gem
|
24
26
|
Install the gem:
|
27
|
+
$ sudo gem install mactag --version='0.0.4'
|
28
|
+
|
29
|
+
Load the gem in **config/environments/development.rb**:
|
30
|
+
config.gem 'mactag'
|
25
31
|
|
26
|
-
|
32
|
+
## Rails 3.x
|
33
|
+
Version 0.1.0 is the only version supporting Rails 3.x.
|
27
34
|
|
28
|
-
|
35
|
+
### Plugin
|
36
|
+
Install the plugin:
|
37
|
+
$ rails plugin install git://github.com/rejeep/mactag.git --revision 'tags/v0.1.0'
|
38
|
+
|
39
|
+
### Gem
|
40
|
+
Install the gem:
|
41
|
+
$ sudo gem install mactag --version='0.1.0'
|
42
|
+
|
43
|
+
Load the gem in **Gemfile**:
|
44
|
+
group :development do
|
45
|
+
gem 'mactag'
|
46
|
+
end
|
29
47
|
|
48
|
+
## Note when installing as Gem
|
49
|
+
When you install mactag as a gem you must also include it's rake tasks
|
50
|
+
in your **Rakefile**.
|
30
51
|
require 'mactag/tasks'
|
52
|
+
|
31
53
|
|
32
54
|
# Configuration
|
33
|
-
|
34
55
|
Generate a basic configuration file:
|
35
56
|
|
57
|
+
## Rails 2.x
|
36
58
|
$ ./script/generate mactag
|
59
|
+
|
60
|
+
## Rails 3.x
|
61
|
+
$ rails generate mactag
|
37
62
|
|
38
63
|
This will create the file **config/mactag.rb**, which contains
|
39
64
|
some examples of how to set it up.
|
40
65
|
|
66
|
+
|
41
67
|
## Options
|
42
68
|
|
43
69
|
* **Mactag::Config.gem_home:** The path where the gems are located. Defaults to **/usr/lib/ruby/gems/1.8/gems**
|
@@ -58,11 +84,11 @@ some examples of how to set it up.
|
|
58
84
|
rails :except => :actionmailer, :version => "2.3.5"
|
59
85
|
end
|
60
86
|
|
61
|
-
# Usage
|
62
87
|
|
63
|
-
|
88
|
+
# Usage
|
89
|
+
To create the TAGS file. Simply run:
|
64
90
|
$ rake mactag
|
65
91
|
|
66
|
-
# License
|
67
92
|
|
93
|
+
# License
|
68
94
|
Copyright (c) 2010 Johan Andersson, released under the MIT license
|
data/TODO
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
-*- mode: Org -*-
|
2
|
+
|
3
|
+
* Bugs [0/1]
|
4
|
+
- [ ] Using config.gem 'mactag' only works in environment.rb file, not in environments/*.rb
|
5
|
+
* Feedback [0/1]
|
6
|
+
- [ ] Give user feedback if a plugin or gem does not exist
|
7
|
+
* Other [0/1]
|
8
|
+
- [ ] In generator script, add binary and gem_home examples
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/features/app.feature
CHANGED
@@ -9,27 +9,36 @@ Feature: Tag application files
|
|
9
9
|
|
10
10
|
Scenario: Tag single file
|
11
11
|
Given a javascript function "show" in "whitebox"
|
12
|
-
And
|
13
|
-
|
14
|
-
|
12
|
+
And a mactag config file with this contents:
|
13
|
+
"""
|
14
|
+
Mactag::Table.generate do
|
15
|
+
app "public/javascripts/whitebox.js"
|
16
|
+
end
|
17
|
+
"""
|
15
18
|
When I create the tags file
|
16
19
|
Then the tags file should contain "show"
|
17
20
|
|
18
21
|
Scenario: Tag multiple files
|
19
22
|
Given a javascript function "hide" in "whitebox"
|
20
23
|
And a ruby method "to_s" in the "user" model
|
21
|
-
And
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
And a mactag config file with this contents:
|
25
|
+
"""
|
26
|
+
Mactag::Table.generate do
|
27
|
+
app "public/javascripts/whitebox.js"
|
28
|
+
app "app/models/user.rb"
|
29
|
+
end
|
30
|
+
"""
|
25
31
|
When I create the tags file
|
26
32
|
Then the tags file should contain "hide"
|
27
33
|
And the tags file should contain "to_s"
|
28
34
|
|
29
35
|
Scenario: Tag files recursive
|
30
36
|
Given a ruby method "kill!" in the "user" model
|
31
|
-
And
|
32
|
-
|
33
|
-
|
37
|
+
And a mactag config file with this contents:
|
38
|
+
"""
|
39
|
+
Mactag::Table.generate do
|
40
|
+
app "app/**/*.rb"
|
41
|
+
end
|
42
|
+
"""
|
34
43
|
When I create the tags file
|
35
44
|
Then the tags file should contain "kill!"
|
data/features/gem.feature
CHANGED
@@ -10,9 +10,13 @@ Feature: Tag Gems
|
|
10
10
|
Scenario: Tag single gem
|
11
11
|
Given the gem "superduper" version "1.0.0" is installed
|
12
12
|
And an acts as method for the "superduper-1.0.0" gem
|
13
|
-
And a
|
14
|
-
|
15
|
-
|
13
|
+
And a mactag config file with this contents:
|
14
|
+
"""
|
15
|
+
Mactag::Config.gem_home = File.join("vendor", "gems")
|
16
|
+
Mactag::Table.generate do
|
17
|
+
gem "superduper"
|
18
|
+
end
|
19
|
+
"""
|
16
20
|
When I create the tags file
|
17
21
|
Then the tags file should contain "acts_as_superduper"
|
18
22
|
|
@@ -21,10 +25,13 @@ Feature: Tag Gems
|
|
21
25
|
And the gem "dunder" version "1.0.0" is installed
|
22
26
|
And an acts as method for the "superduper-1.0.0" gem
|
23
27
|
And an acts as method for the "dunder-1.0.0" gem
|
24
|
-
And a
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
And a mactag config file with this contents:
|
29
|
+
"""
|
30
|
+
Mactag::Config.gem_home = File.join("vendor", "gems")
|
31
|
+
Mactag::Table.generate do
|
32
|
+
gems "superduper", "dunder"
|
33
|
+
end
|
34
|
+
"""
|
28
35
|
When I create the tags file
|
29
36
|
Then the tags file should contain "acts_as_superduper"
|
30
37
|
Then the tags file should contain "acts_as_dunder"
|
@@ -34,9 +41,13 @@ Feature: Tag Gems
|
|
34
41
|
And the gem "superduper" version "1.0.1" is installed
|
35
42
|
And an acts as method for the "superduper-1.0.0" gem
|
36
43
|
And an acts as method for the "superduper-1.0.1" gem
|
37
|
-
And a
|
38
|
-
|
39
|
-
|
44
|
+
And a mactag config file with this contents:
|
45
|
+
"""
|
46
|
+
Mactag::Config.gem_home = File.join("vendor", "gems")
|
47
|
+
Mactag::Table.generate do
|
48
|
+
gem "superduper", :version => "1.0.0"
|
49
|
+
end
|
50
|
+
"""
|
40
51
|
When I create the tags file
|
41
52
|
Then the tags file should contain "acts_as_superduper"
|
42
53
|
And the tags file should contain "1.0.0"
|
@@ -49,9 +60,13 @@ Feature: Tag Gems
|
|
49
60
|
And an acts as method for the "superduper-1.0.2" gem
|
50
61
|
And an acts as method for the "superduper-1.0.1" gem
|
51
62
|
And an acts as method for the "superduper-1.0.0" gem
|
52
|
-
And a
|
53
|
-
|
54
|
-
|
63
|
+
And a mactag config file with this contents:
|
64
|
+
"""
|
65
|
+
Mactag::Config.gem_home = File.join("vendor", "gems")
|
66
|
+
Mactag::Table.generate do
|
67
|
+
gem "superduper"
|
68
|
+
end
|
69
|
+
"""
|
55
70
|
When I create the tags file
|
56
71
|
Then the tags file should contain "acts_as_superduper"
|
57
72
|
And the tags file should contain "1.0.2"
|
data/features/plugin.feature
CHANGED
@@ -10,9 +10,12 @@ Feature: Tag Plugins
|
|
10
10
|
Scenario: Tag single plugin
|
11
11
|
Given the plugin "superduper" is installed
|
12
12
|
And an acts as method for the "superduper" plugin
|
13
|
-
And a
|
14
|
-
|
15
|
-
|
13
|
+
And a mactag config file with this contents:
|
14
|
+
"""
|
15
|
+
Mactag::Table.generate do
|
16
|
+
plugin "superduper"
|
17
|
+
end
|
18
|
+
"""
|
16
19
|
When I create the tags file
|
17
20
|
Then the tags file should contain "acts_as_superduper"
|
18
21
|
|
@@ -21,10 +24,12 @@ Feature: Tag Plugins
|
|
21
24
|
And the plugin "dunder" is installed
|
22
25
|
And an acts as method for the "superduper" plugin
|
23
26
|
And an acts as method for the "dunder" plugin
|
24
|
-
And a
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
And a mactag config file with this contents:
|
28
|
+
"""
|
29
|
+
Mactag::Table.generate do
|
30
|
+
plugin "superduper", "dunder"
|
31
|
+
end
|
32
|
+
"""
|
28
33
|
When I create the tags file
|
29
34
|
Then the tags file should contain "acts_as_superduper"
|
30
35
|
Then the tags file should contain "acts_as_dunder"
|
@@ -34,8 +39,12 @@ Feature: Tag Plugins
|
|
34
39
|
And the plugin "dunder" is installed
|
35
40
|
And an acts as method for the "superduper" plugin
|
36
41
|
And an acts as method for the "dunder" plugin
|
37
|
-
And a
|
38
|
-
|
42
|
+
And a mactag config file with this contents:
|
43
|
+
"""
|
44
|
+
Mactag::Table.generate do
|
45
|
+
plugins
|
46
|
+
end
|
47
|
+
"""
|
39
48
|
When I create the tags file
|
40
49
|
Then the tags file should contain "acts_as_superduper"
|
41
50
|
Then the tags file should contain "acts_as_dunder"
|
data/features/rails_gem.feature
CHANGED
@@ -9,8 +9,13 @@ Feature: Tag Rails as a Gem
|
|
9
9
|
|
10
10
|
Scenario: Tag all packages
|
11
11
|
Given rails is installed as a gem
|
12
|
-
And a
|
13
|
-
|
12
|
+
And a mactag config file with this contents:
|
13
|
+
"""
|
14
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
15
|
+
Mactag::Table.generate do
|
16
|
+
rails
|
17
|
+
end
|
18
|
+
"""
|
14
19
|
When I create the tags file
|
15
20
|
Then the tags file should contain "diff"
|
16
21
|
And the tags file should contain "get"
|
@@ -21,10 +26,13 @@ Feature: Tag Rails as a Gem
|
|
21
26
|
|
22
27
|
Scenario: Tag only some packages
|
23
28
|
Given rails is installed as a gem
|
24
|
-
And a
|
25
|
-
|
26
|
-
|
27
|
-
|
29
|
+
And a mactag config file with this contents:
|
30
|
+
"""
|
31
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
32
|
+
Mactag::Table.generate do
|
33
|
+
rails :only => %w[activerecord activesupport]
|
34
|
+
end
|
35
|
+
"""
|
28
36
|
When I create the tags file
|
29
37
|
Then the tags file should contain "diff"
|
30
38
|
And the tags file should contain "has_many"
|
@@ -35,10 +43,13 @@ Feature: Tag Rails as a Gem
|
|
35
43
|
|
36
44
|
Scenario: Tag all except some packages
|
37
45
|
Given rails is installed as a gem
|
38
|
-
And a
|
39
|
-
|
40
|
-
|
41
|
-
|
46
|
+
And a mactag config file with this contents:
|
47
|
+
"""
|
48
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
49
|
+
Mactag::Table.generate do
|
50
|
+
rails :except => %w[actioncontroller actionview]
|
51
|
+
end
|
52
|
+
"""
|
42
53
|
When I create the tags file
|
43
54
|
Then the tags file should contain "diff"
|
44
55
|
And the tags file should contain "has_many"
|
@@ -50,9 +61,13 @@ Feature: Tag Rails as a Gem
|
|
50
61
|
Scenario: Tag specific version
|
51
62
|
Given rails version "3.0.0" is installed as a gem
|
52
63
|
And rails version "2.3.5" is installed as a gem
|
53
|
-
And a
|
54
|
-
|
55
|
-
|
64
|
+
And a mactag config file with this contents:
|
65
|
+
"""
|
66
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
67
|
+
Mactag::Table.generate do
|
68
|
+
rails :version => "3.0.0"
|
69
|
+
end
|
70
|
+
"""
|
56
71
|
When I create the tags file
|
57
72
|
Then the tags file should contain "3.0.0"
|
58
73
|
And the tags file should not contain "2.3.5"
|
@@ -61,8 +76,13 @@ Feature: Tag Rails as a Gem
|
|
61
76
|
Given rails version "3.0.0" is installed as a gem
|
62
77
|
And rails version "2.3.5" is installed as a gem
|
63
78
|
And rails version "2.3.2" is installed as a gem
|
64
|
-
And a
|
65
|
-
|
79
|
+
And a mactag config file with this contents:
|
80
|
+
"""
|
81
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
82
|
+
Mactag::Table.generate do
|
83
|
+
rails
|
84
|
+
end
|
85
|
+
"""
|
66
86
|
When I create the tags file
|
67
87
|
Then the tags file should contain "3.0.0"
|
68
88
|
And the tags file should not contain "2.3.2"
|
@@ -9,8 +9,13 @@ Feature: Tag Rails in vendor
|
|
9
9
|
And rails lives in vendor
|
10
10
|
|
11
11
|
Scenario: Tag all packages
|
12
|
-
Given a
|
13
|
-
|
12
|
+
Given a mactag config file with this contents:
|
13
|
+
"""
|
14
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
15
|
+
Mactag::Table.generate do
|
16
|
+
rails
|
17
|
+
end
|
18
|
+
"""
|
14
19
|
When I create the tags file
|
15
20
|
Then the tags file should contain "diff"
|
16
21
|
And the tags file should contain "get"
|
@@ -20,10 +25,13 @@ Feature: Tag Rails in vendor
|
|
20
25
|
And the tags file should contain "form_tag"
|
21
26
|
|
22
27
|
Scenario: Tag only some packages
|
23
|
-
Given a
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
Given a mactag config file with this contents:
|
29
|
+
"""
|
30
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
31
|
+
Mactag::Table.generate do
|
32
|
+
rails :only => %w[activerecord active_support]
|
33
|
+
end
|
34
|
+
"""
|
27
35
|
When I create the tags file
|
28
36
|
Then the tags file should contain "diff"
|
29
37
|
And the tags file should contain "has_many"
|
@@ -33,10 +41,13 @@ Feature: Tag Rails in vendor
|
|
33
41
|
And the tags file should not contain "form_tag"
|
34
42
|
|
35
43
|
Scenario: Tag all except some packages
|
36
|
-
Given a
|
37
|
-
|
38
|
-
|
39
|
-
|
44
|
+
Given a mactag config file with this contents:
|
45
|
+
"""
|
46
|
+
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
47
|
+
Mactag::Table.generate do
|
48
|
+
rails :except => %w[action_controller actionview]
|
49
|
+
end
|
50
|
+
"""
|
40
51
|
When I create the tags file
|
41
52
|
Then the tags file should contain "diff"
|
42
53
|
And the tags file should contain "has_many"
|
@@ -20,21 +20,3 @@ Given /^an acts as method for the "([^\"]*)" gem$/ do |gem|
|
|
20
20
|
eos
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
Given /^a gem mactag config with the following tags$/ do |table|
|
25
|
-
if version = table.hashes.first["version"]
|
26
|
-
tags = "#{table.hashes.first["tag"].quote}, :version => #{version.quote}"
|
27
|
-
else
|
28
|
-
tags = table.rows.flatten.collect(&:quote).join(", ")
|
29
|
-
end
|
30
|
-
|
31
|
-
@app.puts "config/mactag.rb" do
|
32
|
-
<<-eos
|
33
|
-
Mactag::Config.gem_home = File.join("vendor", "gems")
|
34
|
-
|
35
|
-
Mactag::Table.generate do
|
36
|
-
gems #{tags}
|
37
|
-
end
|
38
|
-
eos
|
39
|
-
end
|
40
|
-
end
|
@@ -14,6 +14,10 @@ Given /^mactag is installed$/ do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
Given /^a mactag config file with this contents:$/ do |contents|
|
18
|
+
@app.puts "config/mactag.rb", contents
|
19
|
+
end
|
20
|
+
|
17
21
|
Given /^a javascript function "([^\"]*)" in "([^\"]*)"$/ do |function, file|
|
18
22
|
@app.puts "public/javascripts/#{file}.js" do
|
19
23
|
<<-eos
|
@@ -20,15 +20,3 @@ Given /^an acts as method for the "([^\"]*)" plugin$/ do |plugin|
|
|
20
20
|
eos
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
Given /^a plugin mactag config with the following tags$/ do |table|
|
25
|
-
tags = table.rows.flatten.collect(&:quote).join(", ")
|
26
|
-
|
27
|
-
@app.puts "config/mactag.rb" do
|
28
|
-
<<-eos
|
29
|
-
Mactag::Table.generate do
|
30
|
-
plugins #{tags}
|
31
|
-
end
|
32
|
-
eos
|
33
|
-
end
|
34
|
-
end
|
@@ -11,48 +11,6 @@ Given /^rails lives in vendor$/ do
|
|
11
11
|
@app.gsub(vendor, from, to)
|
12
12
|
end
|
13
13
|
|
14
|
-
Given /^a rails mactag config with the following tags$/ do |table|
|
15
|
-
options = {
|
16
|
-
"only" => [],
|
17
|
-
"except" => [],
|
18
|
-
"version" => []
|
19
|
-
}
|
20
|
-
|
21
|
-
table.hashes.each do |hash|
|
22
|
-
hash.each do |option, value|
|
23
|
-
options[option] << value
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
if options.values.flatten.empty?
|
28
|
-
tags = ""
|
29
|
-
else
|
30
|
-
tags = []
|
31
|
-
options.each do |option, value|
|
32
|
-
unless value.empty?
|
33
|
-
if value.size == 1
|
34
|
-
tags << ":#{option} => #{value.first.quote}"
|
35
|
-
else
|
36
|
-
values = value.collect(&:quote).join(", ")
|
37
|
-
tags << ":#{option} => [#{values}]"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
tags = tags.join(", ")
|
43
|
-
end
|
44
|
-
|
45
|
-
@app.puts "config/mactag.rb" do
|
46
|
-
<<-eos
|
47
|
-
Mactag::Config.gem_home = File.join("vendor", "rails-temp")
|
48
|
-
|
49
|
-
Mactag::Table.generate do
|
50
|
-
rails #{tags}
|
51
|
-
end
|
52
|
-
eos
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
14
|
Given /^rails is installed as a gem$/ do
|
57
15
|
@app.install_rails_gem
|
58
16
|
end
|
data/features/support/env.rb
CHANGED
@@ -12,10 +12,10 @@ class RailsApp
|
|
12
12
|
FileUtils.rm_rf(rails_root)
|
13
13
|
end
|
14
14
|
|
15
|
-
def puts(file, &block)
|
15
|
+
def puts(file, contents = nil, &block)
|
16
16
|
file = File.join(rails_root, file)
|
17
|
-
|
18
|
-
File.open(file, "a") { |f| f.write(
|
17
|
+
text = contents || (block_given? ? instance_eval(&block) : "")
|
18
|
+
File.open(file, "a") { |f| f.write(text) }
|
19
19
|
end
|
20
20
|
|
21
21
|
def install_plugin(plugin)
|
data/lib/mactag/tag/gem.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'mactag/tag/versioned'
|
2
2
|
|
3
|
+
|
3
4
|
module Mactag
|
4
5
|
module Tag
|
5
|
-
|
6
|
+
|
6
7
|
# Tag for gems.
|
7
8
|
#
|
8
9
|
# ==== Examples
|
@@ -22,21 +23,25 @@ module Mactag
|
|
22
23
|
class Gem
|
23
24
|
|
24
25
|
include Versioned
|
25
|
-
|
26
|
+
|
26
27
|
def initialize(*gems)
|
27
28
|
@options = gems.extract_options!
|
28
29
|
@gems = gems.blank? ? ::Rails.configuration.gems.collect(&:name) : gems
|
29
30
|
end
|
30
31
|
|
31
32
|
def files
|
32
|
-
@gems.collect do |
|
33
|
+
@gems.collect do |gem_name|
|
33
34
|
if version = @options[:version]
|
34
|
-
gem = File.join(Mactag::Config.gem_home, "#{
|
35
|
+
gem = File.join(Mactag::Config.gem_home, "#{gem_name}-#{version}")
|
35
36
|
else
|
36
|
-
gem = latest(
|
37
|
+
gem = latest(gem_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
if gem
|
41
|
+
File.join(gem, "lib", "**", "*.rb")
|
42
|
+
else
|
43
|
+
$stderr.puts "Gem #{gem_name} not found"
|
37
44
|
end
|
38
|
-
|
39
|
-
File.join(gem, "lib", "**", "*.rb")
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
data/lib/mactag/tag/plugin.rb
CHANGED
@@ -23,7 +23,11 @@ module Mactag
|
|
23
23
|
return File.join(PLUGIN_PATH, "*", "lib", "**", "*.rb") if @plugins.empty?
|
24
24
|
|
25
25
|
@plugins.collect do |plugin|
|
26
|
-
|
26
|
+
if plugin
|
27
|
+
File.join(PLUGIN_PATH, plugin, "lib", "**", "*.rb")
|
28
|
+
else
|
29
|
+
$stderr.puts "Plugin #{plugin} not found"
|
30
|
+
end
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
data/test/mactag/tag/gem_test.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class GemTest < ActiveSupport::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
context "gem with version" do
|
6
6
|
setup do
|
7
7
|
@gem = Mactag::Tag::Gem.new("thinking-sphinx", :version => "1.0.0")
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
should "return the gem with that version" do
|
11
11
|
assert_contains @gem.files, File.join(Mactag::Config.gem_home, "thinking-sphinx-1.0.0", "lib", "**", "*.rb")
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
context "gem without version" do
|
16
16
|
context "one gem" do
|
17
17
|
setup do
|
@@ -19,24 +19,36 @@ class GemTest < ActiveSupport::TestCase
|
|
19
19
|
|
20
20
|
@gem = Mactag::Tag::Gem.new("whenever")
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
should "return that gem" do
|
24
24
|
assert_contains @gem.files, "whenever/lib/**/*.rb"
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
context "multiple gems" do
|
29
29
|
setup do
|
30
30
|
Dir.stubs(:glob).returns(["whenever-0.3.7", "whenever-0.3.6"])
|
31
|
-
|
31
|
+
|
32
32
|
@gem = Mactag::Tag::Gem.new("whenever")
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
should "return the gem with the latest version" do
|
36
36
|
assert_contains @gem.files, "whenever-0.3.7/lib/**/*.rb"
|
37
37
|
assert_does_not_contain @gem.files, "whenever-0.3.6/lib/**/*.rb"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
|
+
context "gem that does not exist" do
|
43
|
+
setup do
|
44
|
+
Dir.stubs(:glob).returns([nil])
|
45
|
+
|
46
|
+
@gem = Mactag::Tag::Gem.new("whenever")
|
47
|
+
end
|
48
|
+
|
49
|
+
should "not raise exception because no such gem" do
|
50
|
+
assert_nothing_raised { @gem.files }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
42
54
|
end
|
@@ -2,38 +2,48 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class PluginTest < ActiveSupport::TestCase
|
4
4
|
|
5
|
-
should "have correct plugin path" do
|
6
|
-
|
7
|
-
end
|
5
|
+
# should "have correct plugin path" do
|
6
|
+
# assert_equal "vendor/plugins", Mactag::Tag::Plugin::PLUGIN_PATH
|
7
|
+
# end
|
8
8
|
|
9
|
-
context "without arguments" do
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# context "without arguments" do
|
10
|
+
# setup do
|
11
|
+
# @plugin = Mactag::Tag::Plugin.new
|
12
|
+
# end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
# should "return all plugins as path" do
|
15
|
+
# assert_equal @plugin.files, "vendor/plugins/*/lib/**/*.rb"
|
16
|
+
# end
|
17
|
+
# end
|
18
18
|
|
19
|
-
context "with one plugin argument" do
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# context "with one plugin argument" do
|
20
|
+
# setup do
|
21
|
+
# @plugin = Mactag::Tag::Plugin.new("thinking-sphinx")
|
22
|
+
# end
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
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
|
28
39
|
|
29
|
-
context "
|
40
|
+
context "plugin that does not exist" do
|
30
41
|
setup do
|
31
|
-
@plugin = Mactag::Tag::Plugin.new(
|
42
|
+
@plugin = Mactag::Tag::Plugin.new(nil)
|
32
43
|
end
|
33
|
-
|
34
|
-
should "
|
35
|
-
|
36
|
-
assert_contains @plugin.files, "vendor/plugins/formtastic/lib/**/*.rb"
|
44
|
+
|
45
|
+
should "not raise exception because no such plugin" do
|
46
|
+
assert_nothing_raised { @plugin.files }
|
37
47
|
end
|
38
48
|
end
|
39
49
|
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mactag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Johan Andersson
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-03-11 00:00:00 +00:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -21,6 +26,7 @@ extensions: []
|
|
21
26
|
|
22
27
|
extra_rdoc_files:
|
23
28
|
- README.markdown
|
29
|
+
- TODO
|
24
30
|
files:
|
25
31
|
- README.markdown
|
26
32
|
- VERSION
|
@@ -38,6 +44,7 @@ files:
|
|
38
44
|
- lib/mactag/tag/versioned.rb
|
39
45
|
- lib/mactag/tasks.rb
|
40
46
|
- tasks/mactag_tasks.rake
|
47
|
+
- TODO
|
41
48
|
has_rdoc: true
|
42
49
|
homepage: http://github.com/rejeep/mactag
|
43
50
|
licenses: []
|
@@ -51,18 +58,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
58
|
requirements:
|
52
59
|
- - ">="
|
53
60
|
- !ruby/object:Gem::Version
|
61
|
+
segments:
|
62
|
+
- 0
|
54
63
|
version: "0"
|
55
|
-
version:
|
56
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
65
|
requirements:
|
58
66
|
- - ">="
|
59
67
|
- !ruby/object:Gem::Version
|
68
|
+
segments:
|
69
|
+
- 0
|
60
70
|
version: "0"
|
61
|
-
version:
|
62
71
|
requirements: []
|
63
72
|
|
64
73
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.6
|
66
75
|
signing_key:
|
67
76
|
specification_version: 3
|
68
77
|
summary: Ctags for Rails
|
@@ -79,9 +88,7 @@ test_files:
|
|
79
88
|
- features/step_definitions/plugin_steps.rb
|
80
89
|
- features/step_definitions/rails_steps.rb
|
81
90
|
- features/step_definitions/gem_steps.rb
|
82
|
-
- features/step_definitions/app_steps.rb
|
83
91
|
- features/step_definitions/mactab_steps.rb
|
84
|
-
- features/support/core_ext.rb
|
85
92
|
- features/support/tags_file.rb
|
86
93
|
- features/support/env.rb
|
87
94
|
- features/support/rails_app.rb
|