bond 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG.rdoc +12 -0
  2. data/LICENSE.txt +1 -1
  3. data/README.rdoc +195 -173
  4. data/Rakefile +9 -45
  5. data/lib/bond.rb +62 -93
  6. data/lib/bond/agent.rb +39 -33
  7. data/lib/bond/completion.rb +15 -27
  8. data/lib/bond/completions/activerecord.rb +12 -0
  9. data/lib/bond/completions/array.rb +1 -0
  10. data/lib/bond/completions/bond.rb +2 -0
  11. data/lib/bond/completions/hash.rb +3 -0
  12. data/lib/bond/completions/kernel.rb +13 -0
  13. data/lib/bond/completions/module.rb +7 -0
  14. data/lib/bond/completions/object.rb +21 -0
  15. data/lib/bond/completions/struct.rb +1 -0
  16. data/lib/bond/input.rb +28 -0
  17. data/lib/bond/m.rb +95 -0
  18. data/lib/bond/mission.rb +109 -69
  19. data/lib/bond/missions/anywhere_mission.rb +18 -0
  20. data/lib/bond/missions/default_mission.rb +16 -6
  21. data/lib/bond/missions/method_mission.rb +194 -13
  22. data/lib/bond/missions/object_mission.rb +29 -32
  23. data/lib/bond/missions/operator_method_mission.rb +26 -0
  24. data/lib/bond/rawline.rb +3 -3
  25. data/lib/bond/rc.rb +48 -0
  26. data/lib/bond/readline.rb +9 -6
  27. data/lib/bond/search.rb +51 -12
  28. data/lib/bond/version.rb +3 -0
  29. data/test/agent_test.rb +168 -65
  30. data/test/anywhere_mission_test.rb +34 -0
  31. data/test/bacon_extensions.rb +26 -0
  32. data/test/bond_test.rb +38 -23
  33. data/test/completion_test.rb +123 -21
  34. data/test/completions_test.rb +96 -0
  35. data/test/method_mission_test.rb +246 -0
  36. data/test/mission_test.rb +30 -44
  37. data/test/object_mission_test.rb +28 -32
  38. data/test/operator_method_mission_test.rb +66 -0
  39. data/test/search_test.rb +106 -29
  40. data/test/test_helper.rb +20 -13
  41. metadata +37 -8
  42. data/VERSION.yml +0 -4
  43. 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
- version: 0.1.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: 2009-07-30 00:00:00 -04:00
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 make custom autocompletion easy in irb and other console/readline-like environments. Bond supports custom argument completion of methods, method completion of objects and anything else your wicked regex's can do. Bond comes armed with a Readline C extension to get the full line of input as opposed to irb's last-word based completion. Bond makes custom searching of possible completions easy which allows for nontraditional ways of autocompleting i.e. instant aliasing of multi worded methods.
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.5
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
@@ -1,4 +0,0 @@
1
- ---
2
- :minor: 1
3
- :patch: 4
4
- :major: 0
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