toodledo 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ 1.0.0 - initial release
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ == 1.0.0 / 2008-02-10
2
+
3
+ * First version released!
4
+
data/Manifest.txt ADDED
@@ -0,0 +1,30 @@
1
+ CHANGELOG
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/toodledo
7
+ lib/toodledo.rb
8
+ lib/toodledo/command_line/add_command.rb
9
+ lib/toodledo/command_line/base_command.rb
10
+ lib/toodledo/command_line/client.rb
11
+ lib/toodledo/command_line/complete_command.rb
12
+ lib/toodledo/command_line/delete_command.rb
13
+ lib/toodledo/command_line/edit_command.rb
14
+ lib/toodledo/command_line/hotlist_command.rb
15
+ lib/toodledo/command_line/list_command.rb
16
+ lib/toodledo/command_line/main_command.rb
17
+ lib/toodledo/command_line/parser_helper.rb
18
+ lib/toodledo/command_line/setup_command.rb
19
+ lib/toodledo/context.rb
20
+ lib/toodledo/folder.rb
21
+ lib/toodledo/goal.rb
22
+ lib/toodledo/item_not_found_error.rb
23
+ lib/toodledo/priority.rb
24
+ lib/toodledo/repeat.rb
25
+ lib/toodledo/server_error.rb
26
+ lib/toodledo/session.rb
27
+ lib/toodledo/task.rb
28
+ test/parser_helper_test.rb
29
+ test/session_test.rb
30
+ test/toodledo_functional_test.rb
data/README.txt ADDED
@@ -0,0 +1,272 @@
1
+ = toodledo
2
+
3
+ * http://toodledo.rubyforge.org
4
+ * mailto:will@tersesystems.com
5
+
6
+ == DESCRIPTION:
7
+
8
+ This is a Ruby API and client for http://toodledo.com, a task management
9
+ website. It implements all of the calls from Toodledo's developer API, and
10
+ provides a nice wrapper around the functionality.
11
+
12
+ The client allows you to work with Toodledo from the command line. It will
13
+ work in either interactive or command line mode.
14
+
15
+ You can also use the client in your shell scripts, or use the API directly
16
+ as part of a web application. Don't like Toodledo's interface? Write
17
+ your own.
18
+
19
+ == FEATURES/PROBLEMS:
20
+
21
+ * Command line client interface
22
+ * Interactive client interface
23
+ * Fully featured session based API
24
+ * Supports Proxy and SSL usage
25
+ * Easy configuration and automation (Quicksilver / Scripts / Automator)
26
+
27
+ == SYNOPSIS:
28
+
29
+ Toodledo has a particularly rich model of a task, and allows full GTD
30
+ type state to be attached to them. The client syntax for the client
31
+ is as follows:
32
+
33
+ *Folder
34
+ @Context
35
+ $Goal
36
+
37
+ You can encase the symbol with square brackets if there is a space
38
+ involved:
39
+
40
+ *[Blue Sky]
41
+ @[Someday / Maybe]
42
+ $[Write Toodledo Ruby API]
43
+
44
+ Let's use the command line client to list only the tasks you have in the office:
45
+
46
+ toodledo list '@Office *Action'
47
+
48
+ In interactive mode, the client will also allow you to set up filters. If you
49
+ type 'folder', 'context' or 'goal' with an argument, then only tasks that match
50
+ those criteria will be displayed. That is, if you do this:
51
+
52
+ context Office
53
+ folder Action
54
+ list
55
+
56
+ Then it produces the same results as the previous list command.
57
+
58
+ You can add tasks. The simplest form is here:
59
+
60
+ toodledo add 'This is a test'
61
+
62
+ Now let's add a task with several symbols:
63
+
64
+ toodledo add '*Action @Programming $[Write Toodledo Ruby API] Write documentation'
65
+
66
+ You can also edit tasks, using the task id. This sets the folder to Someday:
67
+
68
+ toodledo edit '*Someday 15934131'
69
+
70
+ And finally you can complete or delete tasks, again using the task id.
71
+
72
+ toodledo complete 15934131
73
+ toodledo delete 15934131
74
+
75
+ If you want to write your own scripts, working with Toodledo is very
76
+ simple, since it will use the YAML config file:
77
+
78
+ require 'rubygems'
79
+ require 'toodledo'
80
+ Toodledo.begin do |session|
81
+ # work with session
82
+ end
83
+
84
+ If you want to work with the session directly, then you should do
85
+ this instead:
86
+
87
+ require 'rubygems'
88
+ require 'toodledo'
89
+ session = Session.new(userid, password)
90
+ session.connect()
91
+
92
+ == REQUIREMENTS:
93
+
94
+ * A connection to the Internet
95
+ * An account to http://toodledo.com
96
+ * Your Toodledo userid (see http://www.toodledo.com/info/api_doc.php)
97
+ * cmdparse
98
+ * highline
99
+ * rubygems
100
+
101
+ == INSTALL:
102
+
103
+ * sudo gem install toodledo
104
+ * toodledo setup (sets up the YAML file with your credentials)
105
+ * toodledo interactive
106
+
107
+ == LICENSE:
108
+ GNU LESSER GENERAL PUBLIC LICENSE
109
+ Version 3, 29 June 2007
110
+
111
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
112
+ Everyone is permitted to copy and distribute verbatim copies
113
+ of this license document, but changing it is not allowed.
114
+
115
+
116
+ This version of the GNU Lesser General Public License incorporates
117
+ the terms and conditions of version 3 of the GNU General Public
118
+ License, supplemented by the additional permissions listed below.
119
+
120
+ 0. Additional Definitions.
121
+
122
+ As used herein, "this License" refers to version 3 of the GNU Lesser
123
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
124
+ General Public License.
125
+
126
+ "The Library" refers to a covered work governed by this License,
127
+ other than an Application or a Combined Work as defined below.
128
+
129
+ An "Application" is any work that makes use of an interface provided
130
+ by the Library, but which is not otherwise based on the Library.
131
+ Defining a subclass of a class defined by the Library is deemed a mode
132
+ of using an interface provided by the Library.
133
+
134
+ A "Combined Work" is a work produced by combining or linking an
135
+ Application with the Library. The particular version of the Library
136
+ with which the Combined Work was made is also called the "Linked
137
+ Version".
138
+
139
+ The "Minimal Corresponding Source" for a Combined Work means the
140
+ Corresponding Source for the Combined Work, excluding any source code
141
+ for portions of the Combined Work that, considered in isolation, are
142
+ based on the Application, and not on the Linked Version.
143
+
144
+ The "Corresponding Application Code" for a Combined Work means the
145
+ object code and/or source code for the Application, including any data
146
+ and utility programs needed for reproducing the Combined Work from the
147
+ Application, but excluding the System Libraries of the Combined Work.
148
+
149
+ 1. Exception to Section 3 of the GNU GPL.
150
+
151
+ You may convey a covered work under sections 3 and 4 of this License
152
+ without being bound by section 3 of the GNU GPL.
153
+
154
+ 2. Conveying Modified Versions.
155
+
156
+ If you modify a copy of the Library, and, in your modifications, a
157
+ facility refers to a function or data to be supplied by an Application
158
+ that uses the facility (other than as an argument passed when the
159
+ facility is invoked), then you may convey a copy of the modified
160
+ version:
161
+
162
+ a) under this License, provided that you make a good faith effort to
163
+ ensure that, in the event an Application does not supply the
164
+ function or data, the facility still operates, and performs
165
+ whatever part of its purpose remains meaningful, or
166
+
167
+ b) under the GNU GPL, with none of the additional permissions of
168
+ this License applicable to that copy.
169
+
170
+ 3. Object Code Incorporating Material from Library Header Files.
171
+
172
+ The object code form of an Application may incorporate material from
173
+ a header file that is part of the Library. You may convey such object
174
+ code under terms of your choice, provided that, if the incorporated
175
+ material is not limited to numerical parameters, data structure
176
+ layouts and accessors, or small macros, inline functions and templates
177
+ (ten or fewer lines in length), you do both of the following:
178
+
179
+ a) Give prominent notice with each copy of the object code that the
180
+ Library is used in it and that the Library and its use are
181
+ covered by this License.
182
+
183
+ b) Accompany the object code with a copy of the GNU GPL and this license
184
+ document.
185
+
186
+ 4. Combined Works.
187
+
188
+ You may convey a Combined Work under terms of your choice that,
189
+ taken together, effectively do not restrict modification of the
190
+ portions of the Library contained in the Combined Work and reverse
191
+ engineering for debugging such modifications, if you also do each of
192
+ the following:
193
+
194
+ a) Give prominent notice with each copy of the Combined Work that
195
+ the Library is used in it and that the Library and its use are
196
+ covered by this License.
197
+
198
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
199
+ document.
200
+
201
+ c) For a Combined Work that displays copyright notices during
202
+ execution, include the copyright notice for the Library among
203
+ these notices, as well as a reference directing the user to the
204
+ copies of the GNU GPL and this license document.
205
+
206
+ d) Do one of the following:
207
+
208
+ 0) Convey the Minimal Corresponding Source under the terms of this
209
+ License, and the Corresponding Application Code in a form
210
+ suitable for, and under terms that permit, the user to
211
+ recombine or relink the Application with a modified version of
212
+ the Linked Version to produce a modified Combined Work, in the
213
+ manner specified by section 6 of the GNU GPL for conveying
214
+ Corresponding Source.
215
+
216
+ 1) Use a suitable shared library mechanism for linking with the
217
+ Library. A suitable mechanism is one that (a) uses at run time
218
+ a copy of the Library already present on the user's computer
219
+ system, and (b) will operate properly with a modified version
220
+ of the Library that is interface-compatible with the Linked
221
+ Version.
222
+
223
+ e) Provide Installation Information, but only if you would otherwise
224
+ be required to provide such information under section 6 of the
225
+ GNU GPL, and only to the extent that such information is
226
+ necessary to install and execute a modified version of the
227
+ Combined Work produced by recombining or relinking the
228
+ Application with a modified version of the Linked Version. (If
229
+ you use option 4d0, the Installation Information must accompany
230
+ the Minimal Corresponding Source and Corresponding Application
231
+ Code. If you use option 4d1, you must provide the Installation
232
+ Information in the manner specified by section 6 of the GNU GPL
233
+ for conveying Corresponding Source.)
234
+
235
+ 5. Combined Libraries.
236
+
237
+ You may place library facilities that are a work based on the
238
+ Library side by side in a single library together with other library
239
+ facilities that are not Applications and are not covered by this
240
+ License, and convey such a combined library under terms of your
241
+ choice, if you do both of the following:
242
+
243
+ a) Accompany the combined library with a copy of the same work based
244
+ on the Library, uncombined with any other library facilities,
245
+ conveyed under the terms of this License.
246
+
247
+ b) Give prominent notice with the combined library that part of it
248
+ is a work based on the Library, and explaining where to find the
249
+ accompanying uncombined form of the same work.
250
+
251
+ 6. Revised Versions of the GNU Lesser General Public License.
252
+
253
+ The Free Software Foundation may publish revised and/or new versions
254
+ of the GNU Lesser General Public License from time to time. Such new
255
+ versions will be similar in spirit to the present version, but may
256
+ differ in detail to address new problems or concerns.
257
+
258
+ Each version is given a distinguishing version number. If the
259
+ Library as you received it specifies that a certain numbered version
260
+ of the GNU Lesser General Public License "or any later version"
261
+ applies to it, you have the option of following the terms and
262
+ conditions either of that published version or of any later version
263
+ published by the Free Software Foundation. If the Library as you
264
+ received it does not specify a version number of the GNU Lesser
265
+ General Public License, you may choose any version of the GNU Lesser
266
+ General Public License ever published by the Free Software Foundation.
267
+
268
+ If the Library as you received it specifies that a proxy can decide
269
+ whether future versions of the GNU Lesser General Public License shall
270
+ apply, that proxy's public statement of acceptance of any version is
271
+ permanent authorization for you to choose that version for the
272
+ Library.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ $:.unshift(File.dirname(__FILE__) + "/lib")
6
+ require 'toodledo'
7
+
8
+ Hoe.new('toodledo', Toodledo::VERSION) do |p|
9
+ p.rubyforge_name = 'toodledo'
10
+ p.author = 'Will Sargent'
11
+ p.email = 'will@tersesystems.com'
12
+ p.summary = 'A command line client and API to Toodledo'
13
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
14
+ p.url = 'http://rubyforge.org/projects/toodledo'
15
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
16
+ p.rsync_args << ' --exclude=statsvn/'
17
+ p.extra_deps = ['cmdparse', 'highline']
18
+ end
19
+
20
+ # vim: syntax=Ruby
data/bin/toodledo ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Add the lib directory to the ruby search path.
4
+ $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
5
+
6
+ require 'rubygems'
7
+ require 'toodledo'
8
+ require 'toodledo/command_line/client'
9
+
10
+ client = Toodledo::CommandLine::Client.new
11
+ exit client.main()
data/lib/toodledo.rb ADDED
@@ -0,0 +1,64 @@
1
+ #
2
+ # The top level Toodledo module. This does very little that is
3
+ # interesting. You probably want to look at Toodledo::Session
4
+ #
5
+ module Toodledo
6
+
7
+ # Required for gem
8
+ VERSION = '1.0.0'
9
+
10
+ # Returns the configuration object.
11
+ def self.get_config()
12
+ return @@config
13
+ end
14
+
15
+ # Sets the configuration explicitly. Useful when you
16
+ # want to specifically set the configuration without
17
+ # using the file system.
18
+ def self.set_config(override_config)
19
+ @@config = override_config
20
+ end
21
+
22
+ #
23
+ # Provides a convenient way of connecting and running a session.
24
+ #
25
+ # The following will do most everything you want, assuming you've set
26
+ # the config correctly:
27
+ #
28
+ # require 'toodledo'
29
+ # Toodledo.begin do |session|
30
+ # session.add_task('foo')
31
+ # end
32
+ #
33
+ def self.begin(logger = nil)
34
+ config = Toodledo.get_config()
35
+
36
+ proxy = config['proxy']
37
+
38
+ connection = config['connection']
39
+ base_url = connection['url']
40
+ user_id = connection['user_id']
41
+ password = connection['password']
42
+
43
+ session = Session.new(user_id, password, logger)
44
+
45
+ base_url = Session::DEFAULT_API_URL if (base_url == nil)
46
+ session.connect(base_url, proxy)
47
+
48
+ if (block_given?)
49
+ yield(session)
50
+ end
51
+
52
+ session.disconnect()
53
+ end
54
+ end
55
+
56
+ require 'toodledo/server_error'
57
+ require 'toodledo/item_not_found_error'
58
+ require 'toodledo/task'
59
+ require 'toodledo/context'
60
+ require 'toodledo/goal'
61
+ require 'toodledo/folder'
62
+ require 'toodledo/repeat'
63
+ require 'toodledo/priority'
64
+ require 'toodledo/session'
@@ -0,0 +1,29 @@
1
+
2
+ module Toodledo
3
+ module CommandLine
4
+ class AddCommand < BaseCommand
5
+
6
+ include Toodledo::CommandLine::ParserHelper
7
+
8
+ def initialize(client)
9
+ super(client, 'add', false)
10
+ self.short_desc = "Add a task"
11
+ self.description = "Adds a task to Toodledo"
12
+ end
13
+
14
+ def execute(args)
15
+ return if (args == nil)
16
+
17
+ if (client.debug?)
18
+ logger = Logger.new(STDOUT)
19
+ logger.level = Logger::DEBUG
20
+ end
21
+
22
+ Toodledo.begin(logger) do |session|
23
+ line = args.join(' ')
24
+ client.add_task(session, line)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ require 'cmdparse'
2
+
3
+ module Toodledo
4
+ module CommandLine
5
+ class BaseCommand < CmdParse::Command
6
+ def initialize(client, name, subtasks = false)
7
+ super(name, subtasks)
8
+ raise "Nil client!" if (client == nil)
9
+ @client = client
10
+ end
11
+
12
+ def client
13
+ return @client
14
+ end
15
+
16
+ def logger
17
+ return @logger
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+
24
+
25
+