habiter 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +13 -0
  2. data/bin/habiter +9 -3
  3. metadata +1 -1
data/README CHANGED
@@ -21,3 +21,16 @@ Install
21
21
 
22
22
  Install with 'gem install habiter' if you have gemcutter set up as a
23
23
  repository
24
+
25
+ FAQ
26
+ ---
27
+
28
+ * How do I add past data?
29
+ How do I delete recorded data?
30
+ How do I modify stuff I've recorded?
31
+
32
+ Edit ~/.habiter.yaml
33
+
34
+ * How do I reset habiter?
35
+
36
+ echo > ~/.habiter.yaml
data/bin/habiter CHANGED
@@ -54,7 +54,7 @@ end
54
54
 
55
55
  def log(options={})
56
56
  options[:days] = 30 unless options[:days]
57
- name_column_width = @habits.max {|a,b| a.length <=> b.length}[0].length
57
+ name_column_width = @habits.max {|a,b| a[0].length <=> b[0].length}[0].length
58
58
  day = Date.today - options[:days]
59
59
  print " " * (name_column_width + 2)
60
60
  (0..options[:days]).each do |i|
@@ -65,17 +65,23 @@ def log(options={})
65
65
  day = Date.today - (options[:days])
66
66
  print (sprintf("%#{name_column_width}s ", habit) + "|").colorize(36)
67
67
  times.collect! do |time|
68
- time.to_date
68
+ if time.is_a? Time
69
+ time.to_date
70
+ elsif time.is_a? Date
71
+ time
72
+ end
69
73
  end
74
+ done_in_last_30 = 0
70
75
  (0..options[:days]).each do |i|
71
76
  if times.include? day
72
77
  print "+"
73
- #print "+".colorize(34)
78
+ done_in_last_30 += 1
74
79
  else
75
80
  print " "
76
81
  end
77
82
  day += 1
78
83
  end
84
+ print "(#{done_in_last_30}/30)".colorize(36)
79
85
  puts
80
86
  end
81
87
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom MacWright