vimrunner 0.0.3 → 0.0.4

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.
@@ -27,20 +27,11 @@ module Vimrunner
27
27
  Client.new(self)
28
28
  end
29
29
 
30
- # Retrieve a list of names of currently running Vim servers.
31
- def list
32
- %x[#{vim_path} --serverlist].strip.split "\n"
33
- end
34
-
35
30
  # The default path to use when starting a server with a terminal Vim. If
36
31
  # the "vim" executable is not compiled with clientserver capabilities,
37
32
  # the GUI version is started instead.
38
33
  def vim_path
39
- if clientserver_enabled? 'vim'
40
- 'vim'
41
- else
42
- gui_vim_path
43
- end
34
+ 'vim'
44
35
  end
45
36
 
46
37
  # The default path to use when starting a server with the GUI version of
@@ -103,10 +94,18 @@ module Vimrunner
103
94
  # server = Server.new(:vim_path => '/opt/bin/vim') # Will start a server with the given vim instance
104
95
  #
105
96
  def initialize(options = {})
106
- @gui = options.fetch(:gui) { false }
107
- @vim_path = options.fetch(:vim_path) { gui? ? Server.gui_vim_path : Server.vim_path }
97
+ @gui = options[:gui]
98
+ @vim_path = options[:vim_path]
99
+ @name = "VIMRUNNER#{rand.to_s}"
108
100
 
109
- @name = "VIMRUNNER#{rand.to_s}"
101
+ if not @vim_path or not Server.clientserver_enabled? @vim_path
102
+ @vim_path = Server.vim_path
103
+ end
104
+
105
+ if @gui or not Server.clientserver_enabled? @vim_path
106
+ @gui = true
107
+ @vim_path = Server.gui_vim_path
108
+ end
110
109
  end
111
110
 
112
111
  # Starts a Vim server.
@@ -123,10 +122,8 @@ module Vimrunner
123
122
  self
124
123
  end
125
124
 
126
- # Returns true if the server was initialized with :gui => true. Note that
127
- # this may not be consistent with the binary that was actually started. If
128
- # a terminal Vim instance was attempted, but an appropriate one was not
129
- # available, it may still have a GUI.
125
+ # Returns true if the server is a GUI version of Vim. This can be forced by
126
+ # instantiating the server with :gui => true
130
127
  def gui?
131
128
  @gui
132
129
  end
@@ -136,14 +133,19 @@ module Vimrunner
136
133
  Shell.kill(@pid)
137
134
  end
138
135
 
136
+ # Retrieve a list of names of currently running Vim servers.
137
+ def serverlist
138
+ %x[#{vim_path} --serverlist].strip.split "\n"
139
+ end
140
+
139
141
  private
140
142
 
141
143
  def wait_until_started
142
144
  Timeout.timeout(5, TimeoutError) do
143
- serverlist = Server.list
144
- while serverlist.empty? or not serverlist.include? name
145
+ servers = serverlist
146
+ while servers.empty? or not servers.include? name
145
147
  sleep 0.1
146
- serverlist = Server.list
148
+ servers = serverlist
147
149
  end
148
150
  end
149
151
  end
@@ -1,3 +1,3 @@
1
1
  module Vimrunner
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &23987740 !ruby/object:Gem::Requirement
16
+ requirement: &20415700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *23987740
24
+ version_requirements: *20415700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &23987320 !ruby/object:Gem::Requirement
27
+ requirement: &20415020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *23987320
35
+ version_requirements: *20415020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &23986780 !ruby/object:Gem::Requirement
38
+ requirement: &20414500 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 2.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *23986780
46
+ version_requirements: *20414500
47
47
  description: ! " Using vim's client/server functionality, this library exposes
48
48
  a way to\n spawn a vim instance and control it programatically. Apart from being
49
49
  a fun\n party trick, this could be used to do integration testing on vimscript.\n"
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -3146226263794770349
81
+ hash: 507320625350919209
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements: