rcodetools 0.8.1.0 → 0.8.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,9 @@
1
1
  rcodetools history
2
2
  ==================
3
+ User-visible changes since 0.8.0
4
+ --------------------------------
5
+ * xmpfilter: fixed multi-line annotation bugs
6
+
3
7
  User-visible changes since 0.7.0
4
8
  --------------------------------
5
9
  * Support Ruby 1.9!
@@ -121,7 +121,7 @@
121
121
  . (lambda ()
122
122
  (let ((case-fold-search nil)
123
123
  (re (format "[:#.]%s" (with-current-buffer anything-current-buffer
124
- (symbol-at-point)))))
124
+ (regexp-quote (or (thing-at-point 'symbol) ""))))))
125
125
  (remove-if-not
126
126
  (lambda (meth) (string-match re meth))
127
127
  rct-all-methods))))
@@ -1,4 +1,4 @@
1
- #! /usr/local/bin/ruby
1
+ #! /pkgs/ruby18/bin/ruby18
2
2
  require 'rcodetools/xmpfilter'
3
3
  require 'rcodetools/completion'
4
4
  require 'rcodetools/options'
@@ -1,4 +1,4 @@
1
- #! /usr/local/bin/ruby
1
+ #! /pkgs/ruby18/bin/ruby18
2
2
  require 'rcodetools/xmpfilter'
3
3
  require 'rcodetools/doc'
4
4
  require 'rcodetools/options'
@@ -1,4 +1,4 @@
1
- #! /usr/local/bin/ruby
1
+ #! /pkgs/ruby18/bin/ruby18
2
2
  # Copyright (c)
3
3
  # 2006-2007 Mauricio Fernandez <mfp@acm.org> http://eigenclass.org
4
4
  # 2006-2007 rubikitch <rubikitch@ruby-lang.org> http://www.rubyist.net/~rubikitch/
@@ -1,4 +1,4 @@
1
- #! /usr/local/bin/ruby
1
+ #! /pkgs/ruby18/bin/ruby18
2
2
  require 'rcodetools/xmpfilter'
3
3
  require 'rcodetools/options'
4
4
 
@@ -11,7 +11,7 @@ require 'tmpdir'
11
11
  module Rcodetools
12
12
 
13
13
  class XMPFilter
14
- VERSION = "0.8.1"
14
+ VERSION = "0.8.2"
15
15
 
16
16
  MARKER = "!XMP#{Time.new.to_i}_#{Process.pid}_#{rand(1000000)}!"
17
17
  XMP_RE = Regexp.new("^" + Regexp.escape(MARKER) + '\[([0-9]+)\] (=>|~>|==>) (.*)')
@@ -125,6 +125,7 @@ class XMPFilter
125
125
  MULTI_LINE_RE = /^(.*)\n(( *)# ?=>.*(?:\n|\z))(?: *# .*\n)*/
126
126
  def annotate(code)
127
127
  idx = 0
128
+ code = code.gsub(/ # !>.*/, '')
128
129
  newcode = code.gsub(SINGLE_LINE_RE){ prepare_line($1, idx += 1) }
129
130
  newcode.gsub!(MULTI_LINE_RE){ prepare_line($1, idx += 1, true)}
130
131
  File.open(@dump, "w"){|f| f.puts newcode} if @dump
@@ -159,7 +160,7 @@ class XMPFilter
159
160
  def annotated_multi_line(line, expression, indent, runtime_data, idx)
160
161
  pretty = (runtime_data.results[idx].map{|x| x[1]} || []).join(", ")
161
162
  first, *rest = pretty.to_a
162
- rest.inject("#{expression}\n#{indent}# => #{first}") {|s, l| s << "#{indent}# " << l }
163
+ rest.inject("#{expression}\n#{indent}# => #{first || "\n"}") {|s, l| s << "#{indent}# " << l }
163
164
  end
164
165
 
165
166
  def prepare_line_annotation(expr, idx, multi_line=false)
@@ -65,8 +65,8 @@
65
65
  (shell-command
66
66
  (rct-debuglog (format "%s %s > %s" command input-rb output-rb))
67
67
  t " *rct-error*")
68
- (and buffer (set-buffer buffer))
69
- (insert-file-contents output-rb nil nil nil t)
68
+ (with-current-buffer (or buffer (current-buffer))
69
+ (insert-file-contents output-rb nil nil nil t))
70
70
  (delete-file input-rb)
71
71
  (delete-file output-rb)))
72
72
 
@@ -170,8 +170,10 @@ See also `rct-interactive'."
170
170
  ""
171
171
  (let ((test-buf (rct-find-test-script-buffer))
172
172
  (bfn buffer-file-name)
173
- t-opt test-filename)
174
- (if test-buf
173
+ bfn2 t-opt test-filename)
174
+ (if (and test-buf
175
+ (setq bfn2 (buffer-local-value 'buffer-file-name test-buf))
176
+ (file-exists-p bfn2))
175
177
  ;; pass test script's filename and lineno
176
178
  (with-current-buffer test-buf
177
179
  (setq t-opt (format "%s@%s" buffer-file-name (rct-current-line)))
@@ -241,11 +243,24 @@ Rct-fork makes xmpfilter and completion MUCH FASTER because it pre-loads heavy l
241
243
  When rct-fork is running, the mode-line indicates it to avoid unnecessary run.
242
244
  To kill rct-fork process, use \\[rct-fork-kill].
243
245
  "
244
- (interactive "srct-fork options (-e CODE -I LIBDIR -r LIB): ")
246
+ (interactive (list
247
+ (read-string "rct-fork options (-e CODE -I LIBDIR -r LIB): "
248
+ (rct-fork-default-options))))
245
249
  (rct-fork-kill)
246
250
  (rct-fork-minor-mode 1)
247
251
  (start-process-shell-command
248
252
  "rct-fork" "*rct-fork*" rct-fork-command-name options))
253
+
254
+ (defun rct-fork-default-options ()
255
+ "Default options for rct-fork by collecting requires."
256
+ (mapconcat
257
+ (lambda (lib) (format "-r %s" lib))
258
+ (save-excursion
259
+ (goto-char (point-min))
260
+ (loop while (re-search-forward "\\<require\\> ['\"]\\([^'\"]+\\)['\"]" nil t)
261
+ collect (match-string-no-properties 1)))
262
+ " "))
263
+
249
264
  (defun rct-fork-kill ()
250
265
  "Kill rct-fork process invoked by \\[rct-fork]."
251
266
  (interactive)
Binary file
@@ -0,0 +1,12 @@
1
+ ==========
2
+ multi_line_annotation_6
3
+ ==========
4
+ xmpfilter
5
+ ==========
6
+
7
+ 1 + 2 # !> warning
8
+ # =>
9
+ ==========
10
+
11
+ 1 + 2
12
+ # => 3
@@ -0,0 +1,23 @@
1
+ ==========
2
+ multi_line_annotation_7
3
+ ==========
4
+ xmpfilter
5
+ ==========
6
+
7
+ [1,2]
8
+ # =>
9
+ raise
10
+ [3,4]
11
+ # =>
12
+ [5,6]
13
+ # =>
14
+ ==========
15
+
16
+ [1,2]
17
+ # => [1, 2]
18
+ raise
19
+ [3,4]
20
+ # =>
21
+ [5,6]
22
+ # =>
23
+ # ~> -:2: unhandled exception
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcodetools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.0
4
+ version: 0.8.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubikitch and Mauricio Fernandez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-17 00:00:00 +09:00
12
+ date: 2009-04-03 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -157,6 +157,7 @@ files:
157
157
  - test/data/xmpfilter/unit_test_detect_rbtest2.taf
158
158
  - test/data/xmpfilter/bindings.taf
159
159
  - test/data/xmpfilter/multi_line_annotation_4.taf
160
+ - test/data/xmpfilter/multi_line_annotation_7.taf
160
161
  - test/data/xmpfilter/unit_test.taf
161
162
  - test/data/xmpfilter/unit_test_rbtest.taf
162
163
  - test/data/xmpfilter/unit_test_poetry.taf
@@ -165,6 +166,7 @@ files:
165
166
  - test/data/xmpfilter/last_match.taf
166
167
  - test/data/xmpfilter/nospace.taf
167
168
  - test/data/xmpfilter/simple_annotation.taf
169
+ - test/data/xmpfilter/multi_line_annotation_6.taf
168
170
  - test/data/xmpfilter/unit_test_detect_rbtest.taf
169
171
  - test/data/xmpfilter/multi_line_annotation_3.taf
170
172
  - test/data/xmpfilter/rspec.taf
@@ -213,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
215
  requirements: []
214
216
 
215
217
  rubyforge_project:
216
- rubygems_version: 1.2.0
218
+ rubygems_version: 1.3.1
217
219
  signing_key:
218
220
  specification_version: 2
219
221
  summary: rcodetools is a collection of Ruby code manipulation tools