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 CHANGED
@@ -7,6 +7,6 @@ class Dir
7
7
  end
8
8
 
9
9
  def self.size(path)
10
- `du -ks "#{path}"`.split("\t").first.to_i if Dir.exists? path
10
+ `du -ks "#{path}"`.split("\t").first.to_i*1024 if Dir.exists? path
11
11
  end
12
12
  end
@@ -1,15 +1,15 @@
1
1
  module Liberator
2
2
  class Controller
3
- def initialize(view=nil)
3
+ def initialize(view)
4
4
  @view = view
5
- @view.update_status_bar "Analyzing #{Dir.pwd}..." unless @view.nil?
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 unless @view.nil?
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]}..." unless @view.nil?
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 + '/..')}..." unless @view.nil?
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) unless @view.nil?
45
+ @view.refresh(@directory.path, @directory.entries, @directory.selected_index)
46
46
  end
47
47
  end
48
48
  end
@@ -1,7 +1,8 @@
1
1
  module Liberator
2
2
  class View
3
- GIGABYTE = 1048576
4
- MEGABYTE = 1024
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} KB"
74
+ "#{size} bytes"
72
75
  end
73
76
  end
74
77
 
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.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: