dotime 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/README.txt +1 -1
- data/bin/dotime +4 -3
- data/lib/do_time.rb +29 -20
- metadata +11 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.0.6 / 2007-02-21
|
2
|
+
* Allowing basic lists selection to access more than 10 items
|
3
|
+
* Adding required basecamp account url to executable
|
4
|
+
* Fixing bug: when a project had no valid lists, dotime would still try and display them
|
5
|
+
|
1
6
|
== 0.0.5 / 2007-01-29
|
2
7
|
* Updated basecamp lib with patch to fix typecast bug.
|
3
8
|
|
data/README.txt
CHANGED
data/bin/dotime
CHANGED
@@ -26,13 +26,14 @@ ARGV.options do |opts|
|
|
26
26
|
|
27
27
|
|
28
28
|
Examples:
|
29
|
-
dotime -u my_basecamp_login -p my_basecamp_password
|
29
|
+
dotime -u my_basecamp_login -p my_basecamp_password -a webtypes.projectpath.com
|
30
30
|
EOF
|
31
31
|
|
32
32
|
opts.on(" Required:")
|
33
33
|
|
34
34
|
opts.on("-u", "--user=login", "A Basecamp account login", String) { |OPTIONS[:login]| }
|
35
35
|
opts.on("-p", "--password=password", "A Basecamp account password", String) { |OPTIONS[:password]| }
|
36
|
+
opts.on("-a", "--account=url", "A Basecamp account url e.g. webtypes.projectpath.com", String) { |OPTIONS[:url]| }
|
36
37
|
|
37
38
|
opts.separator ""
|
38
39
|
opts.separator "Options:"
|
@@ -43,8 +44,8 @@ ARGV.options do |opts|
|
|
43
44
|
opts.parse!
|
44
45
|
end
|
45
46
|
|
46
|
-
unless OPTIONS[:login] && OPTIONS[:password]
|
47
|
+
unless OPTIONS[:login] && OPTIONS[:password] && OPTIONS[:url]
|
47
48
|
puts ARGV.options; exit
|
48
49
|
else
|
49
|
-
DoTime.new([OPTIONS[:login], OPTIONS[:password], OPTIONS[:use_ssl]]).run
|
50
|
+
DoTime.new([OPTIONS[:login], OPTIONS[:password], OPTIONS[:use_ssl], OPTIONS[:url]]).run
|
50
51
|
end
|
data/lib/do_time.rb
CHANGED
@@ -18,7 +18,7 @@ require File.dirname(__FILE__) + '/basecamp'
|
|
18
18
|
require 'optparse'
|
19
19
|
|
20
20
|
class DoTime
|
21
|
-
VERSION = '0.0.
|
21
|
+
VERSION = '0.0.6'
|
22
22
|
|
23
23
|
include HighLine::SystemExtensions
|
24
24
|
|
@@ -39,10 +39,11 @@ class DoTime
|
|
39
39
|
[SPACE_KEY, 'Stop running todo','Stop timing the only running todo. Otherwise starts next available todo']
|
40
40
|
]
|
41
41
|
|
42
|
-
attr_accessor :login, :password, :use_ssl, :session, :current_owner, :current_project, :valid_lists, :current_list, :running_todos
|
42
|
+
attr_accessor :bc_url, :login, :password, :use_ssl, :session, :current_owner, :current_project, :valid_lists, :current_list, :running_todos
|
43
43
|
|
44
44
|
def initialize(args)
|
45
|
-
@login, @password, @use_ssl = *args
|
45
|
+
@login, @password, @use_ssl, @bc_url = *args
|
46
|
+
@bc_url ||= 'webtypes.projectpath.com'
|
46
47
|
init_bc_session
|
47
48
|
@valid_lists = []
|
48
49
|
@running_todos = {}
|
@@ -55,9 +56,7 @@ class DoTime
|
|
55
56
|
select_project
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
if !@current_list && (@valid_lists && !@valid_lists.empty?)
|
59
|
+
if !@current_list
|
61
60
|
select_list
|
62
61
|
end
|
63
62
|
|
@@ -68,12 +67,13 @@ class DoTime
|
|
68
67
|
|
69
68
|
#Starts a new Basecamp API session
|
70
69
|
def init_bc_session
|
71
|
-
@session = Basecamp.new(
|
70
|
+
@session = Basecamp.new(@bc_url, @login, @password, @use_ssl)
|
72
71
|
end
|
73
72
|
|
74
73
|
#Print no valid lists warning
|
75
74
|
def no_valid_lists
|
76
|
-
|
75
|
+
clear_screen
|
76
|
+
say "<%=color('No valid lists for that user! Select another project.',:red, :bold)%>"
|
77
77
|
end
|
78
78
|
|
79
79
|
#Main key selection loop
|
@@ -297,25 +297,25 @@ class DoTime
|
|
297
297
|
end
|
298
298
|
|
299
299
|
#Filter out any non-active projects
|
300
|
-
def active_projects(cache = true)
|
301
|
-
say "Getting projects ..."
|
300
|
+
def active_projects(cache = true, msg = true)
|
301
|
+
say "Getting projects ..." if msg
|
302
302
|
@active_projects = nil unless cache
|
303
303
|
@active_projects ||= @session.projects.select do |project|
|
304
304
|
print "."
|
305
305
|
project['status'] == 'active'
|
306
306
|
end
|
307
|
-
clear_screen
|
308
307
|
@active_projects
|
309
308
|
end
|
310
309
|
|
311
310
|
#Find project && select valid lists for current owner
|
312
|
-
def select_project
|
313
|
-
bc_projects = active_projects
|
311
|
+
def select_project(clear = true)
|
312
|
+
bc_projects = active_projects(true, clear)
|
313
|
+
clear_screen if clear
|
314
314
|
@current_project = nil
|
315
315
|
@current_project = bc_projects.first if bc_projects.size == 1
|
316
316
|
@current_project ||= bc_projects[select_from("Select a project?", bc_projects.collect {|p| p['name']})[1]]
|
317
|
-
|
318
317
|
clear_screen
|
318
|
+
|
319
319
|
unless @current_owner
|
320
320
|
find_logged_in_user
|
321
321
|
clear_screen
|
@@ -345,6 +345,11 @@ class DoTime
|
|
345
345
|
end
|
346
346
|
end
|
347
347
|
clear_screen
|
348
|
+
|
349
|
+
while @valid_lists.empty?
|
350
|
+
no_valid_lists
|
351
|
+
select_project(false)
|
352
|
+
end
|
348
353
|
end
|
349
354
|
|
350
355
|
#Select current todo list to work with
|
@@ -523,15 +528,19 @@ class DoTime
|
|
523
528
|
puts " #{index+1}. #{item}"
|
524
529
|
end
|
525
530
|
puts " q - quit"
|
531
|
+
puts if list.size > 9
|
532
|
+
puts "(use 0 & 1-9 OR 1-9 & enter/space to select 1-9)" if list.size > 9
|
533
|
+
puts if list.size > 9
|
526
534
|
print "> "
|
535
|
+
second_key = nil
|
527
536
|
while /q/i !~ (key = get_character.chr)
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
return list[result], result
|
532
|
-
else
|
533
|
-
nil
|
537
|
+
if list.size > 9
|
538
|
+
second_key = get_character
|
539
|
+
second_key = [ENTER_KEY,SPACE_KEY].include?(second_key) ? nil : second_key.chr
|
534
540
|
end
|
541
|
+
result = second_key ? "#{key.to_i}#{second_key.to_i}".to_i : key.to_i
|
542
|
+
result = result - 1
|
543
|
+
return list[result], result
|
535
544
|
end
|
536
545
|
say_goodbye
|
537
546
|
exit!
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: dotime
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.6
|
7
|
+
date: 2007-02-21 00:00:00 +00:00
|
8
8
|
summary: Cheap time tracking for Basecamp todo lists
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -68,3 +68,12 @@ dependencies:
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.2.1
|
70
70
|
version:
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: hoe
|
73
|
+
version_requirement:
|
74
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.2.0
|
79
|
+
version:
|