interactive_editor 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -15,10 +15,10 @@ Put the following in your .irbrc:
15
15
  Then, from within irb:
16
16
 
17
17
  $ irb
18
- > vi # (use vi w/ temp file)
19
- > vi 'filename.rb' # (open filename.rb in vi)
20
- > ed # (use EDITOR env variable)
21
- > [emacs|vim|nano|mate] # (other editors)
18
+ > vi # (use vi w/ temp file)
19
+ > vi 'filename.rb' # (open filename.rb in vi)
20
+ > ed # (use EDITOR env variable)
21
+ > [emacs|vim|mvim|nano|mate] # (other editors)
22
22
 
23
23
 
24
24
  To try it out without installing the gem:
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  ## If your rubyforge_project name is different, then edit it and comment out
8
8
  ## the sub! line in the Rakefile
9
9
  s.name = 'interactive_editor'
10
- s.version = '0.0.5'
11
- s.date = '2010-09-26'
10
+ s.version = '0.0.6'
11
+ s.date = '2010-12-08'
12
12
  s.rubyforge_project = 'interactive_editor'
13
13
 
14
14
  ## Make sure your summary is short. The description may be as long
@@ -5,9 +5,10 @@
5
5
  require 'irb'
6
6
  require 'fileutils'
7
7
  require 'tempfile'
8
+ require 'shellwords'
8
9
 
9
10
  class InteractiveEditor
10
- VERSION = '0.0.5'
11
+ VERSION = '0.0.6'
11
12
 
12
13
  attr_accessor :editor
13
14
 
@@ -24,11 +25,9 @@ class InteractiveEditor
24
25
  end
25
26
  mtime = File.stat(@file.path).mtime
26
27
 
27
- if (args = @editor.split(/\s+/)).size > 1
28
- Exec.system(args[0], *(args[1..-1] << @file.path))
29
- else
30
- Exec.system(@editor, @file.path)
31
- end
28
+ args = Shellwords.shellwords(@editor) #parse @editor as arguments could be complexe
29
+ args << @file.path
30
+ Exec.system(*args)
32
31
 
33
32
  execute if mtime < File.stat(@file.path).mtime
34
33
  end
@@ -68,7 +67,8 @@ class InteractiveEditor
68
67
  :vim => nil,
69
68
  :emacs => nil,
70
69
  :nano => nil,
71
- :mate => 'mate -w'
70
+ :mate => 'mate -w',
71
+ :mvim => 'mvim -g -f -c "au VimLeave * !open -a Terminal"'
72
72
  }.each do |k,v|
73
73
  define_method(k) do |*args|
74
74
  InteractiveEditor.edit(v || k, *args)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interactive_editor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan Berkel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-26 00:00:00 +02:00
18
+ date: 2010-12-08 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency