rdoc-tags 1.0 → 1.1
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.tar.gz.sig +0 -0
- data/History.txt +9 -0
- data/Manifest.txt +2 -0
- data/README.txt +5 -1
- data/Rakefile +3 -2
- data/lib/hoe/rdoc_tags.rb +44 -0
- data/lib/rdoc/generator/tags.rb +13 -11
- data/lib/rdoc/tags_task.rb +129 -0
- data/test/test_rdoc_generator_tags.rb +12 -4
- metadata +16 -9
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 1.1 / 2010-12-29
|
2
|
+
|
3
|
+
* Minor enhancements
|
4
|
+
* Added RDoc::TagsTask which generates a TAGS file
|
5
|
+
* Added +:rdoc_tags+ plugin for Hoe
|
6
|
+
* Bug fix
|
7
|
+
* Multiple tags are now generated for definitions across more than one file.
|
8
|
+
Bug #1 by postmodern.
|
9
|
+
|
1
10
|
=== 1.0 / 2010-12-23
|
2
11
|
|
3
12
|
* 1 major enhancement
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= rdoc-tags
|
2
2
|
|
3
3
|
* https://github.com/rdoc/rdoc-tags
|
4
4
|
|
@@ -8,6 +8,10 @@ A TAGS file generator based on http://ctags.sourceforge.net/FORMAT. rdoc-tags
|
|
8
8
|
handles namespaced classes and modules, ! and ? methods, constants and
|
9
9
|
attributes better than Exuberant Ctags.
|
10
10
|
|
11
|
+
rdoc-tags includes a Hoe plugin +:rdoc_tags+ making it easy to add tag support
|
12
|
+
to your ruby project. If you don't use Hoe you can instead use RDoc::TagsTask
|
13
|
+
to add rake tasks for building TAGS to your ruby project.
|
14
|
+
|
11
15
|
== FEATURES/PROBLEMS:
|
12
16
|
|
13
17
|
* Much slower that Exuberant Ctags
|
data/Rakefile
CHANGED
@@ -6,15 +6,16 @@ require 'hoe'
|
|
6
6
|
Hoe.plugin :git
|
7
7
|
Hoe.plugin :isolate
|
8
8
|
Hoe.plugin :minitest
|
9
|
+
Hoe.plugin :rdoc_tags
|
9
10
|
Hoe.plugins.delete :rubyforge
|
10
11
|
|
11
12
|
Hoe.spec 'rdoc-tags' do
|
12
13
|
developer 'Eric Hodel', 'drbrain@segment7.net'
|
13
14
|
|
14
|
-
extra_deps << ['rdoc', '~> 3']
|
15
|
+
extra_deps << ['rdoc', '~> 3.2']
|
15
16
|
extra_dev_deps << ['isolate', '~> 3']
|
16
17
|
|
17
|
-
self.isolate_dir = 'tmp/
|
18
|
+
self.isolate_dir = 'tmp/isolate'
|
18
19
|
end
|
19
20
|
|
20
21
|
# vim: syntax=Ruby
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rdoc/tags_task'
|
2
|
+
|
3
|
+
##
|
4
|
+
# The RDoc tags plugin for Hoe uses the standard names +tags+, +retag+ and
|
5
|
+
# +clobber_tags+ from RDoc::TagsTask. The plugin also integrates with the
|
6
|
+
# +clean+, +clobber+ and +newb+ tasks Hoe provides to add automatic cleanup.
|
7
|
+
#
|
8
|
+
# The +tags+ task automatically builds tags using all files in your
|
9
|
+
# specification's require paths (defaults to the lib directory).
|
10
|
+
#
|
11
|
+
# When the +newb+ task is run the plugin will automatically build a TAGS file.
|
12
|
+
#
|
13
|
+
# When the +clean+ or +clobber+ task is run the plugin will automatically
|
14
|
+
# remove the TAGS file.
|
15
|
+
#
|
16
|
+
# The plugin defaults to generating vim-style tags. You can override this by
|
17
|
+
# setting a value for <tt>'tags_style'</tt> in ~/.hoerc. Be sure to check
|
18
|
+
# <tt>rdoc --help</tt> for valid values.
|
19
|
+
|
20
|
+
module Hoe::RDoc_tags
|
21
|
+
|
22
|
+
##
|
23
|
+
# Defines tasks for building and removing TAGS files that integrate with
|
24
|
+
# Hoe.
|
25
|
+
|
26
|
+
def define_rdoc_tags_tasks
|
27
|
+
tags_style = 'vim'
|
28
|
+
|
29
|
+
with_config do |config, _|
|
30
|
+
tags_style = config['tags_style']
|
31
|
+
end
|
32
|
+
|
33
|
+
RDoc::TagsTask.new do |rd|
|
34
|
+
rd.files += spec.require_paths
|
35
|
+
rd.tags_style = tags_style
|
36
|
+
end
|
37
|
+
|
38
|
+
task :clean => :clobber_tags
|
39
|
+
task :clobber => :clobber_tags
|
40
|
+
task :newb => :tags
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
data/lib/rdoc/generator/tags.rb
CHANGED
@@ -9,7 +9,7 @@ class RDoc::Generator::Tags
|
|
9
9
|
##
|
10
10
|
# The version of the tags generator you are using
|
11
11
|
|
12
|
-
VERSION = '1.
|
12
|
+
VERSION = '1.1'
|
13
13
|
|
14
14
|
RDoc::RDoc.add_generator self
|
15
15
|
|
@@ -61,7 +61,7 @@ class RDoc::Generator::Tags
|
|
61
61
|
def initialize options
|
62
62
|
@options = options
|
63
63
|
@dry_run = options.dry_run
|
64
|
-
@tags = {}
|
64
|
+
@tags = Hash.new { |h, name| h[name] = [] }
|
65
65
|
end
|
66
66
|
|
67
67
|
##
|
@@ -69,7 +69,7 @@ class RDoc::Generator::Tags
|
|
69
69
|
|
70
70
|
def generate top_levels
|
71
71
|
top_levels.each do |top_level|
|
72
|
-
@tags[top_level.relative_name]
|
72
|
+
@tags[top_level.relative_name] << [top_level.relative_name, 0, 'F']
|
73
73
|
end
|
74
74
|
|
75
75
|
RDoc::TopLevel.all_classes_and_modules.each do |klass|
|
@@ -83,8 +83,8 @@ class RDoc::Generator::Tags
|
|
83
83
|
end
|
84
84
|
|
85
85
|
klass.in_files.each do |file|
|
86
|
-
@tags[klass.full_name]
|
87
|
-
@tags[klass.name]
|
86
|
+
@tags[klass.full_name] << [file.relative_name, address, 'c']
|
87
|
+
@tags[klass.name] << [file.relative_name, address, 'c']
|
88
88
|
end
|
89
89
|
|
90
90
|
klass.each_attribute do |attr|
|
@@ -95,12 +95,12 @@ class RDoc::Generator::Tags
|
|
95
95
|
kind
|
96
96
|
]
|
97
97
|
|
98
|
-
@tags[attr.name]
|
99
|
-
@tags["#{attr.name}="]
|
98
|
+
@tags[attr.name] << where
|
99
|
+
@tags["#{attr.name}="] << where
|
100
100
|
end
|
101
101
|
|
102
102
|
klass.each_constant do |constant|
|
103
|
-
@tags[constant.name]
|
103
|
+
@tags[constant.name] << [
|
104
104
|
constant.file.relative_name, "/#{constant.name}\\s\\*=/", 'd', kind]
|
105
105
|
end
|
106
106
|
|
@@ -112,7 +112,7 @@ class RDoc::Generator::Tags
|
|
112
112
|
"/def #{method.name}/"
|
113
113
|
end
|
114
114
|
|
115
|
-
@tags[method.name]
|
115
|
+
@tags[method.name] << [
|
116
116
|
method.file.relative_name, address, 'f', kind]
|
117
117
|
end
|
118
118
|
end
|
@@ -134,8 +134,10 @@ class RDoc::Generator::Tags
|
|
134
134
|
!_TAG_PROGRAM_VERSION\t#{VERSION}
|
135
135
|
INFO
|
136
136
|
|
137
|
-
@tags.sort.each do |name,
|
138
|
-
|
137
|
+
@tags.sort.each do |name, definitions|
|
138
|
+
definitions.uniq.each do |(file, address, *field)|
|
139
|
+
io.write "#{name}\t#{file}\t#{address};\"\t#{field.join "\t"}\n"
|
140
|
+
end
|
139
141
|
end
|
140
142
|
end
|
141
143
|
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
begin
|
4
|
+
gem 'rake'
|
5
|
+
rescue Gem::LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'rake'
|
9
|
+
require 'rake/tasklib'
|
10
|
+
|
11
|
+
##
|
12
|
+
# Creates rake tasks for building, rebuilding and removing TAGS files.
|
13
|
+
#
|
14
|
+
# In your Rakefile add:
|
15
|
+
#
|
16
|
+
# require 'rdoc/tags_task'
|
17
|
+
#
|
18
|
+
# RDoc::TagsTask.new
|
19
|
+
#
|
20
|
+
# Then run from the commandline:
|
21
|
+
#
|
22
|
+
# $ rake tags # build
|
23
|
+
# $ rake retag # rebuild
|
24
|
+
# $ rake clobber_tags # remove
|
25
|
+
#
|
26
|
+
# Use the Hoe::RDoc_tags plugin instead if you're using Hoe.
|
27
|
+
|
28
|
+
class RDoc::TagsTask < Rake::TaskLib
|
29
|
+
|
30
|
+
##
|
31
|
+
# Rake::FileList of files to be used for tag generation.
|
32
|
+
#
|
33
|
+
# Your gem's require paths are probably sufficient.
|
34
|
+
|
35
|
+
attr_accessor :files
|
36
|
+
|
37
|
+
##
|
38
|
+
# Directory to generate tags into. Defaults to '.'
|
39
|
+
|
40
|
+
attr_accessor :tags_dir
|
41
|
+
|
42
|
+
##
|
43
|
+
# Name of the TAGS file. Defaults to 'TAGS'
|
44
|
+
|
45
|
+
attr_accessor :tags_file
|
46
|
+
|
47
|
+
##
|
48
|
+
# Tag style to output. Defaults to vim.
|
49
|
+
|
50
|
+
attr_accessor :tag_style
|
51
|
+
|
52
|
+
##
|
53
|
+
# Creates a new RDoc task that will build a TAGS file. Default task names
|
54
|
+
# are +tags+ to build, +retag+ to rebuild and +clobber_tags+ to remove.
|
55
|
+
# These may be overridden using the +names+ hash with the +:tags+,
|
56
|
+
# +:retag+ and +:clobber+ keys respectively.
|
57
|
+
|
58
|
+
def initialize names = {} # :yield: self
|
59
|
+
@clobber_task = names[:clobber] || 'clobber_tags'
|
60
|
+
@retag_task = names[:retag] || 'retag'
|
61
|
+
@tags_task = names[:tags] || 'tags'
|
62
|
+
|
63
|
+
@files = Rake::FileList.new
|
64
|
+
@tags_dir = '.'
|
65
|
+
@tags_file = 'TAGS'
|
66
|
+
@tag_style = 'vim'
|
67
|
+
|
68
|
+
yield self if block_given?
|
69
|
+
|
70
|
+
define
|
71
|
+
end
|
72
|
+
|
73
|
+
##
|
74
|
+
# Builds the TAGS file.
|
75
|
+
|
76
|
+
def build_tags
|
77
|
+
args = [
|
78
|
+
'-f', 'tags',
|
79
|
+
'-q',
|
80
|
+
'--tag-style', @tag_style,
|
81
|
+
'-o', @tags_dir,
|
82
|
+
]
|
83
|
+
|
84
|
+
args += @files
|
85
|
+
|
86
|
+
begin
|
87
|
+
gem 'rdoc'
|
88
|
+
rescue Gem::LoadError
|
89
|
+
end
|
90
|
+
|
91
|
+
require 'rdoc/rdoc'
|
92
|
+
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
|
93
|
+
|
94
|
+
RDoc::RDoc.new.document args
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Defines tasks for building, rebuilding and clobbering the TAGS file
|
99
|
+
|
100
|
+
def define
|
101
|
+
desc 'Build TAGS file'
|
102
|
+
task @tags_task => @tags_file
|
103
|
+
|
104
|
+
desc 'Rebuild TAGS file'
|
105
|
+
task @retag_task => [@clobber_task, @tags_task]
|
106
|
+
|
107
|
+
desc 'Clobber TAGS file'
|
108
|
+
task @clobber_task do
|
109
|
+
rm_f tags_path
|
110
|
+
end
|
111
|
+
|
112
|
+
directory @tags_dir
|
113
|
+
|
114
|
+
file @tags_file => [@tags_dir, Rake.application.rakefile, @files] do
|
115
|
+
build_tags
|
116
|
+
end
|
117
|
+
|
118
|
+
self
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Path to the tags file
|
123
|
+
|
124
|
+
def tags_path
|
125
|
+
File.join @tags_dir, @tags_file
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
@@ -54,6 +54,10 @@ class TestRDocGeneratorTags < MiniTest::Unit::TestCase
|
|
54
54
|
@klass.add_method @meth_bang
|
55
55
|
@klass.add_attribute @attr
|
56
56
|
@klass.add_constant @const
|
57
|
+
|
58
|
+
@top_level_2 = RDoc::TopLevel.new 'file_2.rb'
|
59
|
+
@A_B_A = @B.add_class RDoc::NormalClass, 'A'
|
60
|
+
@A_B_A.record_location @top_level_2
|
57
61
|
end
|
58
62
|
|
59
63
|
def teardown
|
@@ -145,11 +149,15 @@ class TestRDocGeneratorTags < MiniTest::Unit::TestCase
|
|
145
149
|
assert_equal "!_TAG_PROGRAM_VERSION\t#{RDoc::Generator::Tags::VERSION}\n",
|
146
150
|
tags.next
|
147
151
|
|
148
|
-
assert_equal "A\tfile.rb\t/class A/;\"\tc\n",
|
149
|
-
assert_equal "A
|
150
|
-
assert_equal "B\tfile.rb\t/class \\(A::\\)\\?B/;\"\tc\n",
|
152
|
+
assert_equal "A\tfile.rb\t/class A/;\"\tc\n", tags.next
|
153
|
+
assert_equal "A\tfile_2.rb\t/class \\(A::B::\\)\\?A/;\"\tc\n", tags.next
|
154
|
+
assert_equal "A::B\tfile.rb\t/class \\(A::\\)\\?B/;\"\tc\n", tags.next
|
155
|
+
assert_equal "A::B::A\tfile_2.rb\t/class \\(A::B::\\)\\?A/;\"\tc\n",
|
156
|
+
tags.next
|
157
|
+
assert_equal "B\tfile.rb\t/class \\(A::\\)\\?B/;\"\tc\n", tags.next
|
151
158
|
|
152
|
-
assert_equal "CONST\tfile.rb\t/CONST\\s\\*=/;\"\td\tclass:Object\n",
|
159
|
+
assert_equal "CONST\tfile.rb\t/CONST\\s\\*=/;\"\td\tclass:Object\n",
|
160
|
+
tags.next
|
153
161
|
|
154
162
|
assert_equal "Object\tfile.rb\t/class Object/;\"\tc\n", tags.next
|
155
163
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdoc-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 1
|
9
|
+
version: "1.1"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Hodel
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
x52qPcexcYZR7w==
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2010-12-
|
38
|
+
date: 2010-12-29 00:00:00 -08:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -46,10 +46,11 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
49
|
+
hash: 3
|
50
50
|
segments:
|
51
51
|
- 3
|
52
|
-
|
52
|
+
- 2
|
53
|
+
version: "3.2"
|
53
54
|
type: :runtime
|
54
55
|
version_requirements: *id001
|
55
56
|
- !ruby/object:Gem::Dependency
|
@@ -60,12 +61,12 @@ dependencies:
|
|
60
61
|
requirements:
|
61
62
|
- - ">="
|
62
63
|
- !ruby/object:Gem::Version
|
63
|
-
hash:
|
64
|
+
hash: 11
|
64
65
|
segments:
|
65
66
|
- 2
|
66
67
|
- 0
|
67
|
-
-
|
68
|
-
version: 2.0.
|
68
|
+
- 2
|
69
|
+
version: 2.0.2
|
69
70
|
type: :development
|
70
71
|
version_requirements: *id002
|
71
72
|
- !ruby/object:Gem::Dependency
|
@@ -102,6 +103,10 @@ description: |-
|
|
102
103
|
A TAGS file generator based on http://ctags.sourceforge.net/FORMAT. rdoc-tags
|
103
104
|
handles namespaced classes and modules, ! and ? methods, constants and
|
104
105
|
attributes better than Exuberant Ctags.
|
106
|
+
|
107
|
+
rdoc-tags includes a Hoe plugin +:rdoc_tags+ making it easy to add tag support
|
108
|
+
to your ruby project. If you don't use Hoe you can instead use RDoc::TagsTask
|
109
|
+
to add rake tasks for building TAGS to your ruby project.
|
105
110
|
email:
|
106
111
|
- drbrain@segment7.net
|
107
112
|
executables: []
|
@@ -118,8 +123,10 @@ files:
|
|
118
123
|
- Manifest.txt
|
119
124
|
- README.txt
|
120
125
|
- Rakefile
|
126
|
+
- lib/hoe/rdoc_tags.rb
|
121
127
|
- lib/rdoc/discover.rb
|
122
128
|
- lib/rdoc/generator/tags.rb
|
129
|
+
- lib/rdoc/tags_task.rb
|
123
130
|
- test/test_rdoc_generator_tags.rb
|
124
131
|
has_rdoc: true
|
125
132
|
homepage: https://github.com/rdoc/rdoc-tags
|
metadata.gz.sig
CHANGED
Binary file
|