bond 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +12 -0
- data/LICENSE.txt +1 -1
- data/README.rdoc +195 -173
- data/Rakefile +9 -45
- data/lib/bond.rb +62 -93
- data/lib/bond/agent.rb +39 -33
- data/lib/bond/completion.rb +15 -27
- data/lib/bond/completions/activerecord.rb +12 -0
- data/lib/bond/completions/array.rb +1 -0
- data/lib/bond/completions/bond.rb +2 -0
- data/lib/bond/completions/hash.rb +3 -0
- data/lib/bond/completions/kernel.rb +13 -0
- data/lib/bond/completions/module.rb +7 -0
- data/lib/bond/completions/object.rb +21 -0
- data/lib/bond/completions/struct.rb +1 -0
- data/lib/bond/input.rb +28 -0
- data/lib/bond/m.rb +95 -0
- data/lib/bond/mission.rb +109 -69
- data/lib/bond/missions/anywhere_mission.rb +18 -0
- data/lib/bond/missions/default_mission.rb +16 -6
- data/lib/bond/missions/method_mission.rb +194 -13
- data/lib/bond/missions/object_mission.rb +29 -32
- data/lib/bond/missions/operator_method_mission.rb +26 -0
- data/lib/bond/rawline.rb +3 -3
- data/lib/bond/rc.rb +48 -0
- data/lib/bond/readline.rb +9 -6
- data/lib/bond/search.rb +51 -12
- data/lib/bond/version.rb +3 -0
- data/test/agent_test.rb +168 -65
- data/test/anywhere_mission_test.rb +34 -0
- data/test/bacon_extensions.rb +26 -0
- data/test/bond_test.rb +38 -23
- data/test/completion_test.rb +123 -21
- data/test/completions_test.rb +96 -0
- data/test/method_mission_test.rb +246 -0
- data/test/mission_test.rb +30 -44
- data/test/object_mission_test.rb +28 -32
- data/test/operator_method_mission_test.rb +66 -0
- data/test/search_test.rb +106 -29
- data/test/test_helper.rb +20 -13
- metadata +37 -8
- data/VERSION.yml +0 -4
- data/lib/bond/actions.rb +0 -69
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bond
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Gabriel Horner
|
@@ -9,11 +14,11 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-07 00:00:00 -04:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
16
|
-
description: Bond is on a mission to
|
21
|
+
description: "Bond is on a mission to improve irb\xE2\x80\x99s autocompletion. Aside from doing everything irb\xE2\x80\x99s can do and fixing its quirks, Bond can autocomplete argument(s) to methods, uniquely completing per module, per method and per argument. Bond brings irb\xE2\x80\x99s completion closer to bash/zsh as it provides a configuration system and a DSL for creating custom completions and completion rules. With this configuration system, users can customize their irb autocompletions and share it with others. Bond is able to offer more than irb\xE2\x80\x99s completion since it uses a Readline C extension to get the full line of input when completing as opposed to irb\xE2\x80\x99s last-word approach."
|
17
22
|
email: gabriel.horner@gmail.com
|
18
23
|
executables: []
|
19
24
|
|
@@ -27,25 +32,42 @@ files:
|
|
27
32
|
- LICENSE.txt
|
28
33
|
- README.rdoc
|
29
34
|
- Rakefile
|
30
|
-
- VERSION.yml
|
31
35
|
- ext/readline_line_buffer/extconf.rb
|
32
36
|
- ext/readline_line_buffer/readline_line_buffer.c
|
33
37
|
- lib/bond.rb
|
34
|
-
- lib/bond/actions.rb
|
35
38
|
- lib/bond/agent.rb
|
36
39
|
- lib/bond/completion.rb
|
40
|
+
- lib/bond/completions/activerecord.rb
|
41
|
+
- lib/bond/completions/array.rb
|
42
|
+
- lib/bond/completions/bond.rb
|
43
|
+
- lib/bond/completions/hash.rb
|
44
|
+
- lib/bond/completions/kernel.rb
|
45
|
+
- lib/bond/completions/module.rb
|
46
|
+
- lib/bond/completions/object.rb
|
47
|
+
- lib/bond/completions/struct.rb
|
48
|
+
- lib/bond/input.rb
|
49
|
+
- lib/bond/m.rb
|
37
50
|
- lib/bond/mission.rb
|
51
|
+
- lib/bond/missions/anywhere_mission.rb
|
38
52
|
- lib/bond/missions/default_mission.rb
|
39
53
|
- lib/bond/missions/method_mission.rb
|
40
54
|
- lib/bond/missions/object_mission.rb
|
55
|
+
- lib/bond/missions/operator_method_mission.rb
|
41
56
|
- lib/bond/rawline.rb
|
57
|
+
- lib/bond/rc.rb
|
42
58
|
- lib/bond/readline.rb
|
43
59
|
- lib/bond/search.rb
|
60
|
+
- lib/bond/version.rb
|
44
61
|
- test/agent_test.rb
|
62
|
+
- test/anywhere_mission_test.rb
|
63
|
+
- test/bacon_extensions.rb
|
45
64
|
- test/bond_test.rb
|
46
65
|
- test/completion_test.rb
|
66
|
+
- test/completions_test.rb
|
67
|
+
- test/method_mission_test.rb
|
47
68
|
- test/mission_test.rb
|
48
69
|
- test/object_mission_test.rb
|
70
|
+
- test/operator_method_mission_test.rb
|
49
71
|
- test/search_test.rb
|
50
72
|
- test/test_helper.rb
|
51
73
|
has_rdoc: true
|
@@ -61,26 +83,33 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
83
|
requirements:
|
62
84
|
- - ">="
|
63
85
|
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
64
88
|
version: "0"
|
65
|
-
version:
|
66
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
90
|
requirements:
|
68
91
|
- - ">="
|
69
92
|
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
70
95
|
version: "0"
|
71
|
-
version:
|
72
96
|
requirements: []
|
73
97
|
|
74
98
|
rubyforge_project: tagaholic
|
75
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.6
|
76
100
|
signing_key:
|
77
101
|
specification_version: 3
|
78
102
|
summary: "Mission: Easy custom autocompletion for arguments, methods and beyond. Accomplished for irb and any other readline-like console environments."
|
79
103
|
test_files:
|
80
104
|
- test/agent_test.rb
|
105
|
+
- test/anywhere_mission_test.rb
|
106
|
+
- test/bacon_extensions.rb
|
81
107
|
- test/bond_test.rb
|
82
108
|
- test/completion_test.rb
|
109
|
+
- test/completions_test.rb
|
110
|
+
- test/method_mission_test.rb
|
83
111
|
- test/mission_test.rb
|
84
112
|
- test/object_mission_test.rb
|
113
|
+
- test/operator_method_mission_test.rb
|
85
114
|
- test/search_test.rb
|
86
115
|
- test/test_helper.rb
|
data/VERSION.yml
DELETED
data/lib/bond/actions.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module Bond
|
2
|
-
# Namespace for mission actions.
|
3
|
-
module Actions
|
4
|
-
ReservedWords = [
|
5
|
-
"BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "def", "defined", "do", "else", "elsif", "end", "ensure",
|
6
|
-
"false", "for", "if", "in", "module", "next", "nil", "not", "or", "redo", "rescue", "retry", "return", "self", "super",
|
7
|
-
"then", "true", "undef", "unless", "until", "when", "while", "yield"
|
8
|
-
]
|
9
|
-
|
10
|
-
# Helper function for evaluating strings in the current console binding.
|
11
|
-
def current_eval(string)
|
12
|
-
Missions::ObjectMission.current_eval(string)
|
13
|
-
rescue Exception
|
14
|
-
[]
|
15
|
-
end
|
16
|
-
|
17
|
-
# Completes backtick and Kernel#system with shell commands available in ENV['PATH']
|
18
|
-
def shell_commands(input)
|
19
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).uniq.map {|e| Dir.entries(e) }.flatten.uniq - ['.', '..']
|
20
|
-
end
|
21
|
-
|
22
|
-
# Default completion for non-irb console and bond/completion
|
23
|
-
def default(input)
|
24
|
-
current_eval("methods | private_methods | local_variables | self.class.constants") | ReservedWords
|
25
|
-
end
|
26
|
-
|
27
|
-
# File completion
|
28
|
-
def files(input)
|
29
|
-
(::Readline::FILENAME_COMPLETION_PROC.call(input) || []).map {|f|
|
30
|
-
f =~ /^~/ ? File.expand_path(f) : f
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
def quoted_files(input) #:nodoc:
|
35
|
-
files(input.matched[1])
|
36
|
-
end
|
37
|
-
|
38
|
-
def constants(input) #:nodoc:
|
39
|
-
receiver = input.matched[1]
|
40
|
-
candidates = current_eval("#{receiver}.constants | #{receiver}.methods")
|
41
|
-
candidates.grep(/^#{Regexp.escape(input.matched[4])}/).map {|e| receiver + "::" + e}
|
42
|
-
end
|
43
|
-
|
44
|
-
# Completes Kernel#require
|
45
|
-
def method_require(input)
|
46
|
-
fs = ::File::SEPARATOR
|
47
|
-
extensions_regex = /((\.(so|dll|rb|bundle))|#{fs})$/i
|
48
|
-
input =~ /^(\.{0,2}#{fs}|~)/ and return files(input).select {|f| f =~ extensions_regex or File.directory? f }
|
49
|
-
dir_entries = proc {|dir| Dir.entries(dir).delete_if {|e| %w{. ..}.include?(e) }.map {|f|
|
50
|
-
File.directory?(File.join(dir,f)) ? f+fs : f } }
|
51
|
-
input_regex = /^#{Regexp.escape(input)}/
|
52
|
-
|
53
|
-
require_paths.select {|e| File.directory?(e)}.inject([]) do |t,dir|
|
54
|
-
if input[/.$/] == fs && File.directory?(File.join(dir,input))
|
55
|
-
matches = dir_entries.call(File.join(dir,input)).select {|e| e =~ extensions_regex }.map {|e| input + e }
|
56
|
-
else
|
57
|
-
entries = input.include?(fs) && File.directory?(File.join(dir,File.dirname(input))) ?
|
58
|
-
dir_entries.call(File.join(dir,File.dirname(input))).map {|e| File.join(File.dirname(input), e) } : dir_entries.call(dir)
|
59
|
-
matches = entries.select {|e| e=~ extensions_regex && e =~ input_regex }
|
60
|
-
end
|
61
|
-
t += matches
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def require_paths
|
66
|
-
$: + Gem.path.map {|e| Dir["#{e}/gems/*/lib"] }.flatten.uniq rescue $:
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|