looksee 1.0.0-universal-java-1.6 → 1.0.1-universal-java-1.6

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
data/ext/extconf.rb CHANGED
@@ -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'
data/ext/mri/mri.c CHANGED
@@ -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
data/spec/adapter_spec.rb CHANGED
@@ -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
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ ENV['LOOKSEE_METHODS'] = nil
2
+
1
3
  require 'rspec'
2
4
  require 'mocha'
3
5
  require 'looksee'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: universal-java-1.6
11
11
  authors:
12
12
  - George Ogata
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-09 00:00:00 -05:00
17
+ date: 2011-03-15 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -22,13 +22,13 @@ dependencies:
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "="
26
26
  - !ruby/object:Gem::Version
27
27
  segments:
28
28
  - 0
29
29
  - 2
30
- - 0
31
- version: 0.2.0
30
+ - 1
31
+ version: 0.2.1
32
32
  type: :development
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
@@ -36,13 +36,13 @@ dependencies:
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "="
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
42
  - 2
43
+ - 5
43
44
  - 0
44
- - 0
45
- version: 2.0.0
45
+ version: 2.5.0
46
46
  type: :development
47
47
  version_requirements: *id002
48
48
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,6 @@ files:
91
91
  - lib/looksee/inspector.rb
92
92
  - lib/looksee/jruby.jar
93
93
  - lib/looksee/lookup_path.rb
94
- - lib/looksee/rbx.bundle
95
94
  - lib/looksee/shortcuts.rb
96
95
  - lib/looksee/version.rb
97
96
  - lib/looksee/wirble_compatibility.rb
Binary file