interactive_editor 0.0.5 → 0.0.6
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.
- data/README.md +4 -4
- data/interactive_editor.gemspec +2 -2
- data/lib/interactive_editor.rb +7 -7
- metadata +4 -4
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
|
19
|
-
> vi 'filename.rb'
|
20
|
-
> ed
|
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:
|
data/interactive_editor.gemspec
CHANGED
@@ -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.
|
11
|
-
s.date = '2010-
|
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
|
data/lib/interactive_editor.rb
CHANGED
@@ -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.
|
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
|
-
|
28
|
-
|
29
|
-
|
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:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2010-12-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|