liberator 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dir.rb +4 -1
- data/lib/liberator/controller.rb +5 -1
- data/lib/liberator/directory.rb +24 -14
- data/lib/liberator/view.rb +2 -0
- metadata +2 -2
data/lib/dir.rb
CHANGED
data/lib/liberator/controller.rb
CHANGED
@@ -27,7 +27,11 @@ module Liberator
|
|
27
27
|
when 10
|
28
28
|
if File.directory? @directory.selected_entry[:path]
|
29
29
|
@view.update_status_bar "Analyzing #{@directory.selected_entry[:path]}..."
|
30
|
-
|
30
|
+
begin
|
31
|
+
@directory = Directory.new @directory.selected_entry[:path]
|
32
|
+
rescue IOError
|
33
|
+
@view.update_status_bar "Cannot change directories due to permissions"
|
34
|
+
end
|
31
35
|
render
|
32
36
|
end
|
33
37
|
when 'h'
|
data/lib/liberator/directory.rb
CHANGED
@@ -23,25 +23,35 @@ module Liberator
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def delete_selected_entry
|
26
|
-
|
26
|
+
begin
|
27
|
+
FileUtils.rm_r selected_entry[:path]
|
28
|
+
rescue Errno::EACCES
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
|
32
|
+
true
|
27
33
|
end
|
28
34
|
|
29
35
|
def refresh
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
begin
|
37
|
+
@entries = Dir.real_entries(@path).collect do |entry|
|
38
|
+
absolute_path = @path + '/' + entry
|
39
|
+
|
40
|
+
if File.file? absolute_path
|
41
|
+
size = File.size absolute_path
|
42
|
+
elsif File.directory? absolute_path
|
43
|
+
size = Dir.size absolute_path
|
44
|
+
else
|
45
|
+
next
|
46
|
+
end
|
47
|
+
|
48
|
+
{ path: absolute_path, size: size }
|
39
49
|
end
|
40
|
-
|
41
|
-
|
50
|
+
@entries = @entries.compact.sort_by { |entry| 1.0/entry[:size].to_f }
|
51
|
+
@selected_index = 0
|
52
|
+
rescue
|
53
|
+
raise IOError.new
|
42
54
|
end
|
43
|
-
@entries = @entries.compact.sort_by { |entry| 1.0/entry[:size].to_f }
|
44
|
-
@selected_index = 0
|
45
55
|
end
|
46
56
|
alias_method :cache_entries, :refresh
|
47
57
|
end
|
data/lib/liberator/view.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liberator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Liberator helps you find and delete files and directories consuming large
|
15
15
|
amounts of space. It uses a curses interface and is ideally suited for *nix servers
|