ruco 0.0.46 → 0.0.47
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +1 -0
- data/VERSION +1 -1
- data/lib/ruco/application.rb +15 -1
- data/ruco.gemspec +3 -4
- data/spec/ruco/application_spec.rb +30 -0
- metadata +11 -8
data/Readme.md
CHANGED
@@ -12,6 +12,7 @@ Features:
|
|
12
12
|
- cut, copy and paste -> Ctrl+x/c/v
|
13
13
|
- undo / redo
|
14
14
|
- stays at last position when reopening a file
|
15
|
+
- opens file at line with `ruco foo/bar.rb:32` syntax
|
15
16
|
- keeps whatever newline format you use (\r \n \r\n)
|
16
17
|
- (optional) remove trailing whitespace on save
|
17
18
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.47
|
data/lib/ruco/application.rb
CHANGED
@@ -3,13 +3,15 @@ module Ruco
|
|
3
3
|
attr_reader :editor, :status, :command, :options
|
4
4
|
|
5
5
|
def initialize(file, options)
|
6
|
-
@file = file
|
6
|
+
@file, go_to_line = parse_file_and_line(file)
|
7
7
|
@options = OptionAccessor.new(options)
|
8
8
|
|
9
9
|
setup_actions
|
10
10
|
setup_keys
|
11
11
|
load_user_config
|
12
12
|
create_components
|
13
|
+
|
14
|
+
@editor.move(:to, go_to_line.to_i-1,0) if go_to_line
|
13
15
|
end
|
14
16
|
|
15
17
|
def view
|
@@ -254,5 +256,17 @@ module Ruco
|
|
254
256
|
command_lines = 1
|
255
257
|
@options[:lines] - @status_lines - command_lines
|
256
258
|
end
|
259
|
+
|
260
|
+
def parse_file_and_line(file)
|
261
|
+
if not File.exist?(file)
|
262
|
+
short_file, go_to_line = file.split(':',2)
|
263
|
+
if File.exist?(short_file)
|
264
|
+
file = short_file
|
265
|
+
else
|
266
|
+
go_to_line = nil
|
267
|
+
end
|
268
|
+
end
|
269
|
+
[file, go_to_line]
|
270
|
+
end
|
257
271
|
end
|
258
272
|
end
|
data/ruco.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruco}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.47"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-14}
|
13
13
|
s.default_executable = %q{ruco}
|
14
14
|
s.email = %q{michael@grosser.it}
|
15
15
|
s.executables = ["ruco"]
|
@@ -63,7 +63,7 @@ Gem::Specification.new do |s|
|
|
63
63
|
]
|
64
64
|
s.homepage = %q{http://github.com/grosser/ruco}
|
65
65
|
s.require_paths = ["lib"]
|
66
|
-
s.rubygems_version = %q{1.
|
66
|
+
s.rubygems_version = %q{1.4.2}
|
67
67
|
s.summary = %q{Commandline editor written in ruby}
|
68
68
|
s.test_files = [
|
69
69
|
"spec/ruco/application_spec.rb",
|
@@ -85,7 +85,6 @@ Gem::Specification.new do |s|
|
|
85
85
|
]
|
86
86
|
|
87
87
|
if s.respond_to? :specification_version then
|
88
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
89
88
|
s.specification_version = 3
|
90
89
|
|
91
90
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -11,6 +11,7 @@ describe Ruco::Application do
|
|
11
11
|
|
12
12
|
after do
|
13
13
|
`rm #{rucorc} 2>&1`
|
14
|
+
`rm -f #{@file}`
|
14
15
|
end
|
15
16
|
|
16
17
|
def write(content)
|
@@ -68,6 +69,35 @@ describe Ruco::Application do
|
|
68
69
|
app.view.should == "#{status}0123456\n1\n2\n3\n4\n5678910\n#{command}"
|
69
70
|
end
|
70
71
|
|
72
|
+
describe 'opening with line' do
|
73
|
+
before do
|
74
|
+
write("\n1\n2\n3\n4\n5\n")
|
75
|
+
@file = @file+":2"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "opens file at given line" do
|
79
|
+
app.cursor.should == [2,0]
|
80
|
+
app.view.should_not include(@file)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "can save when opening with line" do
|
84
|
+
type 'a', :"Ctrl+s"
|
85
|
+
@file = @file[0..-3]
|
86
|
+
read.should == "\na1\n2\n3\n4\n5\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
it "opens file with : if file with : exist" do
|
90
|
+
write("\n1\n2\n3\n4\n5\n")
|
91
|
+
app.view.should include(@file)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "opens file with : if file with and without : do not exist" do
|
95
|
+
@file[-2..-1] = 'xxx:5'
|
96
|
+
app.cursor.should == [1,0]
|
97
|
+
app.view.should include(@file)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
71
101
|
describe 'closing' do
|
72
102
|
it "can quit" do
|
73
103
|
result = app.key(:"Ctrl+w")
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 65
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 47
|
10
|
+
version: 0.0.47
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Michael Grosser
|
@@ -14,24 +15,25 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-14 00:00:00 +01:00
|
18
19
|
default_executable: ruco
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name: clipboard
|
22
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
23
|
none: false
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
+
hash: 51
|
27
28
|
segments:
|
28
29
|
- 0
|
29
30
|
- 9
|
30
31
|
- 4
|
31
32
|
version: 0.9.4
|
32
|
-
type: :runtime
|
33
33
|
prerelease: false
|
34
34
|
version_requirements: *id001
|
35
|
+
type: :runtime
|
36
|
+
name: clipboard
|
35
37
|
description:
|
36
38
|
email: michael@grosser.it
|
37
39
|
executables:
|
@@ -101,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
103
|
requirements:
|
102
104
|
- - ">="
|
103
105
|
- !ruby/object:Gem::Version
|
104
|
-
hash:
|
106
|
+
hash: 3
|
105
107
|
segments:
|
106
108
|
- 0
|
107
109
|
version: "0"
|
@@ -110,13 +112,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
112
|
requirements:
|
111
113
|
- - ">="
|
112
114
|
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
113
116
|
segments:
|
114
117
|
- 0
|
115
118
|
version: "0"
|
116
119
|
requirements: []
|
117
120
|
|
118
121
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.
|
122
|
+
rubygems_version: 1.4.2
|
120
123
|
signing_key:
|
121
124
|
specification_version: 3
|
122
125
|
summary: Commandline editor written in ruby
|