Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
remi
committed
Oct 9, 2008
1 parent
20dd237
commit 211bf3f
Showing
4 changed files
with
70 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#! /usr/bin/env ruby | ||
require File.dirname(__FILE__) + '/lib/timetray' | ||
|
||
# ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:' # memory for now, for testing | ||
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => DB_PATH | ||
unless File.file?DB_PATH | ||
CreateTimeTrayDB.verbose = false | ||
CreateTimeTrayDB.migrate :up | ||
end | ||
|
||
SimpleTray.icon_directory = File.join File.dirname(__FILE__), 'icons' | ||
SimpleTray.app 'TODO' do | ||
|
||
TimeTray.current_tasks.each do |task| | ||
menu "#{task.name} (#{time_ago_in_words task.current_log.started_at})" do | ||
stop { task.stop! } | ||
end | ||
end | ||
item('No Current Tasks'){} if TimeTray.current_tasks.empty? | ||
____ | ||
|
||
TimeTray.projects.each do |project| | ||
menu project.name do | ||
for task in project.tasks | ||
menu "#{ task }#{ (task.logs.empty?) ? '' : " (#{task.logs.count})" }" do | ||
item (task.active? ? 'Stop' : 'Start') do | ||
if task.active? | ||
task.stop! | ||
else | ||
task.start! | ||
end | ||
end | ||
unless task.logs.empty? | ||
____ | ||
task.logs.each do |log| | ||
if log.active? | ||
item("started #{time_ago_in_words(log.started_at)} ago"){} | ||
else | ||
item(relative_time_span([log.started_at, log.stopped_at])){} | ||
end | ||
end | ||
end | ||
end | ||
end | ||
____ unless project.tasks.empty? | ||
new_task { project.tasks.create :name => prompt("New Task Name") } | ||
end | ||
end | ||
|
||
____ unless TimeTray.projects.empty? | ||
item 'New Project' do | ||
Project.create :name => prompt('New Project Name') | ||
end | ||
|
||
____ | ||
exit | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.