habittracker 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 546be2a9bca1b4182ae87a703a29caf75a1ea377
4
- data.tar.gz: fe5bdbb348ba33c18c79cec0ba91205e0508f866
3
+ metadata.gz: 7bfb699822074704c7fc066cdecdc4ce34f6f10b
4
+ data.tar.gz: edab41ae9552aeffcbe08a26ebbaa8d758803d86
5
5
  SHA512:
6
- metadata.gz: '09321ebc8e1228ccf42595a2c7633b48cb17dcd174aec5c91489526fc0c2858a8e7f8ed4bd65f45255ecdb0420c0f936b93d945a01d56988dcaaef198376fc98'
7
- data.tar.gz: 4a83603c97e9a48fbcdb748a1c4fbd9d420f7a7e1069d45e651a5146ad401710cde285dabba0b0d4924e8c04d58dac66ed2c34de0ac96332f4f6a6b147720e02
6
+ metadata.gz: 3e5c5fe3bb5b2e27b905e51b60224e9c8d135c0f22153484b58082910817eaff663cca2eb4c31a34fc09f86b1c4a5724c776d7fd8fdf764037a53ce788e38b4d
7
+ data.tar.gz: 22c06049d65d4ccd1b0194f86d56f7156741f4b4344de26b129df767e1ba6cd49fe088f76a777c29516de46aba6d80a38c56545e9257b02401e4350ae43bd8a8
data/README.md CHANGED
@@ -9,68 +9,92 @@ Habit Tracker
9
9
 
10
10
  ![](docs/linux_geek.jpg)
11
11
 
12
- ## How to install
13
- gem install habittracker
12
+ ## What you can do
13
+ Create a list of habits you want to track
14
+ ```bash
15
+ $ ht add "Play Tennis"
16
+ ```
17
+ If you like, you can schedule each habit,
14
18
 
15
- ## How to use it
19
+ ```bash
20
+ #Try to play tennis on each Saturday and Sunday
21
+ $ ht add "Play Tennis" --schedule 6,0
22
+ ```
16
23
 
24
+ have a reminder about what you should do today
25
+
26
+ ```bash
27
+ $ ht today
28
+ Today you should do:
29
+ * Play Tennis
30
+ ```
31
+
32
+ Track your activity
17
33
  ```bash
18
- >./ht add "Play Tennis" "Study German" "Do 20 pushups" "Miracle morning"
19
- >./ht do
34
+ $ ht do
20
35
  What did you do?
21
36
  1. Play Tennis
22
- 2. Study German
23
- 3. Do 20 pushup
24
- 4. Miracle morning
25
- ? 1
26
- When did you "Play Tennis" the last time?
37
+ 2. Reading that book
38
+ ? 2
39
+ When did you "Reading that book" the last time?
27
40
  1. Today
28
41
  2. Yesteday
29
- 3. Fri 13
30
- 4. Thu 12
31
- 5. Wed 11
32
- 6. Tue 10
42
+ 3. Tue 31
43
+ 4. Mon 30
44
+ 5. Sun 29
45
+ 6. Sat 28
33
46
  ? 1
47
+ Any notes?: "Alfred is not dead"
48
+ ```
49
+
50
+ and print a nice output with all your activities
51
+
52
+ ```bash
53
+ › bundle exec ht report
54
+ +-----+-------------+----------------------+
55
+ | February |
56
+ +-----+-------------+----------------------+
57
+ | Day | Play Tennis | Reading that book |
58
+ +-----+-------------+----------------------+
59
+ | 01 | | |
60
+ | 02 | | "Alfred is not dead" |
61
+ | 03 | | |
62
+ | 04 | | |
63
+ | 05 | | |
64
+ | 06 | | |
65
+ | 07 | | |
66
+ | 08 | | |
67
+ | 09 | | |
68
+ | 10 | | |
69
+ | 11 | | |
70
+ | 12 | | |
71
+ | 13 | | |
72
+ | 14 | | |
73
+ | 15 | | |
74
+ | 16 | | |
75
+ | 17 | | |
76
+ | 18 | | |
77
+ | 19 | | |
78
+ | 20 | | |
79
+ | 21 | | |
80
+ | 22 | | |
81
+ | 23 | | |
82
+ | 24 | | |
83
+ | 25 | | |
84
+ | 26 | | |
85
+ | 27 | | |
86
+ | 28 | | |
87
+ +-----+-------------+----------------------+
88
+ ```
89
+
90
+
91
+
92
+ ## How to install
93
+ gem install habittracker
94
+
95
+ ## How to use it
96
+
34
97
 
35
- ./ht report
36
-
37
- +-----+-------------+--------------+--------------+-----------------+
38
- | January |
39
- +-----+-------------+--------------+--------------+-----------------+
40
- | Day | Play Tennis | Study German | Do 20 pushup | Miracle morning |
41
- +-----+-------------+--------------+--------------+-----------------+
42
- | 01 | | | | X |
43
- | 02 | | | | X |
44
- | 03 | | | | X |
45
- | 04 | | | X | X |
46
- | 05 | | | | X |
47
- | 06 | | | X | X |
48
- | 07 | X | | | X |
49
- | 08 | X | X | X | X |
50
- | 09 | | | X | X |
51
- | 10 | X | | X | X |
52
- | 11 | | X | | X |
53
- | 12 | | | | X |
54
- | 13 | | X | X | X |
55
- | 14 | X | | X | X |
56
- | 15 | | | | X |
57
- | 16 | | X | X | X |
58
- | 17 | | | | X |
59
- | 18 | | | X | X |
60
- | 19 | | X | | X |
61
- | 20 | | | | X |
62
- | 21 | | X | X | X |
63
- | 22 | | | | X |
64
- | 23 | | X | | X |
65
- | 24 | X | | | X |
66
- | 25 | | | | X |
67
- | 26 | | | | X |
68
- | 27 | | X | | X |
69
- | 28 | X | | | X |
70
- | 29 | | | | X |
71
- | 30 | | | | X |
72
- | 31 | | | | X |
73
- +-----+-------------+--------------+--------------+-----------------+
74
98
  ```
75
99
  NAME:
76
100
 
@@ -88,6 +112,7 @@ When did you "Play Tennis" the last time?
88
112
  help Display global or [command] help documentation
89
113
  report Print the current month's activities
90
114
  rm Remove one or more habits from the list
115
+ today Shows the list of habits you should do today
91
116
 
92
117
  GLOBAL OPTIONS:
93
118
 
@@ -99,5 +124,7 @@ When did you "Play Tennis" the last time?
99
124
 
100
125
  -t, --trace
101
126
  Display backtrace when an error occurs
127
+ ```
128
+
102
129
 
103
130
 
data/exe/ht CHANGED
@@ -77,7 +77,10 @@ command :do do |c|
77
77
 
78
78
  selected_date = dates[index]
79
79
 
80
- archive.save(habit, selected_date)
80
+ message = ask("Any notes?: ")
81
+
82
+
83
+ archive.save(habit, selected_date, message)
81
84
  end
82
85
  end
83
86
 
@@ -9,7 +9,7 @@ class Archive
9
9
  to = Date.new(Time.now.year, 12, 31)
10
10
 
11
11
  @archive[habit] = from.upto(to).each_with_object({}) do |day, mem|
12
- mem[date_to_key(day)] = false
12
+ mem[date_to_key(day)] = nil
13
13
  mem
14
14
  end
15
15
  @archive[habit][:schedule] = days
@@ -49,12 +49,12 @@ class Archive
49
49
  puts Terminal::Table.new title: Time.now.strftime('%B'), headings: header, rows: rows
50
50
  end
51
51
 
52
- def save(habit, date)
52
+ def save(habit, date, note)
53
53
  calendar = @archive[habit]
54
54
  return if calendar.nil?
55
55
 
56
56
  key = date_to_key(date)
57
- calendar[key] = true
57
+ calendar[key] = note.length > 0 ? note : "X"
58
58
  store
59
59
  load_archive
60
60
  end
@@ -97,6 +97,6 @@ end
97
97
  end
98
98
 
99
99
  private def row_item(value)
100
- value ? { value: 'X', alignment: :center } : { value: '', alignment: :center }
100
+ value ? { value: value, alignment: :center } : { value: '', alignment: :center }
101
101
  end
102
102
  end
@@ -1,3 +1,3 @@
1
1
  module Habittracker
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habittracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignazio Calò
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler