rcodetools 0.4.0.0
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/CHANGES +18 -0
- data/README +34 -0
- data/README.emacs +54 -0
- data/README.method_analysis +13 -0
- data/README.vim +84 -0
- data/README.xmpfilter +202 -0
- data/Rakefile +123 -0
- data/Rakefile.method_analysis +30 -0
- data/THANKS +6 -0
- data/bin/rct-complete +37 -0
- data/bin/rct-doc +50 -0
- data/bin/rct-meth-args +392 -0
- data/bin/xmpfilter +75 -0
- data/icicles-rcodetools.el +31 -0
- data/lib/method_analyzer.rb +107 -0
- data/lib/rcodetools/completion.rb +282 -0
- data/lib/rcodetools/doc.rb +176 -0
- data/lib/rcodetools/options.rb +83 -0
- data/lib/rcodetools/xmpfilter.rb +208 -0
- data/lib/rcodetools/xmptestunitfilter.rb +197 -0
- data/rcodetools.el +162 -0
- data/rcodetools.vim +118 -0
- data/setup.rb +1585 -0
- data/test/data/add_markers-input.rb +2 -0
- data/test/data/add_markers-output.rb +2 -0
- data/test/data/bindings-input.rb +26 -0
- data/test/data/bindings-output.rb +31 -0
- data/test/data/completion-input.rb +1 -0
- data/test/data/completion-output.rb +2 -0
- data/test/data/completion_emacs-input.rb +1 -0
- data/test/data/completion_emacs-output.rb +5 -0
- data/test/data/completion_emacs_icicles-input.rb +1 -0
- data/test/data/completion_emacs_icicles-output.rb +5 -0
- data/test/data/doc-input.rb +1 -0
- data/test/data/doc-output.rb +1 -0
- data/test/data/method_analyzer-data.rb +33 -0
- data/test/data/method_args.data.rb +106 -0
- data/test/data/no_warnings-input.rb +3 -0
- data/test/data/no_warnings-output.rb +4 -0
- data/test/data/refe-input.rb +1 -0
- data/test/data/refe-output.rb +1 -0
- data/test/data/ri-input.rb +1 -0
- data/test/data/ri-output.rb +1 -0
- data/test/data/ri_emacs-input.rb +1 -0
- data/test/data/ri_emacs-output.rb +1 -0
- data/test/data/ri_vim-input.rb +1 -0
- data/test/data/ri_vim-output.rb +1 -0
- data/test/data/rspec-input.rb +48 -0
- data/test/data/rspec-output.rb +52 -0
- data/test/data/rspec_poetry-input.rb +48 -0
- data/test/data/rspec_poetry-output.rb +52 -0
- data/test/data/simple_annotation-input.rb +8 -0
- data/test/data/simple_annotation-output.rb +8 -0
- data/test/data/unit_test-input.rb +50 -0
- data/test/data/unit_test-output.rb +52 -0
- data/test/data/unit_test_poetry-input.rb +50 -0
- data/test/data/unit_test_poetry-output.rb +52 -0
- data/test/test_completion.rb +467 -0
- data/test/test_doc.rb +403 -0
- data/test/test_functional.rb +18 -0
- data/test/test_method_analyzer.rb +99 -0
- data/test/test_method_args.rb +134 -0
- data/test/test_run.rb +41 -0
- data/test/test_xmpfilter.rb +36 -0
- data/test/test_xmptestunitfilter.rb +84 -0
- metadata +139 -0
data/CHANGES
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
xmpfilter was integrated into rcodetools as of 0.4.0.
|
3
|
+
|
4
|
+
xmpfilter history
|
5
|
+
=================
|
6
|
+
User-visible changes since 0.3.1 (2006-10-17)
|
7
|
+
* implemented --debug
|
8
|
+
* --[no]-warnings
|
9
|
+
* --cd working_dir
|
10
|
+
* --rails
|
11
|
+
* --no-poetry
|
12
|
+
* more intelligent assertions: try to find which local variables hold the
|
13
|
+
values compared against in assertions/expectations
|
14
|
+
* editor-independent completion (-C, --completion-emacs, --completion-vim)
|
15
|
+
* quick method/class reference with -D (--refe, --ri*)
|
16
|
+
|
17
|
+
User-visible changes since 0.3.0 (2006-10-16)
|
18
|
+
* xmpfilter.rb --spec works on win32 too
|
data/README
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
rcodetools http://eigenclass.org/hiki.rb?rcodetools
|
3
|
+
Copyright (c) 2005-2006 Mauricio Fernandez <mfp@acm.org> http://eigenclass.org
|
4
|
+
Copyright (c) 2006 rubikitch <rubikitch@ruby-lang.org> http://www.rubyist.net/~rubikitch/
|
5
|
+
Use and distribution subject to the terms of the Ruby license.
|
6
|
+
|
7
|
+
= Overview
|
8
|
+
rcodetools is a collection of Ruby code manipulation tools.
|
9
|
+
It includes xmpfilter and editor-independent Ruby development helper tools,
|
10
|
+
as well as emacs and vim interfaces.
|
11
|
+
|
12
|
+
Currently, rcodetools comprises:
|
13
|
+
* xmpfilter: Automagic Test::Unit assertions/RSpec expectations and code annotations
|
14
|
+
* rct-complete: Accurate method/class/constant etc. completions
|
15
|
+
* rct-doc: Document browsing and code navigator
|
16
|
+
* rct-meth-args: Precise method info (meta-prog. aware) and TAGS generation
|
17
|
+
|
18
|
+
See also README.xmpfilter.
|
19
|
+
|
20
|
+
Originally rct-complete and rct-doc were subcommands of xmpfilter.
|
21
|
+
Actually they use xmpfilter's code heavily.
|
22
|
+
But the relationship between xmpfilter (annotation) and completion/doc is not
|
23
|
+
intuitive, so I (rubikitch) split it into separate executables.
|
24
|
+
|
25
|
+
= Usage
|
26
|
+
xmpfilter, rct-complete and rct-doc take its input from stdin and write to
|
27
|
+
stdout. They can run in several modes; see
|
28
|
+
xmpfilter -h
|
29
|
+
rct-complete -h
|
30
|
+
rct-doc -h
|
31
|
+
README.emacs and README.vim describe how to use rcodetools from your editor.
|
32
|
+
|
33
|
+
= License
|
34
|
+
rcodetools is licensed under the same terms as Ruby.
|
data/README.emacs
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
rcodetools.el allows you to run rcodetools on a buffer.
|
3
|
+
|
4
|
+
To eval the sexp, type C-e C-x C-e; `end-of-line' and `eval-last-sexp'.
|
5
|
+
|
6
|
+
installation
|
7
|
+
============
|
8
|
+
|
9
|
+
If you use RI document feature, you must install ri-emacs first.
|
10
|
+
http://rubyforge.org/projects/ri-emacs/
|
11
|
+
|
12
|
+
If you feel RI and ri-emacs.rb startup is SLOW, you want to install FastRI.
|
13
|
+
FastRI offers ri-emacs compatible layer, so you can use it with ri-ruby.el.
|
14
|
+
http://eigenclass.org/hiki.rb?fastri
|
15
|
+
|
16
|
+
Copy <tt>rcodetools.el</tt> to the appropriate directory, which is in load-path.
|
17
|
+
Then require it.
|
18
|
+
(require 'rcodetools)
|
19
|
+
|
20
|
+
If you use icicles copy <tt>icicles-rcodetools.el</tt> too.
|
21
|
+
Then require it.
|
22
|
+
(require 'icicles-rcodetools)
|
23
|
+
It provides wonderful `help on candidate' feature, RI document on each candidate during completion.
|
24
|
+
I'm addicted to icicles!
|
25
|
+
http://www.emacswiki.org/cgi-bin/wiki/Icicles
|
26
|
+
|
27
|
+
xmpfilter on buffer
|
28
|
+
===================
|
29
|
+
|
30
|
+
# [EVAL IT] (describe-function 'xmp)
|
31
|
+
|
32
|
+
If you want to add => marks, call comment-dwim twice.
|
33
|
+
|
34
|
+
# [EVAL IT] (describe-function 'comment-dwim)
|
35
|
+
|
36
|
+
method/class/constant completion
|
37
|
+
================================
|
38
|
+
|
39
|
+
# [EVAL IT] (describe-function 'rct-complete-symbol)
|
40
|
+
|
41
|
+
If you use icicles-rcodetools, you can browse RI document for selected candidate
|
42
|
+
by typing C-M-RET. It is wonderful icicles feature!!
|
43
|
+
|
44
|
+
show RI document / jump to the definition
|
45
|
+
=========================================
|
46
|
+
|
47
|
+
# [EVAL IT] (describe-function 'rct-ri)
|
48
|
+
|
49
|
+
By default rct-ri asks for a TAGS file, which is generated by tag generator like rtags.
|
50
|
+
If there is a TAGS file, this command jumps to the definition of current method.
|
51
|
+
If use do not use this feature, evaluate:
|
52
|
+
(setq rct-find-tag-if-available nil)
|
53
|
+
|
54
|
+
# [EVAL IT] (describe-variable 'rct-find-tag-if-available)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
method_analyzer.rb can be used to gather precise information about the exact
|
3
|
+
methods called in your code, allowing you to explore it better with rct-doc
|
4
|
+
(see README.emacs and README.vim for more information). This requires high
|
5
|
+
code coverage, since it can only record such data when the code is executed.
|
6
|
+
|
7
|
+
rct-meth-args can be used to generate fairly complete TAGS files. It operates
|
8
|
+
by loading the specified files and tracking method definitions; therefore, it
|
9
|
+
is meta-programming aware, unlike other implementations.
|
10
|
+
|
11
|
+
You can use them conveniently by adding the code shown in
|
12
|
+
Rakefile.method_analysis to your Rakefile.
|
13
|
+
|
data/README.vim
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
|
2
|
+
Copy rcodetools.vim to your plugin directory (typically $HOME/.vim/plugin) in
|
3
|
+
order to enable accurate code completion, quick RI execution and exact tag
|
4
|
+
jumping.
|
5
|
+
|
6
|
+
Code completion
|
7
|
+
===============
|
8
|
+
rcodetools.vim redefines user-defined completion for Ruby programs, so you can
|
9
|
+
use the intelligent, 100%-accurate completion with <C-X><C-U> in insert mode.
|
10
|
+
Note that this runs the code to obtain the exact candidate list.
|
11
|
+
|
12
|
+
Quick RI documentation and exact tag jumping
|
13
|
+
============================================
|
14
|
+
When you're editing a Ruby file, <C-]> will jump to the definition of the
|
15
|
+
chosen element if found in the TAGS file; otherwise, it will call RI and show
|
16
|
+
the documentation in a new window.
|
17
|
+
You can specify the RI executable to use by adding something like
|
18
|
+
let g:RCT_ri_cmd = "ri -T -f plain "
|
19
|
+
to your .vimrc. (rcodetools.vim also honors b:RCT_RI_cmd and w:RCT_RI_cmd if set).
|
20
|
+
By default, "fri -f plain " will be used. fri (FastRI) is an improved RI
|
21
|
+
documentation browser, which features more intelligent search modes, gem
|
22
|
+
integration, vastly better performance... You can find it at
|
23
|
+
http://eigenclass.org/hiki.rb?fastri and it's also available in gem format
|
24
|
+
gem install fastri
|
25
|
+
|
26
|
+
If you want to call RI for the word the cursor is on (instead of jumping to
|
27
|
+
the definition if found), you can use this binding:
|
28
|
+
<LocalLeader>r (\r by default if you haven't changed your localleader)
|
29
|
+
You can specify another binding in your .vimrc as follows:
|
30
|
+
let g:RCT_ri_binding="<C-X><C-R>" " use ^X^R to call vim on current word
|
31
|
+
|
32
|
+
Using xmpfilter
|
33
|
+
===============
|
34
|
+
xmpfilter takes code from stdin and outputs to stdout so you can filter
|
35
|
+
your code with ! as usual.
|
36
|
+
|
37
|
+
If you use xmpfilter often, you might want to use mappings like the
|
38
|
+
following, which allow you to:
|
39
|
+
* add annotations
|
40
|
+
* expand assertions
|
41
|
+
* insert/remove # => markers
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
" plain annotations
|
46
|
+
map <silent> <F10> !xmpfilter -a<cr>
|
47
|
+
nmap <silent> <F10> V<F10>
|
48
|
+
imap <silent> <F10> <ESC><F10>a
|
49
|
+
|
50
|
+
" Test::Unit assertions; use -s to generate RSpec expectations instead
|
51
|
+
map <silent> <S-F10> !xmpfilter -u<cr>
|
52
|
+
nmap <silent> <S-F10> V<S-F10>
|
53
|
+
imap <silent> <S-F10> <ESC><S-F10>a
|
54
|
+
|
55
|
+
" Annotate the full buffer
|
56
|
+
" I actually prefer ggVG to %; it's a sort of poor man's visual bell
|
57
|
+
nmap <silent> <F11> mzggVG!xmpfilter -a<cr>'z
|
58
|
+
imap <silent> <F11> <ESC><F11>
|
59
|
+
|
60
|
+
" assertions
|
61
|
+
nmap <silent> <S-F11> mzggVG!xmpfilter -u<cr>'z
|
62
|
+
imap <silent> <S-F11> <ESC><S-F11>a
|
63
|
+
|
64
|
+
" Add # => markers
|
65
|
+
vmap <silent> <F12> !xmpfilter -m<cr>
|
66
|
+
nmap <silent> <F12> V<F12>
|
67
|
+
imap <silent> <F12> <ESC><F12>a
|
68
|
+
|
69
|
+
" Remove # => markers
|
70
|
+
vmap <silent> <S-F12> ms:call RemoveRubyEval()<CR>
|
71
|
+
nmap <silent> <S-F12> V<S-F12>
|
72
|
+
imap <silent> <S-F12> <ESC><S-F12>a
|
73
|
+
|
74
|
+
|
75
|
+
function! RemoveRubyEval() range
|
76
|
+
let begv = a:firstline
|
77
|
+
let endv = a:lastline
|
78
|
+
normal Hmt
|
79
|
+
set lz
|
80
|
+
execute ":" . begv . "," . endv . 's/\s*# \(=>\|!!\).*$//e'
|
81
|
+
normal 'tzt`s
|
82
|
+
set nolz
|
83
|
+
redraw
|
84
|
+
endfunction
|
data/README.xmpfilter
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
xmpfilter http://eigenclass.org/hiki.rb?xmpfilter
|
3
|
+
Copyright (c) 2005-2006 Mauricio Fernandez <mfp@acm.org> http://eigenclass.org
|
4
|
+
Use and distribution subject to the terms of the Ruby license.
|
5
|
+
|
6
|
+
Overview
|
7
|
+
========
|
8
|
+
xmpfilter is a small tool that can be used to
|
9
|
+
* generate Test::Unit assertions and RSpec expectations semi-automatically
|
10
|
+
* annotate source code with intermediate results (a bit like irb
|
11
|
+
--simple-prompt but only for the lines explicitly marked with # =>)
|
12
|
+
Very useful for example code (such as postings to ruby-talk).
|
13
|
+
|
14
|
+
Usage
|
15
|
+
=====
|
16
|
+
xmpfilter takes its input from stdin and writes to stdout. It can run in
|
17
|
+
several modes (annotation, Test::Unit assertion expansion, RSpec expectation
|
18
|
+
generation, marker insertion); see
|
19
|
+
xmpfilter -h
|
20
|
+
README.emacs and README.vim describe how to use xmpfilter from your editor.
|
21
|
+
|
22
|
+
Example: code annotation
|
23
|
+
========================
|
24
|
+
Just add "# =>" markers to the lines whose values you want to be shown:
|
25
|
+
|
26
|
+
a, b = "foo", "baz"
|
27
|
+
a + b # =>
|
28
|
+
a.size # =>
|
29
|
+
|
30
|
+
will be expanded to (in one keypress in a decent editor, see README.emacs and
|
31
|
+
README.vim)
|
32
|
+
|
33
|
+
a, b = "foo", "baz"
|
34
|
+
a + b # => "foobaz"
|
35
|
+
a.size # => 3
|
36
|
+
|
37
|
+
This saves much cut&pasting when you're posting to ruby-talk/ruby-core (I use
|
38
|
+
it all the time).
|
39
|
+
|
40
|
+
Example: assertion generation
|
41
|
+
=============================
|
42
|
+
|
43
|
+
xmpfilter can generate assertions based on the current behavior of the code
|
44
|
+
to be tested (iow. the current behavior is assumed to be correct and is used
|
45
|
+
to generate assertions which won't be modified by further runs of
|
46
|
+
xmpfilter), making it quite useful for regression testing.
|
47
|
+
|
48
|
+
Imagine you have a ComplexClass you want to test. You might start with
|
49
|
+
|
50
|
+
class TestComplexClass < Test::Unit::TestCase
|
51
|
+
def setup; @o = ComplexClass.new("foo", false) end
|
52
|
+
end
|
53
|
+
|
54
|
+
and then want to add some tests:
|
55
|
+
|
56
|
+
def test_insertion
|
57
|
+
@o.insert "bar"
|
58
|
+
@o.insert "baz"
|
59
|
+
# ... assertions here
|
60
|
+
end
|
61
|
+
|
62
|
+
At this point, you want to add several assertions to verify that the values
|
63
|
+
returned by @o.size, @o.last, @o.first, @o.complex_computation and @o.last(2)
|
64
|
+
are correct. You can just write the following and feed the file to
|
65
|
+
xmpfilter in -u mode (the # => markers can also be inserted by
|
66
|
+
xmpfilter, see README.vim for more information:
|
67
|
+
|
68
|
+
def test_insertion
|
69
|
+
@o.insert "bar"
|
70
|
+
@o.insert "baz"
|
71
|
+
@o.size # =>
|
72
|
+
@o.last # =>
|
73
|
+
@o.first # =>
|
74
|
+
@o.complex_computation # =>
|
75
|
+
@o.last(2) # =>
|
76
|
+
end
|
77
|
+
|
78
|
+
xmpfilter will run the test and remember what happened in each marked line,
|
79
|
+
and then rewrite the code so that it looks for instance like
|
80
|
+
|
81
|
+
def test_insertion
|
82
|
+
@o.insert "bar"
|
83
|
+
@o.insert "baz"
|
84
|
+
assert_equal(2, @o.size)
|
85
|
+
assert_equal("baz", @o.last)
|
86
|
+
assert_equal("bar", @o.first)
|
87
|
+
assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001)
|
88
|
+
assert_equal(["baz", "bar"], @o.last(2))
|
89
|
+
end
|
90
|
+
|
91
|
+
As you can see, it can save some typing.
|
92
|
+
|
93
|
+
You can edit the generated assertions as you want: xmpfilter will not
|
94
|
+
modify lines without the "# =>" marker. xmpfilter can be used repeatedly as
|
95
|
+
you add more assertions. Imagine you want to verify that @o.last(3) raises an
|
96
|
+
ArgumentError. You can simply add one line marked with # => :
|
97
|
+
|
98
|
+
...
|
99
|
+
assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001)
|
100
|
+
assert_equal(["baz", "bar"], @o.last(2))
|
101
|
+
@o.last(3) # =>
|
102
|
+
end
|
103
|
+
|
104
|
+
and have it expanded by xmpfilter:
|
105
|
+
|
106
|
+
...
|
107
|
+
assert_in_delta(3.14159265358979, @o.complex_computation, 0.0001)
|
108
|
+
assert_equal(["baz", "bar"], @o.last(2))
|
109
|
+
assert_raise(ArgumentError){ @o.last(3) }
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
Example: RSpec expectations
|
114
|
+
===========================
|
115
|
+
Here's some code before and after filtering it with xmpfilter:
|
116
|
+
|
117
|
+
class X
|
118
|
+
Y = Struct.new(:a)
|
119
|
+
def foo(b); b ? Y.new(2) : 2 end
|
120
|
+
def bar; raise "No good" end
|
121
|
+
def baz; nil end
|
122
|
+
def fubar(x); x ** 2.0 + 1 end
|
123
|
+
def babar; [1,2] end
|
124
|
+
A = 1
|
125
|
+
A = 1
|
126
|
+
end
|
127
|
+
|
128
|
+
context "Testing xmpfilter's expectation expansion" do
|
129
|
+
setup do
|
130
|
+
@o = X.new
|
131
|
+
end
|
132
|
+
|
133
|
+
specify "Should expand should_equal expectations" do
|
134
|
+
@o.foo(true) # =>
|
135
|
+
@o.foo(true).a # =>
|
136
|
+
@o.foo(false) # =>
|
137
|
+
end
|
138
|
+
|
139
|
+
specify "Should expand should_raise expectations" do
|
140
|
+
@o.bar # =>
|
141
|
+
end
|
142
|
+
|
143
|
+
specify "Should expand should_be_nil expectations" do
|
144
|
+
@o.baz # =>
|
145
|
+
end
|
146
|
+
|
147
|
+
specify "Should expand correct expectations for complex values" do
|
148
|
+
@o.babar # =>
|
149
|
+
end
|
150
|
+
|
151
|
+
specify "Should expand should_be_close expectations" do
|
152
|
+
@o.fubar(10) # =>
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
after piping it to xmpfilter -s:
|
158
|
+
|
159
|
+
class X
|
160
|
+
Y = Struct.new(:a)
|
161
|
+
def foo(b); b ? Y.new(2) : 2 end
|
162
|
+
def bar; raise "No good" end
|
163
|
+
def baz; nil end
|
164
|
+
def fubar(x); x ** 2.0 + 1 end
|
165
|
+
def babar; [1,2] end
|
166
|
+
A = 1
|
167
|
+
A = 1 # !> already initialized constant A
|
168
|
+
end
|
169
|
+
|
170
|
+
context "Testing xmpfilter's expectation expansion" do
|
171
|
+
setup do
|
172
|
+
@o = X.new
|
173
|
+
end
|
174
|
+
|
175
|
+
specify "Should expand should_equal expectations" do
|
176
|
+
(@o.foo(true)).should_be_a_kind_of X::Y
|
177
|
+
(@o.foo(true).inspect).should_equal "#<struct X::Y a=2>"
|
178
|
+
(@o.foo(true).a).should_equal 2
|
179
|
+
(@o.foo(false)).should_equal 2
|
180
|
+
end
|
181
|
+
|
182
|
+
specify "Should expand should_raise expectations" do
|
183
|
+
lambda{(@o.bar)}.should_raise RuntimeError
|
184
|
+
end
|
185
|
+
|
186
|
+
specify "Should expand should_be_nil expectations" do
|
187
|
+
(@o.baz).should_be_nil
|
188
|
+
end
|
189
|
+
|
190
|
+
specify "Should expand correct expectations for complex values" do
|
191
|
+
(@o.babar).should_equal [1, 2]
|
192
|
+
end
|
193
|
+
|
194
|
+
specify "Should expand should_be_close expectations" do
|
195
|
+
(@o.fubar(10)).should_be_close(101.0, 0.0001)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
License
|
201
|
+
=======
|
202
|
+
xmpfilter is licensed under the same terms as Ruby.
|
data/Rakefile
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
|
2
|
+
PKG_REVISION = ".0"
|
3
|
+
RCT_VERSION = "0.4.0"
|
4
|
+
|
5
|
+
$:.unshift "lib" if File.directory? "lib"
|
6
|
+
require 'rake/testtask'
|
7
|
+
|
8
|
+
desc "Run the unit tests in pure-Ruby mode ."
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << "ext/rcovrt"
|
11
|
+
t.test_files = FileList['test/test*.rb']
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
|
15
|
+
require 'rcov/rcovtask'
|
16
|
+
desc "Run rcov."
|
17
|
+
Rcov::RcovTask.new do |t|
|
18
|
+
t.rcov_opts << "--xrefs" # comment to disable cross-references
|
19
|
+
t.test_files = FileList['test/test_*.rb'].to_a - ["test/test_functional.rb"]
|
20
|
+
t.verbose = true
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Save current coverage state for later comparisons."
|
24
|
+
Rcov::RcovTask.new(:rcovsave) do |t|
|
25
|
+
t.rcov_opts << "--save"
|
26
|
+
t.test_files = FileList['test/test_*.rb'].to_a - ["test/test_functional.rb"]
|
27
|
+
t.verbose = true
|
28
|
+
end
|
29
|
+
|
30
|
+
task :default => :test
|
31
|
+
|
32
|
+
## test data file dependency
|
33
|
+
basetestfiles = []
|
34
|
+
copy = lambda do |t|
|
35
|
+
cp t.prerequisites.first, t.name
|
36
|
+
end
|
37
|
+
|
38
|
+
# DO NOT EDIT!! EDITABLE
|
39
|
+
[ ["test/data/rspec_poetry-input.rb", "test/data/rspec-input.rb"],
|
40
|
+
["test/data/unit_test_poetry-input.rb", "test/data/unit_test-input.rb"],
|
41
|
+
["test/data/completion_emacs-input.rb", "test/data/completion-input.rb"]
|
42
|
+
].each do |outfile, infile|
|
43
|
+
basetestfiles << outfile
|
44
|
+
file(outfile => infile, ©)
|
45
|
+
end
|
46
|
+
for test in %w[refe ri ri_emacs ri_vim]
|
47
|
+
outfile = "test/data/#{test}-input.rb"
|
48
|
+
basetestfiles << outfile
|
49
|
+
file(outfile => "test/data/doc-input.rb", ©)
|
50
|
+
end
|
51
|
+
task :base_update => basetestfiles
|
52
|
+
task :test => :base_update
|
53
|
+
task :rcov => :base_update
|
54
|
+
|
55
|
+
#{{{ Package tasks
|
56
|
+
PKG_FILES = FileList[
|
57
|
+
"bin/rct-complete", "bin/rct-doc", "bin/xmpfilter", "bin/rct-meth-args",
|
58
|
+
"lib/**/*.rb",
|
59
|
+
"CHANGES", "rcodetools.*", "icicles-rcodetools.el", "README", "README.*", "THANKS",
|
60
|
+
"Rakefile", "Rakefile.method_analysis",
|
61
|
+
"setup.rb",
|
62
|
+
"test/**/*.rb",
|
63
|
+
]
|
64
|
+
|
65
|
+
begin
|
66
|
+
require 'rake/gempackagetask'
|
67
|
+
Spec = Gem::Specification.new do |s|
|
68
|
+
s.name = "rcodetools"
|
69
|
+
s.version = RCT_VERSION + PKG_REVISION
|
70
|
+
s.summary = "rcodetools is a collection of Ruby code manipulation tools"
|
71
|
+
s.description = <<EOF
|
72
|
+
rcodetools is a collection of Ruby code manipulation tools.
|
73
|
+
It includes xmpfilter and editor-independent Ruby development helper tools,
|
74
|
+
as well as emacs and vim interfaces.
|
75
|
+
|
76
|
+
Currently, rcodetools comprises:
|
77
|
+
* xmpfilter: Automagic Test::Unit assertions/RSpec expectations and code annotations
|
78
|
+
* rct-complete: Accurate method/class/constant etc. completions
|
79
|
+
* rct-doc: Document browsing and code navigator
|
80
|
+
* rct-meth-args: Precise method info (meta-prog. aware) and TAGS generation
|
81
|
+
EOF
|
82
|
+
s.files = PKG_FILES.to_a
|
83
|
+
s.require_path = 'lib'
|
84
|
+
s.author = "rubikitch and Mauricio Fernandez"
|
85
|
+
s.email = %{"rubikitch" <rubikitch@ruby-lang.org>, "Mauricio Fernandez" <mfp@acm.org>}
|
86
|
+
s.homepage = "http://eigenclass.org/hiki.rb?rcodetools"
|
87
|
+
s.bindir = "bin"
|
88
|
+
s.executables = %w[rct-complete rct-doc xmpfilter rct-meth-args]
|
89
|
+
s.has_rdoc = true
|
90
|
+
s.extra_rdoc_files = %w[README]
|
91
|
+
s.rdoc_options << "--main" << "README" << "--title" << 'rcodetools'
|
92
|
+
s.test_files = Dir["test/test_*.rb"]
|
93
|
+
s.post_install_message = <<EOF
|
94
|
+
|
95
|
+
==============================================================================
|
96
|
+
|
97
|
+
rcodetools will work better if you use it along with FastRI, an alternative to
|
98
|
+
the standard 'ri' documentation browser which features intelligent searching,
|
99
|
+
better RubyGems integration, vastly improved performance, remote queries via
|
100
|
+
DRb... You can find it at http://eigenclass.org/hiki.rb?fastri and it is also
|
101
|
+
available in RubyGems format:
|
102
|
+
|
103
|
+
gem install fastri
|
104
|
+
|
105
|
+
Read README.emacs and README.vim for information on how to integrate
|
106
|
+
rcodetools in your editor.
|
107
|
+
|
108
|
+
==============================================================================
|
109
|
+
|
110
|
+
EOF
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
task :gem => [:test]
|
115
|
+
Rake::GemPackageTask.new(Spec) do |p|
|
116
|
+
#p.need_tar = true
|
117
|
+
end
|
118
|
+
|
119
|
+
rescue LoadError
|
120
|
+
# RubyGems not installed
|
121
|
+
end
|
122
|
+
|
123
|
+
# vim: set sw=2 ft=ruby:
|