bars 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/bars +8 -0
  2. data/lib/bars.rb +31 -0
  3. metadata +68 -0
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # Usage: bars [-p]
3
+ # Read your ~/bars.yaml file and output the results
4
+
5
+ require 'bars'
6
+
7
+ bars = Bars.new(ARGV)
8
+ bars.print
@@ -0,0 +1,31 @@
1
+ require 'yaml'
2
+
3
+ class Bars
4
+ def initialize(args=[])
5
+ if !args.empty? && args.first == '-p'
6
+ @print_mode = :percentage
7
+ else
8
+ @print_mode = :bars
9
+ end
10
+
11
+ @timeframes = YAML.load(File.open(File.expand_path('~/bars.yml')))
12
+ end
13
+
14
+ def print
15
+ puts
16
+ @timeframes.each do |timeframe, tasks|
17
+ puts " #{timeframe.capitalize} ".center(30, "*")
18
+ tasks.each do |task, done, goal|
19
+ if @print_mode == :percentage
20
+ puts "--> #{task}: #{(done.to_f/goal * 100).round}%"
21
+ else
22
+ puts "--> #{task}:"
23
+ done_count = (done.to_f/goal * 20).to_i
24
+ todo_count = 20 - done_count
25
+ puts " |#{"+" * (done_count - 1)}|#{"-" * todo_count}|"
26
+ end
27
+ end
28
+ puts
29
+ end
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bars
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Robert Fletcher
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-05-14 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: bars reads ~/pbars.yml and outputs the result in bar format
23
+ email: lobatifricha@gmail.com
24
+ executables:
25
+ - bars
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - lib/bars.rb
32
+ - bin/bars
33
+ has_rdoc: true
34
+ homepage: http://www.knowledgepile.net
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.7
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: Keep track of your progress towards goals with bars
67
+ test_files: []
68
+