mytime 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mytime.rb +18 -1
- data/lib/mytime/timesheet.rb +3 -0
- data/lib/mytime/version.rb +1 -1
- metadata +2 -2
data/lib/mytime.rb
CHANGED
@@ -37,6 +37,8 @@ module Mytime
|
|
37
37
|
when :project, :detail, :info
|
38
38
|
puts "Project Details:"
|
39
39
|
puts config_details(Dir.pwd).to_yaml
|
40
|
+
when :debug
|
41
|
+
puts init?
|
40
42
|
else
|
41
43
|
puts @options
|
42
44
|
end
|
@@ -77,9 +79,24 @@ module Mytime
|
|
77
79
|
else
|
78
80
|
data.each do |d|
|
79
81
|
project = data.select{|key, hash| hash["project_path"] == path }
|
80
|
-
return project.first[1]
|
82
|
+
return project.first[1] if project.any?
|
81
83
|
end
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
87
|
+
# Check if mytime is setup
|
88
|
+
def setup?
|
89
|
+
config_details.has_key?("account")
|
90
|
+
end
|
91
|
+
|
92
|
+
# Check if mytime is initialized for this project
|
93
|
+
def init?
|
94
|
+
config_details(Dir.pwd).has_key?("project_id")
|
95
|
+
end
|
96
|
+
|
97
|
+
def finish_setup
|
98
|
+
return puts "Please run `mytime setup` connect your account." unless setup?
|
99
|
+
return puts "Please run `'mytime init` to setup this project directory" unless init?
|
100
|
+
end
|
101
|
+
|
85
102
|
end
|
data/lib/mytime/timesheet.rb
CHANGED
@@ -4,6 +4,7 @@ module Mytime
|
|
4
4
|
# Return log of git commits from today
|
5
5
|
#
|
6
6
|
def status
|
7
|
+
return finish_setup unless setup? && init?
|
7
8
|
user = `git config --get user.name`
|
8
9
|
`git log --oneline --author='#{user}' --since='6am'`
|
9
10
|
end
|
@@ -15,6 +16,7 @@ module Mytime
|
|
15
16
|
# message: Optional - custom message to send with time entry
|
16
17
|
#
|
17
18
|
def commit(hours, message = "")
|
19
|
+
return finish_setup unless setup? && init?
|
18
20
|
puts "Submitting: #{message}"
|
19
21
|
puts Client.submit(hours, message)
|
20
22
|
end
|
@@ -25,6 +27,7 @@ module Mytime
|
|
25
27
|
# hours: Required parameter for number of hours on time entry
|
26
28
|
#
|
27
29
|
def push(hours)
|
30
|
+
return finish_setup unless setup? && init?
|
28
31
|
puts Client.submit(hours, status)
|
29
32
|
end
|
30
33
|
|
data/lib/mytime/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mytime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-freshbooks
|