tlog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +172 -30
- data/TODO +1 -0
- data/lib/tlog/application.rb +56 -56
- data/lib/tlog/command/active.rb +48 -48
- data/lib/tlog/command/checkout.rb +31 -31
- data/lib/tlog/command/create.rb +40 -40
- data/lib/tlog/command/delete.rb +21 -21
- data/lib/tlog/command/display.rb +195 -148
- data/lib/tlog/command/help.rb +33 -33
- data/lib/tlog/command/owner.rb +25 -25
- data/lib/tlog/command/points.rb +25 -25
- data/lib/tlog/command/pull.rb +18 -18
- data/lib/tlog/command/push.rb +18 -18
- data/lib/tlog/command/start.rb +35 -35
- data/lib/tlog/command/state.rb +25 -25
- data/lib/tlog/command/stop.rb +26 -26
- data/lib/tlog/command.rb +9 -8
- data/lib/tlog/command_suite.rb +29 -29
- data/lib/tlog/entity/active_log.rb +8 -8
- data/lib/tlog/entity/entry.rb +77 -77
- data/lib/tlog/entity/log.rb +161 -161
- data/lib/tlog/error.rb +3 -0
- data/lib/tlog/format/date_time.rb +4 -3
- data/lib/tlog/format/seconds.rb +10 -9
- data/lib/tlog/input.rb +6 -6
- data/lib/tlog/output.rb +28 -28
- data/lib/tlog/storage/disk.rb +326 -326
- data/lib/tlog.rb +1 -1
- metadata +2 -4
- data/lib/tlog/command/init.rb +0 -38
- data/lib/tlog/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZmJmMGNhZmU4MDBlZTg2NmNkOGIzYTNlNWE4MGVjZDBmZjIwZGQxNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWJkODdkOGRhZGZlNDBmNTc1NmUxMjY4MzQ3N2UzZDNjMzFlNGQ1Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzBkNDY2NDVhNGMwNDYyNzFjYWEzYjE2ZWQwM2JhMjAzZjlkMmY4MTY3YmZi
|
10
|
+
MjU5OWIxNzNjYmNjZjUyOTlhMTg4NWJhNDAyOTdlMGE1YjczNGZiNGU0MmMy
|
11
|
+
YjU1YjgxMmRmY2U5MjY1NTFiMjE1NzQ3MjQ5MzgyMDhkNGFlOWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjkwODIzMWI5N2RhODcxZDg3ZGE5ZGFmMWI5YTVmMjYxZjc2MmViY2JkYTA4
|
14
|
+
NjhjOTIwNGI4Y2Y4MGFlNmMyM2ExNjY5MDVhNTQ5MzQxYjM4Y2ZlMzIwYjBj
|
15
|
+
MWUzMmJlYjg3ZmY2YmQ0YWIxOWU0OTM4MTA5OGQxOTgwOTI4YzE=
|
data/README.md
CHANGED
@@ -8,68 +8,210 @@ A git-based CLI to help you with time tracking on your projects.
|
|
8
8
|
$ sudo gem install tlog
|
9
9
|
```
|
10
10
|
|
11
|
-
|
11
|
+
# Usage
|
12
12
|
* Navigate to a directory that has a git repo
|
13
13
|
|
14
|
-
|
14
|
+
## Create a time log
|
15
|
+
|
16
|
+
#### Create a default time log with no goal
|
15
17
|
```bash
|
16
18
|
$ tlog create example
|
17
19
|
```
|
18
20
|
|
19
|
-
|
21
|
+
#### Create a time log with a time goal
|
20
22
|
```bash
|
21
|
-
$ tlog
|
23
|
+
$ tlog create example --goal 4hr
|
22
24
|
```
|
23
25
|
|
24
|
-
|
26
|
+
#### Create a new time log with a state and a points value
|
25
27
|
```bash
|
26
|
-
$ tlog create example --
|
28
|
+
$ tlog create example --state OPEN --points 10
|
27
29
|
```
|
30
|
+
## Displaying time logs
|
28
31
|
|
29
|
-
|
32
|
+
#### Display all time logs
|
30
33
|
```bash
|
31
|
-
$ tlog
|
34
|
+
$ tlog display
|
35
|
+
Log: bugfix
|
36
|
+
State: open
|
37
|
+
Points: 10
|
38
|
+
Owner: andrew
|
39
|
+
Start End Duration Description
|
40
|
+
June 06, 12:45PM June 06, 12:46PM 1:00:27 fixing really bad bug
|
41
|
+
June 07,
|
42
|
+
----------------------------------------------------------------------------------------------------
|
43
|
+
Total 1:00:27
|
44
|
+
Time left: 0:59:33
|
45
|
+
Log: important
|
46
|
+
State: closed
|
47
|
+
Points: 0
|
48
|
+
Owner: chris
|
49
|
+
Start End Duration Description
|
50
|
+
----------------------------------------------------------------------------------------------------
|
51
|
+
Total 0:00:00
|
52
|
+
Log: feature1
|
53
|
+
State: hold
|
54
|
+
Points: 5
|
55
|
+
Owner: peter
|
56
|
+
Start End Duration Description
|
57
|
+
June 13, 12:32PM June 13, 12:33PM 0:00:34 making sure new feature works
|
58
|
+
June 13, 12:29PM June 13, 12:32PM 0:02:30 working on new feature
|
59
|
+
----------------------------------------------------------------------------------------------------
|
60
|
+
Total 0:03:04
|
61
|
+
Time left: 3:56:56
|
62
|
+
```
|
63
|
+
|
64
|
+
#### Display a specific time log
|
65
|
+
```bash
|
66
|
+
$ tlog display feature1
|
67
|
+
Log: feature1
|
68
|
+
State: hold
|
69
|
+
Points: 5
|
70
|
+
Owner: peter
|
71
|
+
Start End Duration Description
|
72
|
+
June 13, 12:32PM June 13, 12:33PM 0:00:34 making sure new feature works
|
73
|
+
June 13, 12:29PM June 13, 12:32PM 0:02:30 working on new feature
|
74
|
+
----------------------------------------------------------------------------------------------------
|
75
|
+
Total 0:03:04
|
76
|
+
Time left: 3:56:56
|
32
77
|
```
|
33
78
|
|
34
|
-
|
79
|
+
#### Constrain displayed time logs to only ones with specified states
|
35
80
|
```bash
|
36
|
-
$ tlog
|
81
|
+
$ tlog display -s open,hold
|
82
|
+
Log: bugfix
|
83
|
+
State: open
|
84
|
+
Points: 10
|
85
|
+
Owner: andrew
|
86
|
+
Start End Duration Description
|
87
|
+
June 06, 12:45PM June 06, 12:46PM 1:00:27 fixing really bad bug
|
88
|
+
June 07,
|
89
|
+
----------------------------------------------------------------------------------------------------
|
90
|
+
Total 1:00:27
|
91
|
+
Time left: 0:59:33
|
92
|
+
Log: feature1
|
93
|
+
State: hold
|
94
|
+
Points: 5
|
95
|
+
Owner: peter
|
96
|
+
Start End Duration Description
|
97
|
+
June 13, 12:32PM June 13, 12:33PM 0:00:34 making sure new feature works
|
98
|
+
June 13, 12:29PM June 13, 12:32PM 0:02:30 working on new feature
|
99
|
+
----------------------------------------------------------------------------------------------------
|
100
|
+
Total 0:03:04
|
101
|
+
Time left: 3:56:56
|
102
|
+
```
|
103
|
+
#### Constrain displayed time logs to only ones with specified owners
|
104
|
+
```bash
|
105
|
+
$ tlog display -o chris,peter
|
106
|
+
Log: important
|
107
|
+
State: closed
|
108
|
+
Points: 0
|
109
|
+
Owner: chris
|
110
|
+
Start End Duration Description
|
111
|
+
----------------------------------------------------------------------------------------------------
|
112
|
+
Total 0:00:00
|
113
|
+
Log: feature1
|
114
|
+
State: hold
|
115
|
+
Points: 5
|
116
|
+
Owner: peter
|
117
|
+
Start End Duration Description
|
118
|
+
June 13, 12:32PM June 13, 12:33PM 0:00:34 making sure new feature works
|
119
|
+
June 13, 12:29PM June 13, 12:32PM 0:02:30 working on new feature
|
120
|
+
----------------------------------------------------------------------------------------------------
|
121
|
+
Total 0:03:04
|
122
|
+
Time left: 3:56:56
|
123
|
+
```
|
124
|
+
|
125
|
+
#### Contrain displayed time logs to only ones that have points values >= the specified points value
|
126
|
+
```bash
|
127
|
+
$ tlog display -p 10
|
128
|
+
Log: bugfix
|
129
|
+
State: open
|
130
|
+
Points: 10
|
131
|
+
Owner: andrew
|
132
|
+
Start End Duration Description
|
133
|
+
June 06, 12:45PM June 06, 12:46PM 1:00:27 fixing really bad bug
|
134
|
+
June 07,
|
135
|
+
----------------------------------------------------------------------------------------------------
|
136
|
+
Total 1:00:27
|
137
|
+
Time left: 0:59:33
|
37
138
|
```
|
38
139
|
|
39
|
-
|
140
|
+
#### Constrain displayed time logs to only ones that have less than the specified amount of time left to finish
|
141
|
+
```bash
|
142
|
+
$ tlog display -g 1hr
|
143
|
+
Log: bugfix
|
144
|
+
State: open
|
145
|
+
Points: 10
|
146
|
+
Owner: andrew
|
147
|
+
Start End Duration Description
|
148
|
+
June 06, 12:45PM June 06, 12:46PM 1:00:27 fixing really bad bug
|
149
|
+
June 07,
|
150
|
+
----------------------------------------------------------------------------------------------------
|
151
|
+
Total 1:00:27
|
152
|
+
Time left: 0:59:33
|
153
|
+
```
|
154
|
+
|
155
|
+
#### Show active time logs and label the checked-out log or the in-progress log
|
40
156
|
```bash
|
41
157
|
$ tlog active
|
42
158
|
All Time Logs:
|
43
159
|
testing
|
44
|
-
feature1(
|
160
|
+
feature1(in-progress)
|
45
161
|
bug fix
|
46
162
|
feature2
|
47
163
|
```
|
48
|
-
|
49
|
-
|
164
|
+
|
165
|
+
## Using time logs
|
166
|
+
|
167
|
+
#### Check out a time log
|
168
|
+
```bash
|
169
|
+
$ tlog checkout example
|
170
|
+
```
|
171
|
+
|
172
|
+
#### Start a new task the checked-out time log
|
50
173
|
```bash
|
51
|
-
$ tlog
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
Time left: 3:57:24
|
64
|
-
```
|
174
|
+
$ tlog start -d "My task description"
|
175
|
+
```
|
176
|
+
|
177
|
+
#### Update the state of the checked-out time log
|
178
|
+
```bash
|
179
|
+
$ tlog state CLOSED
|
180
|
+
```
|
181
|
+
|
182
|
+
#### Update the points value of the checked-out time log
|
183
|
+
```bash
|
184
|
+
$ tlog points 10
|
185
|
+
```
|
65
186
|
|
66
|
-
|
187
|
+
#### Update the owner of the checked-out time log
|
188
|
+
```bash
|
189
|
+
$ tlog owner cewendel
|
190
|
+
```
|
191
|
+
|
192
|
+
#### Stop the current task
|
193
|
+
```bash
|
194
|
+
$ tlog stop example
|
195
|
+
```
|
196
|
+
|
197
|
+
#### Delete a time log
|
67
198
|
```bash
|
68
199
|
$ tlog delete example
|
69
200
|
```
|
70
201
|
|
71
202
|
## Collaboration
|
72
|
-
|
203
|
+
|
204
|
+
tlog makes for easy time and ticket tracking when working with a team. Assuming you have a remote repo that you and others are pushing to, use the `tlog push` and `tlog pull` commands to keep your time logs up to date.
|
205
|
+
|
206
|
+
### Pull in new or updated time logs from upstream
|
207
|
+
```bash
|
208
|
+
$ tlog pull
|
209
|
+
```
|
210
|
+
|
211
|
+
### Push new or updated time logs upstream
|
212
|
+
```bash
|
213
|
+
$ tlog push
|
214
|
+
```
|
73
215
|
|
74
216
|
## Contributing
|
75
217
|
|
data/TODO
CHANGED
data/lib/tlog/application.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
1
|
|
2
2
|
class Tlog::Application
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
4
|
+
def initialize(input, output)
|
5
|
+
@input = input
|
6
|
+
@output = output
|
7
|
+
end
|
8
|
+
|
9
|
+
def run
|
10
|
+
command_name = ""
|
11
|
+
outcome = false
|
12
|
+
begin
|
13
|
+
command_name = @input.args.shift
|
14
|
+
command = find(command_name)
|
15
|
+
prepare_command(command)
|
16
|
+
outcome = run_command(command)
|
17
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
18
|
+
@output.error($!)
|
19
|
+
@output.error(@optparse.to_s)
|
20
|
+
rescue Tlog::Error::CommandInvalid
|
21
|
+
@output.error(command_name + " command invalid: " + $!.message)
|
22
|
+
@output.error(@optparse.to_s)
|
23
|
+
rescue Tlog::Error::CommandNotFound, OptionParser::MissingArgument
|
24
|
+
@output.error($!)
|
25
|
+
@output.error(@optparse.to_s)
|
26
|
+
rescue
|
27
|
+
@output.error($!)
|
28
|
+
end
|
29
|
+
return outcome
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def find(command_name)
|
35
|
+
commands = Tlog::Command_Suite.commands
|
36
|
+
command = nil
|
37
|
+
commands.each do |cmd|
|
38
|
+
return cmd if cmd.name == command_name
|
39
|
+
end
|
40
|
+
command
|
41
|
+
end
|
42
|
+
|
43
|
+
def prepare_command(command)
|
44
|
+
if !command.nil?
|
45
|
+
@optparse = OptionParser.new do |parser|
|
46
|
+
command.options(parser, @input.options)
|
47
|
+
end
|
48
|
+
@optparse.parse!(@input.args)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def run_command(command)
|
53
|
+
if !command.nil?
|
54
|
+
command.execute(@input, @output)
|
55
|
+
true
|
56
|
+
else
|
57
|
+
raise Tlog::Error::CommandNotFound, "Command not found, use 'tlog help' for list of commands"
|
58
|
+
end
|
59
|
+
end
|
60
60
|
|
61
61
|
end
|
data/lib/tlog/command/active.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
|
2
2
|
class Tlog::Command::Active < Tlog::Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
4
|
+
def name
|
5
|
+
"active"
|
6
|
+
end
|
7
|
+
|
8
|
+
def description
|
9
|
+
"prints out all active time logs, the time log in-progress if there is one. Or the currently checked-out time log"
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute(input, output)
|
13
|
+
print_time_entry(output)
|
14
|
+
end
|
15
|
+
|
16
|
+
def options(parser, options)
|
17
|
+
parser.banner = "usage: tlog active"
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def print_time_entry(output)
|
23
|
+
storage.in_branch do |wd|
|
24
|
+
all_logs = @storage.all_log_dirs
|
25
|
+
active_logs = []
|
26
|
+
all_logs.each do |log|
|
27
|
+
log_name = log.basename.to_s
|
28
|
+
active_log = Tlog::Entity::Active_Log.new(log_name)
|
29
|
+
active_log.current = true if storage.current_log_name == log_name
|
30
|
+
active_log.checked_out = true if storage.checkout_value == log_name
|
31
|
+
active_logs.push(active_log)
|
32
|
+
end
|
33
|
+
output.line_yellow("All Time Logs:")
|
34
|
+
print_logs(active_logs, output)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def print_logs(active_logs, output)
|
39
|
+
active_logs.each do |active_log|
|
40
|
+
out_line = active_log.name
|
41
|
+
if active_log.current
|
42
|
+
out_line << " (in-progress)"
|
43
|
+
output.line_red(out_line);
|
44
|
+
elsif active_log.checked_out
|
45
|
+
out_line << " (checked_out)"
|
46
|
+
output.line_blue(out_line)
|
47
|
+
else
|
48
|
+
output.line(out_line)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
52
|
|
53
53
|
end
|
@@ -1,36 +1,36 @@
|
|
1
1
|
|
2
2
|
class Tlog::Command::Checkout < Tlog::Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
4
|
+
def name
|
5
|
+
"checkout"
|
6
|
+
end
|
7
|
+
|
8
|
+
def description
|
9
|
+
"checkouts a time log in order to start tasks on"
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute(input, output)
|
13
|
+
raise Tlog::Error::CommandInvalid, "Must specify log name" unless input.args[0]
|
14
|
+
checkout(input.args[0])
|
15
|
+
output.line("Checked-out log '#{input.args[0]}'");
|
16
|
+
end
|
17
|
+
|
18
|
+
def options(parser, options)
|
19
|
+
parser.banner = "usage: tlog checkout <log_name>"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def checkout(log_name)
|
25
|
+
storage.in_branch do |wd|
|
26
|
+
log = storage.require_log(log_name)
|
27
|
+
raise Tlog::Error::TimeLogNotFound, "Time log '#{log_name}' does not exist" unless log
|
28
|
+
checked_out_log = storage.checkout_value
|
29
|
+
if checked_out_log == log.name
|
30
|
+
raise Tlog::Error::CommandInvalid, "Time log '#{log_name}' is currently checked out "
|
31
|
+
end
|
32
|
+
storage.checkout_log(log)
|
33
|
+
end
|
34
|
+
end
|
35
35
|
|
36
36
|
end
|
data/lib/tlog/command/create.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
|
2
2
|
class Tlog::Command::Create < Tlog::Command
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
4
|
+
def name
|
5
|
+
"create"
|
6
|
+
end
|
7
|
+
|
8
|
+
def description
|
9
|
+
"creates a new time log either with no goal or with a goal"
|
10
|
+
end
|
11
|
+
|
12
|
+
def execute(input, output)
|
13
|
+
raise Tlog::Error::CommandInvalid, "Must specify log name" unless input.args[0]
|
14
|
+
|
15
|
+
log = Tlog::Entity::Log.new
|
16
|
+
log.name = input.args[0];
|
17
|
+
create_log(log, input.options)
|
18
|
+
output.line("Created log '#{log.name}'")
|
19
|
+
end
|
20
|
+
|
21
|
+
def options(parser, options)
|
22
|
+
parser.banner = "usage: tlog create <log_name>"
|
23
|
+
|
24
|
+
parser.on("-g", "--goal <goal_length>") do |goal|
|
25
|
+
options[:goal] = goal
|
26
|
+
end
|
27
|
+
|
28
|
+
parser.on("-s", "--state <initial_state>") do |state|
|
29
|
+
options[:state] = state
|
30
|
+
end
|
31
|
+
|
32
|
+
parser.on("-p", "--points <initial_points_value>") do |points|
|
33
|
+
options[:points] = points
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def create_log(log, options)
|
40
|
+
storage.in_branch do |wd|
|
41
|
+
raise Tlog::Error::CommandInvalid, "Time log '#{log.name}' already exists" unless storage.create_log(log, options)
|
42
|
+
end
|
43
|
+
end
|
44
44
|
end
|