Browse files

nuked pkg and added to gitignore

  • Loading branch information...
1 parent 21e49c1 commit cbc30bcb5d78ac04798d50635ef3849d5c7a28bf @zenspider zenspider committed Nov 15, 2011
View
1 .gitignore
@@ -0,0 +1 @@
+pkg
View
BIN pkg/otask-0.2.gem
Binary file not shown.
View
26 pkg/otask-0.2/.autotest
@@ -1,26 +0,0 @@
-# -*- ruby -*-
-
-require "autotest/restart"
-
-Autotest.add_hook :initialize do |at|
- at.testlib = "minitest/autorun"
- at.add_exception "tmp"
-
-# at.extra_files << "../some/external/dependency.rb"
-#
-# at.libs << ":../some/external"
-#
-# at.add_exception "vendor"
-#
-# at.add_mapping(/dependency.rb/) do |f, _|
-# at.files_matching(/test_.*rb$/)
-# end
-#
-# %w(TestA TestB).each do |klass|
-# at.extra_class_map[klass] = "test/test_misc.rb"
-# end
-end
-
-# Autotest.add_hook :run_command do |at|
-# system "rake build"
-# end
View
0 pkg/otask-0.2/.gemtest
No changes.
View
6 pkg/otask-0.2/History.txt
@@ -1,6 +0,0 @@
-=== 1.0.0 / 2011-10-25
-
-* 1 major enhancement
-
- * Birthday!
-
View
8 pkg/otask-0.2/Manifest.txt
@@ -1,8 +0,0 @@
-.autotest
-History.txt
-Manifest.txt
-README.txt
-Rakefile
-bin/otask
-lib/otask.rb
-test/test_otask.rb
View
114 pkg/otask-0.2/README.txt
@@ -1,114 +0,0 @@
-= otask
-
-* https://github.com/ttscoff/OTask
-
-== DESCRIPTION:
-
-A CLI for OmniFocus. I had an AppleScript/Ruby monstrosity that actually worked with TaskPaper, The Hit List, Things and OmniFocus, but that one got out of hand. I took the good parts of it, concentrated on OmniFocus and converted it to `appscript`. The result is OTask.
-
-== FEATURES/PROBLEMS:
-
-* Natural language date entry for start and due dates
-* TextMate style fragment matching for projects and contexts
-* Include notes inline or by piping in
-* Optional Growl notifications
-
-* No repeating tasks
-
-== SYNOPSIS:
-
-OTask uses a custom syntax to allow entry of the various elements of an action in one line of text. The following formats can be used anywhere in the line, with the exception of the flag (!) which must be the last character on the line, preceded by a space.
-
- * @context (fragment, no spaces)
- * #project (fragment, no spaces)
- * due(due date) (can be shortened as d(date))
- * start(start date) (can be shortened as s(date))
- * (notes)
- * ! (sets task as flagged)
-
-Contexts and project specifiers should not include spaces. The algorithm that is used will find the best match for the string you give it, so you only need to include enough of it to distinguish it from other contexts or projects. For example, if I were going to put an action directly into my Markdown QuickTags folder, I could just use "#mdqt" and it will find it. "@corr" will get me the "correspondence" context.
-
-Dates are entered in natural language format. You can type "tomorrow," "in 3 days," "next tuesday," etc. You can also use "+3" to set a date 3 days from the current day, "+7" for a week, and so on.
-
-### Command line options
-
- -h, --help Displays help message
- -q, --quiet Output as little as possible, overrides verbose
- -V, --verbose Verbose output
- -g, --growl Use Growl for feedback
-
-### Example usage
-
- $ otask "Write a letter to mom"
-
-This will put a task into your inbox with the name "Write a letter to mom." Nothing else will be set, it will wait there for you to pick it up.
-
- $ otask -g "Pick up the kids from school @err #single due(today 3pm) !"
-
-This creates a new task in a project called Single Tasks, with a context of "errands", a due date of 3pm on the current day, and flags the task.
-
-The task will go to your inbox by default, and--if provided--project and context will be set. Your settings for automatic cleanup will determine what happens after that. Task elements not specified are left unset.
-
-The `-g` parameter gives us our feedback via Growl, which is handy if you're calling it from a background script or application launcher like Quicksilver or LaunchBar.
-
- $ otask "Brainstorm for the morning meeting (Bill had some ideas, it might be worth checking in with him this afternoon) d(tomorrow 8am) #hipstartup @think"
-
-This will create a task with a note. Everything in parenthesis is removed from the task name and placed into the notes of the action, sans parenthesis. Note that the due date prefix can be shortened to just "d," (and the start date prefix can be just "s").
-
-OTask looks for notes in parenthesis, but it can also receive piped input from other applications as a note for the task. If you wanted to include text from a file, the output of a command or the plain-text contents of your clipboard, you can just pipe the output into the command, specifying the rest of the options as usual.
-
- $ pbpaste | otask "Notes from the morning meeting @ref"
-
-That would take the current contents of your clipboard and make them the attached note on the "Notes from the morning meeting" task (with the context "reference").
-
-#### Calling from LaunchBar (et al.)
-
-You can do this with any app that can run a script with input, or call it from automated scripts if you could think of a reason to. Below is the AppleScript for a LaunchBar action. Create a new script in AppleScript Editor and paste the code in. Edit the path in the last function to point to wherever you put the otask script. Save the AppleScript as OTask.scpt in `~/Library/Application Support/LaunchBar/Actions`.
-
-You'll find the Action in LaunchBar after it indexes. Type 'ota' (or as much as you need to get it to come up) and then press space bar. Use the syntax shown above to write out your action and its elements, but leave out the 'otask' part and any parameters. Hit return and Growl (you have it [installed, right?](http://growl.info)) will tell you what's up.
-
- on handle_string(actionString)
- if (length of actionString is not 0) then
- my runRubyScript(actionString)
- end if
- open location "x-launchbar:hide"
- end handle_string
-
- on runRubyScript(action)
- set res to do shell script "$HOME/scripts/otask.rb -g \"" & action & "\""
- end runRubyScript
-
-== REQUIREMENTS:
-
-* rb-appscript
-* chronic
-* amatch
-
-== INSTALL:
-
-* sudo gem install otask
-
-== LICENSE:
-
-(The MIT License)
-
-Copyright (c) Ryan Davis, seattle.rb
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
20 pkg/otask-0.2/Rakefile
@@ -1,20 +0,0 @@
-# -*- ruby -*-
-
-require "rubygems"
-require "hoe"
-
-Hoe.plugin :isolate
-Hoe.plugin :seattlerb
-
-Hoe.spec "otask" do
- developer "Ryan Davis", "ryand-ruby@zenspider.com"
-
- self.rubyforge_name = "seattlerb"
- self.readme_file = "README.txt"
-
- dependency "rb-appscript", "~> 0.6.1"
- dependency "amatch", "~> 0.2"
- dependency "chronic", "~> 0.6"
-end
-
-# vim: syntax=ruby
View
265 pkg/otask-0.2/bin/otask
@@ -1,265 +0,0 @@
-#! /usr/bin/env ruby
-
-# == Synopsis
-# OTask provides CLI functionality for adding tasks to OmniFocus.
-# It requires rb-appscript, amatch and chronic, all installable with rubygems
-#
-# == Usage
-# otask [options] "Task string"
-#
-# For help use: otask -h
-#
-# == Options
-# -h, --help Displays help message
-# -q, --quiet Output as little as possible, overrides verbose
-# -V, --verbose Verbose output
-# -g, --growl Use Growl for feedback
-#
-# == Author
-# Brett Terpstra
-#
-# == Copyright
-# Copyright (c) 2011 Brett Terpstra. Licensed under the MIT License:
-# http://www.opensource.org/licenses/mit-license.php
-
-
-require 'optparse'
-require 'ostruct'
-require 'date'
-require 'rubygems'
-require 'appscript';include Appscript
-require 'amatch';include Amatch
-require 'chronic'
-require 'rdoc'
-
-class OTask
- VERSION = '0.2'
-
- attr_reader :options
-
- def initialize(arguments, stdin)
- @arguments = arguments
- @stdin = stdin
-
- # Set defaults
- @options = OpenStruct.new
- @options.verbose = false
- @options.quiet = false
-
- # TO DO - add additional defaults
- end
-
- # Parse options, check arguments, then process the command
- def run
- if parsed_options? && !arguments_valid?
- usage_and_exit
- end
-
- if parsed_options? && arguments_valid?
- if @options.verbose
- puts "Start at #{DateTime.now}\n\n"
- puts "--Options--------------------"
- output_options if @options.verbose # [Optional]
- puts "--Task-Properties------------"
- end
- process_arguments
- process_command
-
- puts "\nFinished at #{DateTime.now}" if @options.verbose
- end
- end
-
- protected
-
- def parsed_options?
-
- # Specify options
- opts = OptionParser.new
- opts.on( '-h', '--help', 'Display this screen' ) do
- puts opts
- puts "\nNotes are entered in parenthesis: This is my title (This is the note)"
- puts "Tags are added with hashmarks #like #this. They can appear anywhere in the title string, but will be removed from the output."
- puts "Note: natural-language date parsing will work better if you install the Chronic Ruby gem (`sudo gem install chronic`)." unless TodoUtils.new.use_chronic
- exit(0)
- end
- opts.on('-V', '--verbose', 'Verbose logging') { @options.verbose = true }
- opts.on('-q', '--quiet', 'Run silently') { @options.quiet = true }
- opts.on('-g', '--growl', 'Use Growl notifications') { @options.growl = true }
- # TO DO - add additional options
-
- opts.parse!(@arguments) rescue return false
-
- process_options
- true
- end
-
- # Performs post-parse processing on options
- def process_options
- @options.verbose = false if @options.quiet
- if @options.growl
- procs = app("System Events").processes.bundle_identifier.get(:result_type => :list)
-
- if procs.include? "com.Growl.GrowlHelperApp"
- app("Growl").register(:as_application => "OTask", :all_notifications => ['Alert'], :default_notifications => ['Alert'], :icon_of_application => "OmniFocus")
- else
- @options.growl = false
- end
- end
- end
-
- def output_options
- @options.marshal_dump.each do |name, val|
- puts " #{name}: #{val}"
- end
- end
-
- # True if required arguments were provided
- def arguments_valid?
- # TO DO - implement your real logic here
- @arguments.length == 1 ? true : false
- end
-
- # Setup the arguments
- def process_arguments
- input = @stdin.stat.size > 0 ? @stdin.read : nil
- titlestring = @arguments.join(' ')
-
- # check for trailing ! (flagged task)
- @options.flagged = titlestring.match(/ !\Z/).nil? ? false : true
- titlestring.sub!(/ !\Z/,'') if @options.flagged
-
- # check for #project in the string
- projmatch = titlestring.match(/ ?#([a-z0-9]+)/i)
- @options.project = projmatch.nil? ? nil : projmatch[1]
- titlestring.sub!(/ ?##{projmatch[1]}/,'') unless projmatch.nil?
-
- # check for @contexts
- contextmatch = titlestring.match(/ @([^ ]+)/)
- @options.context = contextmatch.nil? ? false : contextmatch[1]
- titlestring.sub!(/ @[^ ]+/,'') unless contextmatch.nil?
-
- # start/due date
- startmatch = titlestring.match(/ s(?:tart)?\(([^\)]+)\)/)
- @options.start = startmatch.nil? ? false : startmatch[1]
- titlestring.sub!(/ s(tart)?\(([^\)]+)\)/,'') unless startmatch.nil?
- duematch = titlestring.match(/ d(?:ue)?\(([^\)]+)\)/)
- @options.due = duematch.nil? ? false : duematch[1]
- titlestring.sub!(/ d(ue)?\(([^\)]+)\)/,'') unless duematch.nil?
-
- @options.notes = ''
- if titlestring =~ /\(([^\)]+)\)/
- @options.notes = $1
- titlestring.gsub!(/\(([^\)]+)\)/,'')
- end
- if @options.notes == '' && !input.nil? # check for piped input on STDIN
- @options.notes = input
- elsif @options.notes && input
- @options.notes = @options.notes + "\n\n" + input
- end
- @options.name = titlestring
- end
-
- def usage_and_exit
- puts 'Usage: otask [options] "Task string"'
- puts
- puts "For help use: otask -h"
-
- exit(0)
- end
-
- def output_version
- puts "#{File.basename(__FILE__)} version #{VERSION}"
- end
-
- def add_task(dd, props)
-
- if props['project']
- proj_name = props["project"]
- proj = dd.flattened_tasks[proj_name]
- end
- if props['context']
- ctx_name = props["context"]
- ctx = dd.flattened_contexts[ctx_name]
- end
-
- tprops = props.inject({}) do |h, (k, v)|
- h[:"#{k}"] = v
- h
- end
-
- tprops.delete(:project)
- tprops[:context] = ctx if props['context']
-
- t = dd.make(:new => :inbox_task, :with_properties => tprops)
- t.assigned_container.set(proj) if props['project']
-
- return true
- end
-
- def best_match(items,fragment)
-
- highscore = {'score'=>0,'name'=>nil}
- items.each {|item|
- if fragment && !item.nil?
- score = (Jaro.new(item).match(fragment) * 10).to_i
- highscore = score > highscore['score'] ? {'score'=>score,'name'=>item} : highscore
- end
- }
- return highscore['name']
-
- end
-
- def parse_date(datestring)
- days = 0
- if datestring =~ /^\+(\d+)$/
- days = (60 * 60 * 24 * $1.to_i)
- newdate = Time.now + days
- else
- newdate = Chronic.parse(datestring, {:context => :future, :ambiguous_time_range => 8})
- end
- # parsed = newdate.strftime('%D %l:%M%p').gsub(/\s+/,' ');
- # return parsed =~ /1969/ ? false : parsed
- return newdate
- end
-
- def growl(title, message)
- app("Growl").notify(:title => title, :description => message, :application_name => "OTask", :with_name => "Alert") if @options.growl
- end
-
- def process_command
- of = app('OmniFocus')
- dd = of.default_document
-
- @props = {}
- @props['name'] = @options.name
- if @options.project
- projs = dd.flattened_projects.name.get
- @props['project'] = best_match(projs,@options.project)
- end
- if @options.context
- ctxs = dd.flattened_contexts.name.get
- @props['context'] = best_match(ctxs,@options.context)
- end
- @props['start_date'] = parse_date(@options.start) if @options.start
- @props['due_date'] = parse_date(@options.due) if @options.due
- @props['note'] = @options.notes unless @options.notes == ''
- @props['flagged'] = @options.flagged
- add_task(dd, @props)
- unless @options.quiet
- o = "Task added to "
- o += @props['project'].nil? ? "Inbox" : @props['project']
- o += ", context "+@props['context']+"." unless @props['context'].nil?
- if @options.growl
- growl("Task created",o)
- else
- puts o
- end
- end
- @props.each do |name, val|
- puts " #{name}: #{val}"
- end if @options.verbose
- end
-end
-
-app = OTask.new(ARGV, STDIN)
-app.run
View
3 pkg/otask-0.2/lib/otask.rb
@@ -1,3 +0,0 @@
-class Otask
- VERSION = "0.2.0"
-end
View
8 pkg/otask-0.2/test/test_otask.rb
@@ -1,8 +0,0 @@
-require "minitest/autorun"
-require "otask"
-
-class TestOtask < MiniTest::Unit::TestCase
- def test_sanity
- flunk "write tests or I will kneecap you"
- end
-end

0 comments on commit cbc30bc

Please sign in to comment.