tlog 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/TODO +4 -5
- data/lib/tlog.rb +1 -1
- data/lib/tlog/command/checkout.rb +1 -0
- data/lib/tlog/command/create.rb +12 -4
- data/lib/tlog/command/delete.rb +1 -0
- data/lib/tlog/command/display.rb +8 -4
- data/lib/tlog/command/owner.rb +3 -1
- data/lib/tlog/command/points.rb +3 -1
- data/lib/tlog/command/start.rb +3 -1
- data/lib/tlog/command/state.rb +3 -1
- data/lib/tlog/command/stop.rb +3 -1
- data/lib/tlog/entity/log.rb +5 -2
- data/lib/tlog/storage/disk.rb +3 -3
- data/tlog.gemspec +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWY4Y2M1ZmFlOGRmOTUzMzVjMDY0MmZiZTIyMzAyOTAzYjY3ZGE0OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDExZWNlMzcxY2Y1YTkwYmI4MTU4MWQ3ZjJiNGViOTEwNWFjMDYzNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzNiMzZiODgzY2QyOTc3NWY3MzU3MmIwY2U0YmUyNmQ4NTQzNGMyYmY0ZDE5
|
10
|
+
NTA3ODkzMzYxYTVmMTVkMGM2MjllNzQ4OTRiNGZjMzUzODk3YWNhOTNlY2Fj
|
11
|
+
NGMxNzllMjdlOWJhYzk4Mjk0Y2Q3YzhiNjhhNjQ5MjcyZGFhYjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2M1ZWVlZjI2YjljZGIzNTFhNjNlYjgyZDNmYTQwZjQ1NDA0NDY5NmMzNGI0
|
14
|
+
MTdmMzFiZDQ5ZjFjMGMwY2MxNjFmNWU3NGRmZTI2NjEyOTc5OTkzMDdlZjQ4
|
15
|
+
MTU4ZjIwNzgzNGFiYTk1NzNmMTcyYzI0ODM2M2M4ZjJiMDA2MTU=
|
data/TODO
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
-
|
2
|
-
-
|
3
|
-
-
|
4
|
-
-
|
5
|
-
-time zones....
|
1
|
+
- tests
|
2
|
+
- rakefile
|
3
|
+
- time zones....
|
4
|
+
- display update speicifc states, points values, owners. goal times
|
data/lib/tlog.rb
CHANGED
@@ -12,6 +12,7 @@ class Tlog::Command::Checkout < Tlog::Command
|
|
12
12
|
def execute(input, output)
|
13
13
|
raise Tlog::Error::CommandInvalid, "Must specify log name" unless input.args[0]
|
14
14
|
checkout(input.args[0])
|
15
|
+
output.line("Checked-out log '#{input.args[0]}'");
|
15
16
|
end
|
16
17
|
|
17
18
|
def options(parser, options)
|
data/lib/tlog/command/create.rb
CHANGED
@@ -14,8 +14,8 @@ class Tlog::Command::Create < Tlog::Command
|
|
14
14
|
|
15
15
|
log = Tlog::Entity::Log.new
|
16
16
|
log.name = input.args[0];
|
17
|
-
log
|
18
|
-
|
17
|
+
create_log(log, input.options)
|
18
|
+
output.line("Created log '#{log.name}'")
|
19
19
|
end
|
20
20
|
|
21
21
|
def options(parser, options)
|
@@ -24,13 +24,21 @@ class Tlog::Command::Create < Tlog::Command
|
|
24
24
|
parser.on("-g", "--goal <goal_length>") do |goal|
|
25
25
|
options[:goal] = goal
|
26
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
|
27
35
|
end
|
28
36
|
|
29
37
|
private
|
30
38
|
|
31
|
-
def create_log(log)
|
39
|
+
def create_log(log, options)
|
32
40
|
storage.in_branch do |wd|
|
33
|
-
raise Tlog::Error::CommandInvalid, "Time log '#{log.name}' already exists" unless storage.create_log(log)
|
41
|
+
raise Tlog::Error::CommandInvalid, "Time log '#{log.name}' already exists" unless storage.create_log(log, options)
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
data/lib/tlog/command/delete.rb
CHANGED
data/lib/tlog/command/display.rb
CHANGED
@@ -26,11 +26,15 @@ class Tlog::Command::Display < Tlog::Command
|
|
26
26
|
|
27
27
|
def display(log_name, length_threshold, output)
|
28
28
|
storage.in_branch do |wd|
|
29
|
-
if
|
30
|
-
|
29
|
+
if storage.all_log_dirs
|
30
|
+
if log_name
|
31
|
+
display_log(log_name, length_threshold, output)
|
32
|
+
else
|
33
|
+
display_all(length_threshold, output)
|
34
|
+
end
|
31
35
|
else
|
32
|
-
|
33
|
-
end
|
36
|
+
output.line("No time logs yet");
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
data/lib/tlog/command/owner.rb
CHANGED
@@ -11,7 +11,8 @@ class Tlog::Command::Owner < Tlog::Command
|
|
11
11
|
|
12
12
|
def execute(input, output)
|
13
13
|
new_owner = input.args[0]
|
14
|
-
change_owner(new_owner)
|
14
|
+
updated_log = change_owner(new_owner)
|
15
|
+
output.line("Changed owner of '#{updated_log.name}' to #{new_owner}")
|
15
16
|
end
|
16
17
|
|
17
18
|
def options(parser, options)
|
@@ -27,6 +28,7 @@ class Tlog::Command::Owner < Tlog::Command
|
|
27
28
|
log = storage.require_log(checked_out_log)
|
28
29
|
raise Tlog::Error::TimeLogNotFound, "Time log '#{checked_out_log}' does not exist" unless log
|
29
30
|
storage.change_log_owner(log, new_owner)
|
31
|
+
log
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/tlog/command/points.rb
CHANGED
@@ -11,7 +11,8 @@ class Tlog::Command::Points < Tlog::Command
|
|
11
11
|
|
12
12
|
def execute(input, output)
|
13
13
|
new_points_value = input.args[0]
|
14
|
-
change_state(new_points_value)
|
14
|
+
update_log = change_state(new_points_value)
|
15
|
+
output.line("Changed points of '#{updated_log.name}' to #{new_points_value}")
|
15
16
|
end
|
16
17
|
|
17
18
|
def options(parser, options)
|
@@ -27,6 +28,7 @@ class Tlog::Command::Points < Tlog::Command
|
|
27
28
|
log = storage.require_log(checked_out_log)
|
28
29
|
raise Tlog::Error::TimeLogNotFound, "Time log '#{checked_out_log}' does not exist" unless log
|
29
30
|
storage.change_log_points(log, points)
|
31
|
+
log
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/tlog/command/start.rb
CHANGED
@@ -10,7 +10,8 @@ class Tlog::Command::Start < Tlog::Command
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def execute(input, output)
|
13
|
-
start(input.options[:description])
|
13
|
+
updated_log = start(input.options[:description])
|
14
|
+
output.line("Started '#{updated_log.name}'")
|
14
15
|
end
|
15
16
|
|
16
17
|
def options(parser, options)
|
@@ -32,6 +33,7 @@ class Tlog::Command::Start < Tlog::Command
|
|
32
33
|
unless storage.start_log(log, entry_description)
|
33
34
|
raise Tlog::Error::CommandInvalid, "Time log '#{checked_out_log}' is already in progress"
|
34
35
|
end
|
36
|
+
log
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
data/lib/tlog/command/state.rb
CHANGED
@@ -11,7 +11,8 @@ class Tlog::Command::State < Tlog::Command
|
|
11
11
|
|
12
12
|
def execute(input, output)
|
13
13
|
new_state = input.args[0]
|
14
|
-
change_state(new_state)
|
14
|
+
updated_log = change_state(new_state)
|
15
|
+
output.line("Changed state of '#{updated_log.name}' to #{new_state}")
|
15
16
|
end
|
16
17
|
|
17
18
|
def options(parser, options)
|
@@ -27,6 +28,7 @@ class Tlog::Command::State < Tlog::Command
|
|
27
28
|
log = storage.require_log(checked_out_log)
|
28
29
|
raise Tlog::Error::TimeLogNotFound, "Time log '#{checked_out_log}' does not exist" unless log
|
29
30
|
storage.change_log_state(log, new_state)
|
31
|
+
log
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/tlog/command/stop.rb
CHANGED
@@ -9,7 +9,8 @@ class Tlog::Command::Stop < Tlog::Command
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def execute(input, output)
|
12
|
-
stop
|
12
|
+
updated_log = stop
|
13
|
+
output.line("Stopped '#{updated_log.name}'")
|
13
14
|
end
|
14
15
|
|
15
16
|
def options(parser, options)
|
@@ -27,6 +28,7 @@ class Tlog::Command::Stop < Tlog::Command
|
|
27
28
|
unless storage.stop_log(log)
|
28
29
|
raise Tlog::Error::CommandInvalid, "Failed to stop log '#{checked_out_log}': This time log is not in progress"
|
29
30
|
end
|
31
|
+
log
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
data/lib/tlog/entity/log.rb
CHANGED
@@ -17,10 +17,13 @@ class Tlog::Entity::Log
|
|
17
17
|
|
18
18
|
def create(options)
|
19
19
|
unless Dir.exists?(@path)
|
20
|
-
|
20
|
+
# Default time log attribute values
|
21
21
|
state = 'open'
|
22
22
|
points = 0
|
23
|
-
owner = 'none'
|
23
|
+
owner = 'none'
|
24
|
+
|
25
|
+
FileUtils.mkdir_p(@path)
|
26
|
+
@goal = ChronicDuration.parse(options[:goal]) if options[:goal]
|
24
27
|
state = options[:state] if options[:state]
|
25
28
|
points = options[:points] if options[:point]
|
26
29
|
owner = options[:owner] if options[:owner]
|
data/lib/tlog/storage/disk.rb
CHANGED
@@ -9,7 +9,6 @@ class Tlog::Storage::Disk
|
|
9
9
|
|
10
10
|
def initialize(git_dir)
|
11
11
|
@git = Git.open(find_repo(git_dir))
|
12
|
-
# Format class?
|
13
12
|
proj_path = @git.dir.path.downcase.gsub(/[^a-z0-9]+/i, '-')
|
14
13
|
|
15
14
|
@tlog_dir = '~/.tlog'
|
@@ -35,6 +34,7 @@ class Tlog::Storage::Disk
|
|
35
34
|
|
36
35
|
def create_log(log, options = {})
|
37
36
|
log.path = log_path(log.name)
|
37
|
+
options[:owner] = cur_user
|
38
38
|
if log.create(options)
|
39
39
|
git.add
|
40
40
|
git.commit("Created log '#{log.name}'")
|
@@ -64,7 +64,7 @@ class Tlog::Storage::Disk
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def require_log(log_name)
|
67
|
-
decode_log_path(Pathname.new(log_path(log_name)))
|
67
|
+
decode_log_path(Pathname.new(log_path(log_name))) if logs_path
|
68
68
|
end
|
69
69
|
|
70
70
|
def start_log(log, entry_description)
|
@@ -175,7 +175,7 @@ class Tlog::Storage::Disk
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def all_log_dirs
|
178
|
-
Pathname.new(logs_path).children.select { |c| c.directory? }
|
178
|
+
Pathname.new(logs_path).children.select { |c| c.directory? } if Dir.exists?(logs_path)
|
179
179
|
end
|
180
180
|
|
181
181
|
# Code from 'ticgit', temporarily switches to tlog branch
|
data/tlog.gemspec
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Used for Tlog::Version
|
4
|
+
require 'tlog'
|
1
5
|
|
2
6
|
Gem::Specification.new do |spec|
|
3
7
|
|
4
8
|
spec.name = "tlog"
|
5
|
-
spec.version =
|
6
|
-
spec.date = "2013-06-04"
|
9
|
+
spec.version = Tlog::Version
|
7
10
|
|
8
11
|
spec.required_ruby_version = ">=1.9.3"
|
9
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wendel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|