looksee 1.0.3-universal-java-1.6 → 2.0.0-universal-java-1.6
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.
- checksums.yaml +7 -0
- data/CHANGELOG +20 -0
- data/README.markdown +79 -88
- data/Rakefile +4 -0
- data/ext/extconf.rb +5 -1
- data/ext/mri/1.9.3/internal_falcon.h +248 -0
- data/ext/mri/2.0.0/internal.h +378 -0
- data/ext/mri/2.0.0/method.h +138 -0
- data/ext/mri/2.1.0/internal.h +889 -0
- data/ext/mri/2.1.0/method.h +142 -0
- data/ext/mri/mri.c +36 -5
- data/lib/looksee/JRuby.jar +0 -0
- data/lib/looksee/adapter/rubinius.rb +10 -5
- data/lib/looksee/clean.rb +4 -0
- data/lib/looksee/core_ext.rb +17 -24
- data/lib/looksee/editor.rb +8 -2
- data/lib/looksee/help.rb +1 -1
- data/lib/looksee/inspector.rb +15 -0
- data/lib/looksee/version.rb +1 -1
- data/spec/adapter_spec.rb +13 -7
- data/spec/editor_spec.rb +75 -93
- data/spec/spec_helper.rb +3 -7
- data/spec/support/temporary_classes.rb +1 -25
- data/spec/wirble_compatibility_spec.rb +2 -3
- metadata +104 -141
data/spec/editor_spec.rb
CHANGED
@@ -1,128 +1,110 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Looksee::Editor do
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
describe "#command_for" do
|
5
|
+
def editor_command(command)
|
6
|
+
Looksee::Editor.new(command).command_for('FILE', 'LINE')
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
it "should infer the file and line arguments for 'vi'" do
|
10
|
+
editor_command('vi').should == ['vi', '+LINE', 'FILE']
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
it "should infer the file and line arguments for 'vim'" do
|
14
|
+
editor_command('vim').should == ['vim', '+LINE', 'FILE']
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
it "should infer the file and line arguments for 'gvim'" do
|
18
|
+
editor_command('gvim').should == ['gvim', '+LINE', 'FILE']
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
it "should infer the file and line arguments for 'emacs'" do
|
22
|
+
editor_command('emacs').should == ['emacs', '+LINE', 'FILE']
|
23
|
+
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
it "should infer the file and line arguments for 'xemacs'" do
|
26
|
+
editor_command('xemacs').should == ['xemacs', '+LINE', 'FILE']
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
it "should infer the file and line arguments for 'aquamacs'" do
|
30
|
+
editor_command('aquamacs').should == ['aquamacs', '+LINE', 'FILE']
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
it "should infer the file and line arguments for 'pico'" do
|
34
|
+
editor_command('pico').should == ['pico', '+LINE', 'FILE']
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
it "should infer the file and line arguments for 'nano'" do
|
38
|
+
editor_command('nano').should == ['nano', '+LINE', 'FILE']
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
it "should infer the file and line arguments for 'mate'" do
|
42
|
+
editor_command('mate').should == ['mate', '-lLINE', 'FILE']
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
it "should support escaped '%'-signs" do
|
46
|
+
editor_command('%% %f %l').should == ['%', 'FILE', 'LINE']
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
it "should not infer file and line arguments for unknown editors" do
|
50
|
+
editor_command('wtfbbq').should == ['wtfbbq']
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
describe "#edit" do
|
53
|
-
|
55
|
+
let(:tmp) { "#{ROOT}/spec/tmp" }
|
56
|
+
let(:editor_path) { "#{tmp}/edit" }
|
57
|
+
let(:editor_output) { "#{tmp}/edit.out" }
|
58
|
+
let(:editor) { Looksee::Editor.new("#{editor_path} %f %l") }
|
59
|
+
let(:editor_invocation) { File.exist?(editor_output) ? File.read(editor_output) : nil }
|
60
|
+
let(:source_location) { ["#{tmp}/c.rb", 2] }
|
61
|
+
let(:object) { C.new }
|
54
62
|
|
55
63
|
before do
|
56
|
-
FileUtils.mkdir_p
|
57
|
-
|
58
|
-
|
64
|
+
FileUtils.mkdir_p tmp
|
65
|
+
set_up_editor
|
66
|
+
|
67
|
+
file, line = *source_location
|
68
|
+
FileUtils.touch file
|
69
|
+
Object.const_set(:C, Class.new { def f; end })
|
70
|
+
Looksee.adapter.set_methods(C, [:f], [], [], [])
|
71
|
+
Looksee.adapter.set_source_location(C, :f, source_location)
|
72
|
+
Looksee.adapter.ancestors[object] = [C, Object]
|
59
73
|
end
|
60
74
|
|
61
75
|
after do
|
62
|
-
|
76
|
+
Object.send(:remove_const, :C)
|
77
|
+
FileUtils.rm_rf tmp
|
63
78
|
end
|
64
79
|
|
65
|
-
def
|
66
|
-
open(
|
80
|
+
def set_up_editor
|
81
|
+
open(editor_path, 'w') { |f| f.puts <<-EOS.demargin }
|
67
82
|
|#!/bin/sh
|
68
|
-
|echo $# $1 $2 > "#{
|
83
|
+
|echo $# $1 $2 > "#{editor_output}"
|
69
84
|
EOS
|
70
|
-
File.chmod 0755,
|
85
|
+
File.chmod 0755, editor_path
|
71
86
|
end
|
72
87
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|class C
|
77
|
-
| def f
|
78
|
-
| end
|
79
|
-
|end
|
80
|
-
EOS
|
81
|
-
begin
|
82
|
-
load path
|
83
|
-
Looksee.adapter.set_methods(C, [:f], [], [], [])
|
84
|
-
yield path
|
85
|
-
ensure
|
86
|
-
Object.send(:remove_const, :C)
|
87
|
-
end
|
88
|
+
it "should run the editor on the method's source location if available" do
|
89
|
+
editor.edit(object, :f)
|
90
|
+
editor_invocation.should == "2 #{source_location.join(' ')}\n"
|
88
91
|
end
|
89
92
|
|
90
|
-
it "should run the editor
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
it "should not run the editor if the source file does not exist" do
|
101
|
-
with_source_file do |path|
|
102
|
-
FileUtils.rm_f path
|
103
|
-
@editor.edit(C.new, :f)
|
104
|
-
File.should_not exist("#{TMP}/editor.out")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
it "should not run the editor for methods defined with eval where no source file specified" do
|
109
|
-
eval <<-EOS.demargin
|
110
|
-
|class ::C
|
111
|
-
| def f
|
112
|
-
| end
|
113
|
-
|end
|
114
|
-
EOS
|
115
|
-
begin
|
116
|
-
@editor.edit(C.new, :f)
|
117
|
-
File.should_not exist("#{TMP}/editor.out")
|
118
|
-
ensure
|
119
|
-
Object.send(:remove_const, :C)
|
120
|
-
end
|
93
|
+
it "should raise NoMethodError and not run the editor if the method does not exist" do
|
94
|
+
expect { editor.edit(object, :x) }.to raise_error(Looksee::NoMethodError)
|
95
|
+
editor_invocation.should be_nil
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should raise NoSourceFileError and not run the editor if the source file does not exist" do
|
99
|
+
FileUtils.rm_f source_location.first
|
100
|
+
expect { editor.edit(object, :f) }.to raise_error(Looksee::NoSourceFileError)
|
101
|
+
editor_invocation.should be_nil
|
121
102
|
end
|
122
103
|
|
123
|
-
it "should not run the editor
|
124
|
-
|
125
|
-
|
104
|
+
it "should raise NoSourceLocationError and not run the editor if no source location is available" do
|
105
|
+
Looksee.adapter.set_source_location(C, :f, nil)
|
106
|
+
expect { editor.edit(object, :f) }.to raise_error(Looksee::NoSourceLocationError)
|
107
|
+
editor_invocation.should be_nil
|
126
108
|
end
|
127
109
|
end
|
128
110
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
$:.unshift File.expand_path('..', File.dirname(__FILE__))
|
2
|
+
ENV['LOOKSEE_METHOD'] = nil
|
2
3
|
|
3
4
|
require 'rspec'
|
4
5
|
require 'looksee'
|
@@ -7,7 +8,7 @@ require 'rbconfig'
|
|
7
8
|
require 'set'
|
8
9
|
require 'fileutils'
|
9
10
|
|
10
|
-
ROOT = File.
|
11
|
+
ROOT = File.expand_path('..', File.dirname(__FILE__))
|
11
12
|
|
12
13
|
Dir['spec/support/*.rb'].each do |path|
|
13
14
|
require path
|
@@ -18,8 +19,3 @@ NATIVE_ADAPTER = Looksee.adapter
|
|
18
19
|
RSpec.configure do |config|
|
19
20
|
config.before { Looksee.adapter = TestAdapter.new }
|
20
21
|
end
|
21
|
-
|
22
|
-
if Looksee.ruby_engine == 'jruby'
|
23
|
-
require 'jruby'
|
24
|
-
JRuby.objectspace = true
|
25
|
-
end
|
@@ -42,29 +42,6 @@ module TemporaryClasses
|
|
42
42
|
mod
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
46
|
-
# Remove all methods defined exactly on the given module.
|
47
|
-
#
|
48
|
-
# As Ruby's reflection on singleton classes of classes isn't quite
|
49
|
-
# adequate, you need to provide a :class_singleton option when such
|
50
|
-
# a class is given.
|
51
|
-
#
|
52
|
-
def remove_methods(mod, opts={})
|
53
|
-
names = all_instance_methods(mod)
|
54
|
-
|
55
|
-
# all_instance_methods can't get just the methods on a class
|
56
|
-
# singleton class. Filter out superclass methods here.
|
57
|
-
if opts[:class_singleton]
|
58
|
-
klass = ObjectSpace.each_object(mod){|klass| break klass}
|
59
|
-
names -= all_instance_methods(klass.superclass.singleton_class)
|
60
|
-
end
|
61
|
-
|
62
|
-
names.sort_by{|name| name.in?([:remove_method, :send]) ? 1 : 0}.flatten
|
63
|
-
names.each do |name|
|
64
|
-
mod.send :remove_method, name
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
45
|
#
|
69
46
|
# Replace the methods of the given module with those named.
|
70
47
|
#
|
@@ -78,8 +55,7 @@ module TemporaryClasses
|
|
78
55
|
#
|
79
56
|
# replace_methods MyClass, :public => [:a, :b]
|
80
57
|
#
|
81
|
-
def
|
82
|
-
remove_methods(mod, options)
|
58
|
+
def add_methods(mod, options={})
|
83
59
|
mod.module_eval do
|
84
60
|
[:public, :protected, :private].each do |visibility|
|
85
61
|
Array(options[visibility]).each do |name|
|
@@ -12,10 +12,9 @@ describe Looksee::WirbleCompatibility do
|
|
12
12
|
|c.ls
|
13
13
|
EOS
|
14
14
|
code = code.chomp.gsub(/\n/, ';') # only print value of last line
|
15
|
-
|
16
|
-
lib_dir = File.expand_path('lib')
|
15
|
+
lib = File.expand_path('lib')
|
17
16
|
# irb hangs when using readline without a tty
|
18
|
-
output = IO.popen("bundle exec
|
17
|
+
output = IO.popen("bundle exec irb -f --noreadline --noprompt --noverbose -I#{lib}", 'r+') do |io|
|
19
18
|
io.puts code
|
20
19
|
io.flush
|
21
20
|
io.close_write
|
metadata
CHANGED
@@ -1,152 +1,115 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: looksee
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
6
5
|
platform: universal-java-1.6
|
7
|
-
authors:
|
8
|
-
|
9
|
-
autorequire:
|
6
|
+
authors:
|
7
|
+
- George Ogata
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
name: ritual
|
18
|
-
prerelease: false
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
-
none: false
|
21
|
-
requirements:
|
22
|
-
- - "="
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.3.0
|
25
|
-
type: :development
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
prerelease: false
|
30
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
-
none: false
|
32
|
-
requirements:
|
33
|
-
- - "="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: 2.5.0
|
36
|
-
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: wirble
|
40
|
-
prerelease: false
|
41
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: "0"
|
47
|
-
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
description:
|
50
|
-
email:
|
51
|
-
- george.ogata@gmail.com
|
11
|
+
date: 2014-01-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- george.ogata@gmail.com
|
52
16
|
executables: []
|
53
|
-
|
54
17
|
extensions: []
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
18
|
+
extra_rdoc_files:
|
19
|
+
- CHANGELOG
|
20
|
+
- LICENSE
|
21
|
+
- README.markdown
|
22
|
+
files:
|
23
|
+
- CHANGELOG
|
24
|
+
- LICENSE
|
25
|
+
- README.markdown
|
26
|
+
- Rakefile
|
27
|
+
- ext/extconf.rb
|
28
|
+
- ext/mri/1.9.2/debug.h
|
29
|
+
- ext/mri/1.9.2/id.h
|
30
|
+
- ext/mri/1.9.2/method.h
|
31
|
+
- ext/mri/1.9.2/node.h
|
32
|
+
- ext/mri/1.9.2/thread_pthread.h
|
33
|
+
- ext/mri/1.9.2/vm_core.h
|
34
|
+
- ext/mri/1.9.2/vm_opts.h
|
35
|
+
- ext/mri/1.9.3/atomic.h
|
36
|
+
- ext/mri/1.9.3/debug.h
|
37
|
+
- ext/mri/1.9.3/id.h
|
38
|
+
- ext/mri/1.9.3/internal.h
|
39
|
+
- ext/mri/1.9.3/internal_falcon.h
|
40
|
+
- ext/mri/1.9.3/method.h
|
41
|
+
- ext/mri/1.9.3/node.h
|
42
|
+
- ext/mri/1.9.3/thread_pthread.h
|
43
|
+
- ext/mri/1.9.3/vm_core.h
|
44
|
+
- ext/mri/1.9.3/vm_opts.h
|
45
|
+
- ext/mri/2.0.0/internal.h
|
46
|
+
- ext/mri/2.0.0/method.h
|
47
|
+
- ext/mri/2.1.0/internal.h
|
48
|
+
- ext/mri/2.1.0/method.h
|
49
|
+
- ext/mri/env-1.8.h
|
50
|
+
- ext/mri/eval_c-1.8.h
|
51
|
+
- ext/mri/mri.c
|
52
|
+
- ext/mri/node-1.9.h
|
53
|
+
- ext/rbx/rbx.c
|
54
|
+
- lib/looksee.rb
|
55
|
+
- lib/looksee/JRuby.jar
|
56
|
+
- lib/looksee/adapter.rb
|
57
|
+
- lib/looksee/adapter/base.rb
|
58
|
+
- lib/looksee/adapter/rubinius.rb
|
59
|
+
- lib/looksee/clean.rb
|
60
|
+
- lib/looksee/columnizer.rb
|
61
|
+
- lib/looksee/core_ext.rb
|
62
|
+
- lib/looksee/editor.rb
|
63
|
+
- lib/looksee/help.rb
|
64
|
+
- lib/looksee/inspector.rb
|
65
|
+
- lib/looksee/lookup_path.rb
|
66
|
+
- lib/looksee/shortcuts.rb
|
67
|
+
- lib/looksee/version.rb
|
68
|
+
- lib/looksee/wirble_compatibility.rb
|
69
|
+
- spec/adapter_spec.rb
|
70
|
+
- spec/columnizer_spec.rb
|
71
|
+
- spec/core_ext_spec.rb
|
72
|
+
- spec/editor_spec.rb
|
73
|
+
- spec/inspector_spec.rb
|
74
|
+
- spec/lookup_path_spec.rb
|
75
|
+
- spec/spec_helper.rb
|
76
|
+
- spec/support/core_ext.rb
|
77
|
+
- spec/support/temporary_classes.rb
|
78
|
+
- spec/support/test_adapter.rb
|
79
|
+
- spec/wirble_compatibility_spec.rb
|
114
80
|
homepage: http://github.com/oggy/looksee
|
115
|
-
licenses:
|
116
|
-
|
117
|
-
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
118
85
|
rdoc_options: []
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: "0"
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
134
98
|
requirements: []
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
signing_key:
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.2.0
|
101
|
+
signing_key:
|
139
102
|
specification_version: 3
|
140
103
|
summary: Supercharged method introspection in IRB.
|
141
|
-
test_files:
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
104
|
+
test_files:
|
105
|
+
- spec/adapter_spec.rb
|
106
|
+
- spec/columnizer_spec.rb
|
107
|
+
- spec/core_ext_spec.rb
|
108
|
+
- spec/editor_spec.rb
|
109
|
+
- spec/inspector_spec.rb
|
110
|
+
- spec/lookup_path_spec.rb
|
111
|
+
- spec/spec_helper.rb
|
112
|
+
- spec/wirble_compatibility_spec.rb
|
113
|
+
- spec/support/core_ext.rb
|
114
|
+
- spec/support/temporary_classes.rb
|
115
|
+
- spec/support/test_adapter.rb
|