liberator 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dir.rb +1 -1
- data/lib/liberator/controller.rb +6 -6
- data/lib/liberator/view.rb +6 -3
- metadata +1 -1
data/lib/dir.rb
CHANGED
data/lib/liberator/controller.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module Liberator
|
2
2
|
class Controller
|
3
|
-
def initialize(view
|
3
|
+
def initialize(view)
|
4
4
|
@view = view
|
5
|
-
@view.update_status_bar "Analyzing #{Dir.pwd}..."
|
5
|
+
@view.update_status_bar "Analyzing #{Dir.pwd}..."
|
6
6
|
@directory = Directory.new Dir.pwd
|
7
7
|
render
|
8
8
|
end
|
9
9
|
|
10
10
|
def listen
|
11
11
|
loop do
|
12
|
-
handle_key @view.capture_keystroke
|
12
|
+
handle_key @view.capture_keystroke
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -26,12 +26,12 @@ module Liberator
|
|
26
26
|
render
|
27
27
|
when 10
|
28
28
|
if File.directory? @directory.selected_entry[:path]
|
29
|
-
@view.update_status_bar "Analyzing #{@directory.selected_entry[:path]}..."
|
29
|
+
@view.update_status_bar "Analyzing #{@directory.selected_entry[:path]}..."
|
30
30
|
@directory = Directory.new @directory.selected_entry[:path]
|
31
31
|
render
|
32
32
|
end
|
33
33
|
when 'h'
|
34
|
-
@view.update_status_bar "Analyzing #{File.expand_path(@directory.path + '/..')}..."
|
34
|
+
@view.update_status_bar "Analyzing #{File.expand_path(@directory.path + '/..')}..."
|
35
35
|
@directory = @directory.parent
|
36
36
|
render
|
37
37
|
when 'x'
|
@@ -42,7 +42,7 @@ module Liberator
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def render
|
45
|
-
@view.refresh(@directory.path, @directory.entries, @directory.selected_index)
|
45
|
+
@view.refresh(@directory.path, @directory.entries, @directory.selected_index)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/liberator/view.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
module Liberator
|
2
2
|
class View
|
3
|
-
GIGABYTE =
|
4
|
-
MEGABYTE =
|
3
|
+
GIGABYTE = 1073741824
|
4
|
+
MEGABYTE = 1048576
|
5
|
+
KILOBYTE = 1024
|
5
6
|
|
6
7
|
def initialize
|
7
8
|
# Initialize curses view.
|
@@ -67,8 +68,10 @@ module Liberator
|
|
67
68
|
"#{size / GIGABYTE} GB"
|
68
69
|
elsif size > MEGABYTE
|
69
70
|
"#{size / MEGABYTE} MB"
|
71
|
+
elsif size > KILOBYTE
|
72
|
+
"#{size / KILOBYTE} KB"
|
70
73
|
else
|
71
|
-
"#{size}
|
74
|
+
"#{size} bytes"
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|