patch_irb_completion 0.0.1
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.
@@ -0,0 +1 @@
|
|
1
|
+
require 'patch_irb_completion/suggest'
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module PatchIRBCompletion
|
4
|
+
class Suggest
|
5
|
+
def self.find_ruby_lib_path
|
6
|
+
ruby_bin_path = `which ruby`
|
7
|
+
ruby_path = File.expand_path(File.join(ruby_bin_path, "..", "..", "lib"))
|
8
|
+
unless File.exist?(ruby_path)
|
9
|
+
ruby_path = `ruby -e "puts $:[0]"`
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.find_completion_source_in_dir(dir)
|
14
|
+
Find.find(dir) do |filename|
|
15
|
+
# puts filename
|
16
|
+
next unless File.basename(filename) == "completion.rb"
|
17
|
+
return filename
|
18
|
+
end
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.find_completion_source_in_current_ruby_version
|
23
|
+
$:.each do |lib_dir|
|
24
|
+
completion_file = find_completion_source_in_dir(lib_dir)
|
25
|
+
next unless completion_file
|
26
|
+
return completion_file
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.check_if_completion_source_file_has_offending_code(filename)
|
31
|
+
unpatched_code = "IRB.conf[:MAIN_CONTEXT].workspace"
|
32
|
+
File.read(filename).include?(unpatched_code)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.call
|
36
|
+
filename = find_completion_source_in_current_ruby_version
|
37
|
+
if check_if_completion_source_file_has_offending_code(filename)
|
38
|
+
puts <<EOT
|
39
|
+
The file \"#{filename}\" has not been patched... I would suggest you replace:
|
40
|
+
bind = IRB.conf[:MAIN_CONTEXT].workspace.binding (line 38)
|
41
|
+
with:
|
42
|
+
context = IRB.conf[:MAIN_CONTEXT]
|
43
|
+
bind = context ? context.workspace.binding : binding
|
44
|
+
EOT
|
45
|
+
else
|
46
|
+
puts "The file \"#{filename}\" is patched."
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: patch_irb_completion
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tom ten Thij
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-18 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: The default irb completion code shipped with ruby produces an internal error, exiting from the running script. This script makes it easy to check if a suggested patch has been applied to your current ruby version.
|
23
|
+
email:
|
24
|
+
- ruby@tomtenthij.nl
|
25
|
+
executables:
|
26
|
+
- patch_irb_completion
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- bin/patch_irb_completion
|
33
|
+
- lib/patch_irb_completion/suggest.rb
|
34
|
+
- lib/patch_irb_completion/version.rb
|
35
|
+
- lib/patch_irb_completion.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/tomtt/patch_irb_completion
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.7
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: A utility to help you check if irb completion has been patched to allow completion from the ruby debugger prompt
|
70
|
+
test_files: []
|
71
|
+
|