ride 0.4.1 → 0.4.2

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/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.4.2 2008-10-14
2
+
3
+ * 2 major enhancements:
4
+ * Fixed bug with rails irb loading when RAILS_GEM_VERSION is different from installed rails
5
+ * added StandardError#message_filters and StandardError#backtrace_filters to _not_ open
6
+ vim for certain messages or backtrace matches
7
+
8
+ TODO: Expose a method for adding filters
9
+
1
10
  == 0.4.1 2008-10-14
2
11
 
3
12
  * 2 major enhancements:
@@ -2,7 +2,7 @@ fun! LoadRubyTmp()
2
2
  let b:fname = substitute(expand("%"), "/", "{slash}", "g")
3
3
  let b:filename = "/tmp/ride." . $STY . "->" . $WINDOW . "->" . b:fname
4
4
  " echo b:filename
5
- execute "write " . b:filename
5
+ execute "write! " . b:filename
6
6
  call system("screen -p 1 -X stuff \"load " . '\"' . b:filename . '\"' . "\n\"")
7
7
  call system("screen -X select 1")
8
8
  endfun
@@ -1,3 +1,12 @@
1
+ == 0.4.2 2008-10-14
2
+
3
+ * 2 major enhancements:
4
+ * Fixed bug with rails irb loading when RAILS_GEM_VERSION is different from installed rails
5
+ * added StandardError#message_filters and StandardError#backtrace_filters to _not_ open
6
+ vim for certain messages or backtrace matches
7
+
8
+ TODO: Expose a method for adding filters
9
+
1
10
  == 0.4.1 2008-10-14
2
11
 
3
12
  * 2 major enhancements:
data/lib/ride/version.rb CHANGED
@@ -2,7 +2,7 @@ module Ride
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/ride.rb CHANGED
@@ -2,4 +2,3 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
  module Ride
4
4
  end
5
-
data/lib/std_err_hooks.rb CHANGED
@@ -1,21 +1,31 @@
1
1
  # This hooks into standard error to open backtraces in vim
2
2
  class StandardError
3
3
  alias _backtrace backtrace
4
+ def message_is_filtered?
5
+ matches = message_filters.detect do |message_filter|
6
+ [self.class, message].join(": ").match message_filter
7
+ end
8
+ puts "#{message} Matched #{matches.inspect}" if matches
9
+ matches ? true : false
10
+ end
11
+
4
12
  def backtrace
5
13
  old = _backtrace
6
14
  @old_backtrace ||= nil
7
15
  if old.kind_of?(Array) and @old_backtrace.nil?
8
- open_vims(old)
16
+ open_vims(old) unless message_is_filtered?
9
17
  @old_backtrace = true
10
18
  end
11
19
  old
12
20
  end
13
21
 
14
22
  def open_vims(lines)
15
- good_lines = lines.select { |l| l.match(/^[\/\w][^:\s]*:\d+(?::.*)?$/) }.map do |line|
23
+ good_lines = lines.select { |l| l.match(/^[.\/\w][^:\s]*:\d+(?::.*)?$/) }.map do |line|
24
+ next if backtrace_filters.detect { |n| line.match n }
16
25
  file, line_number, rest = line.split(":")
17
26
  [file, line_number]
18
- end.uniq
27
+ end.compact.uniq
28
+ return if good_lines.size == 0
19
29
  file, line = good_lines.shift
20
30
  if file.match("->")
21
31
  window = file.split("->")[1]
@@ -35,4 +45,18 @@ class StandardError
35
45
  =end
36
46
  %x{screen -X #{s}}
37
47
  end
48
+
49
+ # Don't run the backtrace file opener if the exception matches this
50
+ def backtrace_filters
51
+ [
52
+ "rubygems.rb:\d+:in `activate",
53
+ "/irb/workspace.rb"
54
+ ]
55
+ end
56
+
57
+ def message_filters
58
+ [
59
+ "Gem::Exception: can't activate"
60
+ ]
61
+ end
38
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ride
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Vanderpoel