three-usage 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Rakefile +3 -3
- data/lib/three_usage.rb +1 -1
- data/lib/three_usage/cli.rb +1 -3
- data/lib/three_usage/parser.rb +22 -0
- metadata +13 -3
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -8,9 +8,9 @@ $hoe = Hoe.new('three-usage', ThreeUsage::VERSION) do |p|
|
|
8
8
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
9
|
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
10
|
p.rubyforge_name = p.name # TODO this is default value
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
p.extra_deps = [
|
12
|
+
['mechanize','>= 0.9.0'],
|
13
|
+
]
|
14
14
|
p.extra_dev_deps = [
|
15
15
|
['newgem', ">= #{::Newgem::VERSION}"]
|
16
16
|
]
|
data/lib/three_usage.rb
CHANGED
data/lib/three_usage/cli.rb
CHANGED
@@ -65,9 +65,7 @@ module ThreeUsage
|
|
65
65
|
parser = Parser.new(fetcher.page)
|
66
66
|
|
67
67
|
if options[:full_details]
|
68
|
-
parser.
|
69
|
-
pp usage_block
|
70
|
-
end
|
68
|
+
parser.print_table
|
71
69
|
else
|
72
70
|
puts 'Remaining Usage: ' + parser.remaining_three_quota.to_s + ' MB'
|
73
71
|
end
|
data/lib/three_usage/parser.rb
CHANGED
@@ -22,5 +22,27 @@ module ThreeUsage
|
|
22
22
|
def remaining_three_quota
|
23
23
|
three_usage_blocks.inject(0){|sum,item| sum + item.remaining}
|
24
24
|
end
|
25
|
+
|
26
|
+
def print_table
|
27
|
+
printf "+-"
|
28
|
+
printf "-" * 40
|
29
|
+
printf "-+-"
|
30
|
+
printf "-" * 20
|
31
|
+
printf "-+-"
|
32
|
+
printf "-" * 20
|
33
|
+
printf "-+\n"
|
34
|
+
|
35
|
+
@usage_blocks.each do |usage_block|
|
36
|
+
printf("| %40s | %20s | %20s |\n", usage_block.description, usage_block.remaining, usage_block.expires_at)
|
37
|
+
end
|
38
|
+
|
39
|
+
printf "+-"
|
40
|
+
printf "-" * 40
|
41
|
+
printf "-+-"
|
42
|
+
printf "-" * 20
|
43
|
+
printf "-+-"
|
44
|
+
printf "-" * 20
|
45
|
+
printf "-+\n"
|
46
|
+
end
|
25
47
|
end
|
26
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: three-usage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Harper
|
@@ -9,9 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-27 00:00:00 +10:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mechanize
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.0
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: newgem
|
17
27
|
type: :development
|
@@ -20,7 +30,7 @@ dependencies:
|
|
20
30
|
requirements:
|
21
31
|
- - ">="
|
22
32
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
33
|
+
version: 1.3.0
|
24
34
|
version:
|
25
35
|
- !ruby/object:Gem::Dependency
|
26
36
|
name: hoe
|