tlog 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTZkODM0YzY2Mjg1ZTUyZjllYjlhOWY4NDlhNjI5NzZmZjM0ZTlkNw==
4
+ ZjVhNjc5ZTAzNTFmMThkMjRhZWUyYThlZDUyNjRkOGZjZDc5ZTM5Yg==
5
5
  data.tar.gz: !binary |-
6
- ZTc4ZWQyMTY1ZTUxM2QzNzNlMWRjNTQ1N2EwYjgyY2VhNWZlNDkxNw==
6
+ ZjgxZTcxMzlhZmE5NzAxZjhiZGIzZmQ4YTRhYjQ2MzUwNzJhMGJkOQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MmY5N2M4YTM0MzQ4YWRlODYxMjY1OGNmNTY5Nzc5OTczMDA4OGI3MzgyMTE4
10
- ODdjMmNmNDU4OTFiZjk5ODBjMzUwYzc4YzlhOWQyMjM3Zjg0YzczMjBhMmE4
11
- ZTIwNDgwYjkzYzYwMDk2MGU2MTkxNjQ0YWQzZDFlYzYyY2Q3NDc=
9
+ YjE0ZmQ1NTBjMDIxMzVjMzUxYjI5NzI5NDBlOTFjOGE1OGYzMDcxOThmMjYx
10
+ NmJhZTUyYjIzZDg4ODQxNzlkNWRmMGQ5OTI1MmM2NTE2NmJjYWI5ZWVjMDA4
11
+ MWRhYTZlOTZjYmJhYjcwODc5OWZmMzI0OTc0ZWZmMmM3OTlkOGY=
12
12
  data.tar.gz: !binary |-
13
- ZTNhNDdlMzA4ZjU5MTZkYTg0OTE4YzA3MjNmNTVhM2IzYjBjYzNhZTE3MDFk
14
- ZDliZmY0NGFkYzQwYWEyYjI3OGE4MTE5NThjNjM1MjE1YzA3NWM0N2ZjMjcz
15
- MzUzYWNkZGJmM2EyZDNiMDY4NjU1ODE2YTdhZWNmNmMzMDIyZTI=
13
+ MzEzZjgyMTQyZDdiYjM5ODk5YjFhMmIxZTYyYjVhZDQ5YmRiODRhZTVlMWY3
14
+ MDljNGU1ZTczZmYxZmIyYTA1ZDIwMjM1YjkzNTBiYjkxZGE5NTExNDRjMjZk
15
+ NzM0YWUyNTU5NmI3NjU1MjQ1ZTMxYWEwNzJkZTdkNTViNWNjNTY=
data/lib/tlog.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Tlog
3
- Version = "0.2.4"
3
+ Version = "0.2.5"
4
4
 
5
5
  module Storage
6
6
  end
@@ -1,5 +1,4 @@
1
1
 
2
- # I will forever love whoever re-writes this class
3
2
  class Tlog::Command::Display < Tlog::Command
4
3
 
5
4
  def name
@@ -1,3 +1,4 @@
1
+
1
2
  class Tlog::Command::Stop < Tlog::Command
2
3
 
3
4
  def name
@@ -11,26 +12,29 @@ class Tlog::Command::Stop < Tlog::Command
11
12
  def execute(input, output)
12
13
  updated_log = stop
13
14
  output.line("Stopped '#{updated_log.name}'")
14
-
15
- # Commit working changes if neccessary
16
- commit_message = input.options[:message]
17
- if commit_message
18
- commit_working_changes(commit_message)
19
- output.line("'#{commit_message}': Commiting working changes on current branch")
15
+ current_branch = storage.current_branch
16
+ if input.options[:all]
17
+ commit_output = commit_working_changes(input.options[:message])
18
+ commit_message = input.options[:message]
19
+ output.line("#{commit_output}")
20
20
  end
21
21
  end
22
22
 
23
23
  def options(parser, options)
24
- parser.banner = "usage: tlog stop"
24
+ parser.banner = "usage: tlo stop"
25
+
26
+ parser.on("-a", "--all", "Stop current time log and commit tracked working changes") do |all|
27
+ options[:all] = all
28
+ end
25
29
 
26
- parser.on("-am", "--am <commit message>", "Stop current time log and commit tracked working changes") do |message|
30
+ parser.on("-m", "--message <commit_message>", "The commit message you want to be associated with this commit") do |message|
27
31
  options[:message] = message
28
32
  end
29
33
  end
30
34
 
31
35
  private
32
36
 
33
- def stop(message = nil)
37
+ def stop
34
38
  storage.in_branch do |wd|
35
39
  checked_out_log = storage.checkout_value
36
40
  raise Tlog::Error::CheckoutInvalid, "No time log is checked out" unless checked_out_log
@@ -126,7 +126,7 @@ class Tlog::Storage::Disk
126
126
  if current_log_name == log_name
127
127
  duration += time_since_start
128
128
  end
129
- log_entries(log_name).each do |entry| # should just be able to do log.entries.each
129
+ log_entries(log_name).each do |entry|
130
130
  duration += entry.length
131
131
  end
132
132
  duration
@@ -178,13 +178,17 @@ class Tlog::Storage::Disk
178
178
  Pathname.new(logs_path).children.select { |c| c.directory? } if Dir.exists?(logs_path)
179
179
  end
180
180
 
181
- # Code from 'ticgit', temporarily switches to tlog branch
181
+ def current_branch
182
+ git.lib.branch_current
183
+ end
184
+
185
+ # Temporarily switches to tlog branch
182
186
  def in_branch(branch_exists = true)
183
187
  unless File.directory?(@tlog_working)
184
188
  FileUtils.mkdir_p(@tlog_working)
185
189
  end
186
190
 
187
- old_current = git.lib.branch_current
191
+ old_current = current_branch
188
192
  begin
189
193
  git.lib.change_head_branch('tlog')
190
194
  git.with_index(@tlog_index) do
@@ -208,8 +212,6 @@ class Tlog::Storage::Disk
208
212
  def decode_log_path(log_path)
209
213
  if Dir.exists?(log_path)
210
214
  log = Tlog::Entity::Log.new(log_path)
211
- #log_storage.log_path = log_path # add this to the log class...i think task_store may not be neccessary
212
- #lgolog.entries = log_storage.entries
213
215
  end
214
216
  return log
215
217
  end
@@ -251,7 +253,7 @@ class Tlog::Storage::Disk
251
253
  FileUtils.rm(checkout_path)
252
254
  end
253
255
  else
254
- fals
256
+ false
255
257
  end
256
258
  end
257
259
 
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.2.4
4
+ version: 0.2.5
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-07-08 00:00:00.000000000 Z
11
+ date: 2013-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander