ruco 0.0.37 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +2 -3
- data/VERSION +1 -1
- data/lib/ruco/application.rb +4 -1
- data/lib/ruco/editor.rb +3 -0
- data/ruco.gemspec +1 -1
- data/spec/ruco/application_spec.rb +28 -0
- data/spec/ruco/editor_spec.rb +11 -2
- metadata +3 -3
data/Readme.md
CHANGED
@@ -63,8 +63,7 @@ TIPS
|
|
63
63
|
|
64
64
|
TODO
|
65
65
|
=====
|
66
|
-
- big warning when editing a not-
|
67
|
-
- nice warning when failing to write a write-only file
|
66
|
+
- big warning when editing a not-writable file
|
68
67
|
- find next (Alt+n)
|
69
68
|
- add selection colors to forms in command_bar
|
70
69
|
- session storage (stay at same line/column when reopening)
|
@@ -77,7 +76,7 @@ TODO
|
|
77
76
|
- add auto-confirm to 'replace?' dialog -> type s == skip, no enter needed
|
78
77
|
- 1.8: unicode support <-> already finished but unusable due to Curses (see encoding branch)
|
79
78
|
- support Alt+Fx keys
|
80
|
-
- (later) extract keyboard and html-style components into
|
79
|
+
- (later) extract keyboard and html-style components into separate project
|
81
80
|
|
82
81
|
Author
|
83
82
|
======
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.38
|
data/lib/ruco/application.rb
CHANGED
data/lib/ruco/editor.rb
CHANGED
data/ruco.gemspec
CHANGED
@@ -11,6 +11,11 @@ describe Ruco::Application do
|
|
11
11
|
File.open(@file,'w'){|f| f.write(content) }
|
12
12
|
end
|
13
13
|
|
14
|
+
def read
|
15
|
+
File.read(@file)
|
16
|
+
end
|
17
|
+
|
18
|
+
|
14
19
|
def editor_part(view)
|
15
20
|
view.naive_split("\n")[1..-2].join("\n")
|
16
21
|
end
|
@@ -251,4 +256,27 @@ describe Ruco::Application do
|
|
251
256
|
end
|
252
257
|
end
|
253
258
|
end
|
259
|
+
|
260
|
+
describe :save do
|
261
|
+
it "just saves" do
|
262
|
+
write('')
|
263
|
+
app.key('x')
|
264
|
+
app.key(:'Ctrl+s')
|
265
|
+
read.should == 'x'
|
266
|
+
end
|
267
|
+
|
268
|
+
it "warns when saving failed" do
|
269
|
+
begin
|
270
|
+
`chmod -w #{@file}`
|
271
|
+
app.key(:'Ctrl+s')
|
272
|
+
app.view.should include('Permission denied')
|
273
|
+
app.key(:enter) # retry ?
|
274
|
+
app.view.should include('Permission denied')
|
275
|
+
app.key(:escape)
|
276
|
+
app.view.should_not include('Permission denied')
|
277
|
+
ensure
|
278
|
+
`chmod +w #{@file}`
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
254
282
|
end
|
data/spec/ruco/editor_spec.rb
CHANGED
@@ -631,16 +631,25 @@ describe Ruco::Editor do
|
|
631
631
|
it 'stores the file' do
|
632
632
|
write('xxx')
|
633
633
|
editor.insert('a')
|
634
|
-
editor.save
|
634
|
+
editor.save.should == true
|
635
635
|
File.read(@file).should == 'axxx'
|
636
636
|
end
|
637
637
|
|
638
638
|
it 'creates the file' do
|
639
639
|
`rm #{@file}`
|
640
640
|
editor.insert('a')
|
641
|
-
editor.save
|
641
|
+
editor.save.should == true
|
642
642
|
File.read(@file).should == 'a'
|
643
643
|
end
|
644
|
+
|
645
|
+
it 'does not crash when it cannot save a file' do
|
646
|
+
begin
|
647
|
+
`chmod -w #{@file}`
|
648
|
+
editor.save.should == "Permission denied - #{@file}"
|
649
|
+
ensure
|
650
|
+
`chmod +w #{@file}`
|
651
|
+
end
|
652
|
+
end
|
644
653
|
end
|
645
654
|
|
646
655
|
describe :delete do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 83
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 38
|
10
|
+
version: 0.0.38
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|