bond 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ == 0.3.3
2
+ * Add Bond.restart
3
+
1
4
  == 0.3.2
2
5
  * Add Bond.started?
3
6
 
@@ -105,6 +105,10 @@ module Bond
105
105
  # Useful to debug an incorrect completion.
106
106
  def start(options={}, &block); M.start(options, &block); end
107
107
 
108
+ # Restarts completions with given options, ensuring to delete current completions.
109
+ # Takes same options as Bond#start.
110
+ def restart(options={}, &block); M.restart(options, &block); end
111
+
108
112
  # Indicates if Bond has already started
109
113
  def started?; M.started?; end
110
114
 
@@ -1,9 +1,9 @@
1
1
  complete(:methods=>%w{Bond.complete Bond.recomplete}) {
2
2
  ["on", "method", "methods", "class", "object", "anywhere", "prefix", "search", "action", "place", "name"]
3
3
  }
4
- complete(:method=>'Bond.start') {
4
+ complete(:methods=>['Bond.start', 'Bond.restart']) {
5
5
  ["gems", "yard_gems", "readline_plugin", "default_mission", "default_search", "eval_binding", "debug", "eval_debug"]
6
6
  }
7
7
  complete(:method=>'Bond.load_yard_gems') {
8
8
  ["verbose", "reload"]
9
- }
9
+ }
@@ -33,10 +33,10 @@ module Bond
33
33
  @config ||= {:readline_plugin=>Bond::Readline, :debug=>false, :default_search=>:underscore}
34
34
  end
35
35
 
36
- # Resets M by deleting all missions.
36
+ # Resets M's missions and config
37
37
  def reset
38
38
  MethodMission.reset
39
- @agent = nil
39
+ @config = @agent = nil
40
40
  end
41
41
 
42
42
  # See {Bond#spy}
@@ -54,6 +54,12 @@ module Bond
54
54
  end
55
55
  end
56
56
 
57
+ # See {Bond#restart}
58
+ def restart(options={}, &block)
59
+ reset
60
+ start(options, &block)
61
+ end
62
+
57
63
  # See {Bond#start}
58
64
  def start(options={}, &block)
59
65
  debrief options
@@ -1,3 +1,3 @@
1
1
  module Bond
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -108,4 +108,25 @@ describe "Bond" do
108
108
  M.reset
109
109
  Bond.agent.missions.size.should == 0
110
110
  end
111
+
112
+ describe "restart" do
113
+ def start(options={}, &block)
114
+ Bond.start({:readline_plugin=>valid_readline_plugin}.merge(options), &block)
115
+ end
116
+
117
+ it "deletes previous config" do
118
+ start :blah=>''
119
+ Bond.config[:blah].should.not == nil
120
+ Bond.restart({:readline_plugin=>valid_readline_plugin})
121
+ Bond.config[:blah].should == nil
122
+ end
123
+
124
+ it "deletes previous method completions" do
125
+ start
126
+ complete(:method=>'blah') { [] }
127
+ MethodMission.actions['blah'].should.not == nil
128
+ Bond.restart({:readline_plugin=>valid_readline_plugin})
129
+ MethodMission.actions['blah'].should == nil
130
+ end
131
+ end
111
132
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bond
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabriel Horner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-08 00:00:00 -05:00
18
+ date: 2010-11-09 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -140,7 +140,7 @@ licenses:
140
140
  post_install_message:
141
141
  rdoc_options:
142
142
  - --title
143
- - Bond 0.3.2 Documentation
143
+ - Bond 0.3.3 Documentation
144
144
  require_paths:
145
145
  - lib
146
146
  required_ruby_version: !ruby/object:Gem::Requirement