Permalink
Browse files

Work on omnifocus projects, setup a spec dir

  • Loading branch information...
1 parent 094647c commit 53a3f2be410a4b73529ad19bcf8323157eaae30c @cschneid committed Feb 6, 2012
Showing with 148 additions and 1 deletion.
  1. +1 −0 Gemfile
  2. 0 Rakefile
  3. +137 −1 { → lib}/omnifocus.rb
  4. +7 −0 spec/omnifocus_spec.rb
  5. +3 −0 spec/spec_helper.rb
View
@@ -1,3 +1,4 @@
source :rubygems
gem 'trollop'
+gem 'rspec'
View
No changes.
@@ -4,7 +4,7 @@
framework 'Foundation'
framework 'ScriptingBridge'
-bridge_file = 'Omnifocus.bridgesupport'
+bridge_file = File.dirname(__FILE__) + '/../Omnifocus.bridgesupport'
load_bridge_support_file bridge_file
class Omnifocus
@@ -30,6 +30,10 @@ def folders
def contexts
document.contexts.map{ |context| OmnifocusCLI::OmnifocusContext.new(context) }
end
+
+ def projects
+ document.projects.map{ |project| OmnifocusCLI::OmnifocusProject.new(project) }
+ end
end
module OmnifocusCLI
@@ -152,6 +156,138 @@ def location
end
end
+ class OmnifocusProject
+ attr_accessor :sbProject
+
+ def initialize(sbProject)
+ @sbProject = sbProject
+ end
+
+ def created_at
+ @sbProject.creationDate
+ end
+
+ def updated_at
+ @sbProject.modificationDate
+ end
+
+ def start_date
+ @sbProject.startDate
+ end
+
+ def end_date
+ @sbProject.endDate
+ end
+
+ def completion_date
+ @sbProject.completionDate
+ end
+ def estimated_minutes
+ @sbProject.estimatedMinutes
+ end
+
+ def repetition
+ @sbProject.repetition
+ end
+
+ def number_of_tasks
+ @sbProject.numberOfTasks
+ end
+
+ def number_of_available_tasks
+ @sbProject.numberOfAvailableTasks
+ end
+
+ def number_of_completed_tasks
+ @sbProject.numberOfCompletedTasks
+ end
+
+ def omnifocus_id
+ @sbProject.id
+ end
+
+ def name
+ @sbProject.name
+ end
+
+ def note
+ @sbProject.note
+ end
+
+ def context
+ OmnifocusCLI::OmnifocusProject.new(@sbProject.context)
+ end
+
+ def next_task
+ OmnifocusCLI::OmnifocusTask.new(@sbProject.nextTask)
+ end
+
+ def root_task
+ OmnifocusCLI::OmnifocusTask.new(@sbProject.rootTask)
+ end
+
+ def last_review_date
+ @sbProject.lastReviewDate
+ end
+
+ def next_review_date
+ @sbProject.nextReviewDate
+ end
+
+ # TODO: What does this return
+ def review_interval
+ @sbProject.reviewInterval
+ end
+
+ def completed?
+ @sbProject.completed
+ end
+
+ def completed_by_children?
+ @sbProject.completedByChildren
+ end
+
+ def sequential?
+ @sbProject.sequential
+ end
+
+ def flagged?
+ @sbProject.flagged
+ end
+
+ def blocked?
+ @sbProject.blocked
+ end
+
+ def status
+ @sbProject.status
+ end
+
+ def singleton_actions?
+ @sbProject.singletonActionHolder
+ end
+
+ def default_singleton_action_holder?
+ @sbProject.defaultSingletonActionHolder
+ end
+
+ def folder
+ OmnifocusCLI::OmnifocusProject.new(@sbProject.folder)
+ end
+
+ def container
+ @sbProject.container
+ end
+
+ def containing_document
+ @sbProject.containingDocument
+ end
+
+ def location
+ @sbProject.location
+ end
+ end
+
module Presenters
class NestedPresenter
attr_accessor :root
View
@@ -0,0 +1,7 @@
+require 'spec_helper'
+
+describe Omnifocus do
+ it "is initializable" do
+ Omnifocus.new
+ end
+end
View
@@ -0,0 +1,3 @@
+$:.unshift(File.dirname(__FILE__) + "../lib")
+
+require 'omnifocus'

0 comments on commit 53a3f2b

Please sign in to comment.