looksee 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.0.1 2011-03-15
2
+
3
+ * Fix bug exception when trying to edit a primitive method on MRI.
4
+ * Allow customizing the method names added to every object. Either:
5
+ * Call Looksee(:ls => new_name, :edit => new_name)
6
+ * Set LOOKSEE_METHODS='ls=new_name edit=new_name' in your environment.
7
+
1
8
  == 1.0.0 2011-03-09
2
9
 
3
10
  * New API.
data/Rakefile CHANGED
@@ -1,10 +1,9 @@
1
1
  require 'ritual'
2
2
 
3
- case (Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'ruby')
4
- when 'ruby'
5
- extension :mri
6
- when 'rbx'
7
- extension :rbx
8
- when 'jruby'
3
+ ruby_engine = (Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'ruby')
4
+ if ruby_engine == 'jruby'
9
5
  extension :jruby, :type => :jruby
6
+ else
7
+ name = ruby_engine == 'ruby' ? 'mri' : ruby_engine
8
+ extension :build_as => "ext/#{name}", :install_as => "lib/looksee/#{name}"
10
9
  end
@@ -1,4 +1,4 @@
1
- ruby_engine = Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'mri'
1
+ ruby_engine = Object.const_defined?(:RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
2
2
  extension = ruby_engine == 'ruby' ? 'mri' : ruby_engine
3
3
 
4
4
  require 'mkmf'
@@ -236,7 +236,7 @@ VALUE Looksee_source_location(VALUE self, VALUE unbound_method) {
236
236
  }
237
237
  break;
238
238
  default:
239
- rb_raise(rb_eRuntimeError, "[LOOKSEE BUG] unexpected NODE type: %d", nd_type(method->body));
239
+ return Qnil;
240
240
  }
241
241
  VALUE file = rb_str_new2(node->nd_file);
242
242
  VALUE line = INT2NUM(nd_line(node));
@@ -53,6 +53,26 @@ module Looksee
53
53
  def edit(name)
54
54
  Editor.new(Looksee.editor).edit(self, name)
55
55
  end
56
+
57
+ def self.rename(renamings) # :nodoc:
58
+ renamings.each do |old_name, new_name|
59
+ alias_method new_name, old_name
60
+ remove_method old_name
61
+ end
62
+ end
63
+ end
64
+
65
+ #
66
+ # Rename the methods added to every object. Example:
67
+ #
68
+ # rename :ls => :_ls, :edit => :_edit
69
+ #
70
+ def self.rename(renamings)
71
+ ObjectMixin.rename(renamings)
72
+ end
73
+
74
+ (ENV['LOOKSEE_METHODS'] || '').scan(/([\w_]+)=([\w_]+)/) do
75
+ rename $1.to_sym => $2.to_sym
56
76
  end
57
77
 
58
78
  Object.send :include, ObjectMixin
Binary file
@@ -1,5 +1,5 @@
1
1
  module Looksee
2
- VERSION = [1, 0, 0]
2
+ VERSION = [1, 0, 1]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -439,7 +439,7 @@ describe "Looksee.adapter" do
439
439
  end
440
440
 
441
441
  after do
442
- FileUtils.rm_rf @tmp
442
+ FileUtils.rm_rf @tmp if @tmp
443
443
  Object.send(:remove_const, :C) if Object.const_defined?(:C)
444
444
  end
445
445
 
@@ -531,6 +531,11 @@ describe "Looksee.adapter" do
531
531
  @adapter.source_location(method).should == [path, 2]
532
532
  end
533
533
 
534
+ it "should return nil for primitive methods (MRI CBODY)" do
535
+ method = Object.instance_method(:__id__)
536
+ @adapter.source_location(method).should == nil
537
+ end
538
+
534
539
  it "should raise a TypeError if the argument is not an UnboundMethod" do
535
540
  path = load_source <<-EOS.demargin
536
541
  |class C
@@ -1,3 +1,5 @@
1
+ ENV['LOOKSEE_METHODS'] = nil
2
+
1
3
  require 'rspec'
2
4
  require 'mocha'
3
5
  require 'looksee'
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: looksee
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.0.0
4
+ hash: 21
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 1
10
+ version: 1.0.1
6
11
  platform: ruby
7
12
  authors:
8
13
  - George Ogata
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-03-09 00:00:00 -05:00
18
+ date: 2011-03-15 00:00:00 -04:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -19,9 +24,14 @@ dependencies:
19
24
  requirement: &id001 !ruby/object:Gem::Requirement
20
25
  none: false
21
26
  requirements:
22
- - - ">="
27
+ - - "="
23
28
  - !ruby/object:Gem::Version
24
- version: 0.2.0
29
+ hash: 21
30
+ segments:
31
+ - 0
32
+ - 2
33
+ - 1
34
+ version: 0.2.1
25
35
  type: :development
26
36
  version_requirements: *id001
27
37
  - !ruby/object:Gem::Dependency
@@ -30,9 +40,14 @@ dependencies:
30
40
  requirement: &id002 !ruby/object:Gem::Requirement
31
41
  none: false
32
42
  requirements:
33
- - - ">="
43
+ - - "="
34
44
  - !ruby/object:Gem::Version
35
- version: 2.0.0
45
+ hash: 27
46
+ segments:
47
+ - 2
48
+ - 5
49
+ - 0
50
+ version: 2.5.0
36
51
  type: :development
37
52
  version_requirements: *id002
38
53
  - !ruby/object:Gem::Dependency
@@ -43,6 +58,9 @@ dependencies:
43
58
  requirements:
44
59
  - - ">="
45
60
  - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
46
64
  version: "0"
47
65
  type: :development
48
66
  version_requirements: *id003
@@ -54,6 +72,9 @@ dependencies:
54
72
  requirements:
55
73
  - - ">="
56
74
  - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
57
78
  version: "0"
58
79
  type: :development
59
80
  version_requirements: *id004
@@ -78,8 +99,8 @@ files:
78
99
  - lib/looksee/editor.rb
79
100
  - lib/looksee/help.rb
80
101
  - lib/looksee/inspector.rb
102
+ - lib/looksee/jruby.jar
81
103
  - lib/looksee/lookup_path.rb
82
- - lib/looksee/rbx.bundle
83
104
  - lib/looksee/shortcuts.rb
84
105
  - lib/looksee/version.rb
85
106
  - lib/looksee/wirble_compatibility.rb
@@ -126,17 +147,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
147
  requirements:
127
148
  - - ">="
128
149
  - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
129
153
  version: "0"
130
154
  required_rubygems_version: !ruby/object:Gem::Requirement
131
155
  none: false
132
156
  requirements:
133
157
  - - ">="
134
158
  - !ruby/object:Gem::Version
159
+ hash: 3
160
+ segments:
161
+ - 0
135
162
  version: "0"
136
163
  requirements: []
137
164
 
138
165
  rubyforge_project:
139
- rubygems_version: 1.5.2
166
+ rubygems_version: 1.3.7
140
167
  signing_key:
141
168
  specification_version: 3
142
169
  summary: Supercharged method introspection in IRB.
Binary file