zzamboni-things2thl 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog ADDED
@@ -0,0 +1,150 @@
1
+ 2009-05-19 Diego Zamboni <diego@zzamboni.org>
2
+
3
+ * VERSION, lib/Things2THL.rb: Version bump to 0.4.0
4
+
5
+ 2009-05-19 Diego Zamboni <diego@zzamboni.org>
6
+
7
+ * lib/Things2THL.rb: Removed per-node type display from progress
8
+ printout
9
+
10
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
11
+
12
+ * bin/things2thl: Fetch only completed projects/tasks using
13
+ Applescript (unless --completed is specified), which drastically
14
+ improves performance.
15
+
16
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
17
+
18
+ * bin/things2thl: Improved help text by showing actual options
19
+
20
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
21
+
22
+ * bin/things2thl, lib/Things2THL.rb: Moved default options
23
+ generation to Things2THL.default_options.
24
+
25
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
26
+
27
+ * VERSION, lib/Things2THL.rb, things2thl.gemspec: Version bump to
28
+ 0.3.0
29
+
30
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
31
+
32
+ * bin/things2thl, lib/Things2THL.rb: Added option
33
+ --context-tags-regex (-C) for specifying which Things tags should be
34
+ considered as contexts when moving to THL. By default its value is
35
+ "^@", which means any tag starting with @ will be entered into THL
36
+ as a context. Any regular expression can be used. If any of the
37
+ tags matched by this regex contains spaces, the spaces will be
38
+ converted to underscores, since THL does not allow spaces in context
39
+ names.
40
+
41
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
42
+
43
+ * bin/things2thl: Code cleanup.
44
+
45
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
46
+
47
+ * VERSION, things2thl.gemspec: Version bump to 0.2.2
48
+
49
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
50
+
51
+ * lib/Things2THL.rb: Fixed typo in version number code. Oops
52
+
53
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
54
+
55
+ * VERSION, lib/Things2THL.rb, things2thl.gemspec: Version bump to
56
+ 0.2.1
57
+
58
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
59
+
60
+ * VERSION, things2thl.gemspec: Version bump to 0.2.0
61
+
62
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
63
+
64
+ * Rakefile: Modified Rakefile to use Jeweler
65
+
66
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
67
+
68
+ * lib/Things2THL.rb: Removed debug message
69
+
70
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
71
+
72
+ * VERSION: Version bump to 0.1.0
73
+
74
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
75
+
76
+ * VERSION: Version bump to 0.0.0
77
+
78
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
79
+
80
+ * lib/Things2THL.rb: Added value caching for ThingsNode, drastically
81
+ reducing the number of Apple events that have to be generated
82
+
83
+ 2009-05-18 Diego Zamboni <diego@zzamboni.org>
84
+
85
+ * lib/Things2THL.rb: Eliminated unnecessary (and extremely frequent)
86
+ redefinition of ThingsNode methods, which made the script much
87
+ slower by invoking eval_class thousands of times.
88
+
89
+ 2009-05-17 Diego Zamboni <diego@zzamboni.org>
90
+
91
+ * Manifest, Rakefile, things2thl.gemspec: Added Rakefile, Manifest
92
+ and gemspec file
93
+
94
+ 2009-05-17 Diego Zamboni <diego@zzamboni.org>
95
+
96
+ * lib/Things2THL.rb: Added cache of focusnames, and avoid computing
97
+ the task cache for "Logbook" (which can be pretty big) unless
98
+ --completed was specified.
99
+
100
+ 2009-05-16 Diego Zamboni <diego@zzamboni.org>
101
+
102
+ * README, bin/things2thl, lib/Things2THL.rb: Fully functional
103
+ version! All the essential functionality is there. Projects, areas
104
+ and foci are handled appropriately, as are completed tasks and
105
+ projects, suspended areas, etc.
106
+
107
+ 2009-05-14 Diego Zamboni <diego@zzamboni.org>
108
+
109
+ * lib/Things2THL.rb: - Handle project due dates when --projects-as-lists by creating a
110
+ new task within the list, with the appropriate due date. - Mark fake "notes" task when --projects-as-lists as completed if the enclosing project is completed or canceled. - Added project- and area-tag inheritance into individual tasks when the project/area is a list (THL lists can't have tags) - Added generic internal mechanism for creating additional nodes,
111
+ used both for the due dates tasks and the notes tasks.
112
+
113
+ 2009-05-14 Diego Zamboni <diego@zzamboni.org>
114
+
115
+ * lib/Things2THL.rb: - Inherit project tags into the corresponding tasks - Base support for putting tasks in the proper focus. So far, only Today tasks are properly flagged.
116
+
117
+ 2009-05-13 Diego Zamboni <diego@zzamboni.org>
118
+
119
+ * lib/Things2THL.rb: Simplified postproc blocks in STRUCTURE by
120
+ passing the Things2THL object to it, which allows calling methods in
121
+ the object (the postproc block itself cannot access anything from
122
+ Things2THL because it is not defined as part of the Things2THL
123
+ class).
124
+
125
+ 2009-05-13 Diego Zamboni <diego@zzamboni.org>
126
+
127
+ * lib/Things2THL.rb: Fixed bug when --projects-as-tasks was used
128
+
129
+ 2009-05-13 Diego Zamboni <diego@zzamboni.org>
130
+
131
+ * README, bin/things2thl, lib/Things2THL.rb: Added proper handling
132
+ of most node attributes, including rudimentary transfering of the
133
+ tags (not contexts vs tags yet). Updated README with some usage notes and warnings.
134
+
135
+ 2009-05-12 Diego Zamboni <diego@zzamboni.org>
136
+
137
+ * bin/things2thl, lib/Things2THL.rb: - Modified to use Applescript to get stuff out of Things instead of the things-rb library (needs Things 1.1.1 or later) - Simplified the algorithm to a multiple-pass one (areas, projects,
138
+ tasks) using memoization to do the nesting, instead of trying to do
139
+ a hierarchical traversal. - Tasks are also now imported, but those not in projects or areas
140
+ are still not divided properly (e.g. in Inbox, Scheduled, etc.)
141
+
142
+ 2009-05-05 Diego Zamboni <diego@zzamboni.org>
143
+
144
+ * README: Updated URLs
145
+
146
+ 2009-05-05 Diego Zamboni <diego@zzamboni.org>
147
+
148
+ * First commit - partially-working code. Able to transfer some tasks
149
+ from Things to THL, but not all attributes are preserved yet
150
+
data/README CHANGED
@@ -1,6 +1,7 @@
1
1
  Things2THL
2
+ http://zzamboni.github.com/things2thl/
2
3
 
3
- Conversion program to transfer all tasks from Things
4
+ Conversion program to transfer data from Things
4
5
  (http://culturedcode.com/things/ ) to The Hit List
5
6
  (http://www.potionfactory.com/thehitlist/ ).
6
7
 
@@ -15,28 +16,41 @@ support.
15
16
  You need to install rb-appscript from
16
17
  http://appscript.sourceforge.net/rb-appscript/install.html
17
18
 
18
- Run things2thl by changing into the base directory of this
19
- distribution and running:
20
- ./bin/things2thl [options]
19
+ Then install things2thl by running:
20
+ $ sudo gem install zzamboni-things2thl --source http://gems.github.com/
21
21
 
22
22
 
23
23
  USAGE:
24
24
  -----
25
25
 
26
- To see a usage message:
27
-
28
- ./bin/things2thl -h
29
-
26
+ Usage: things2thl [options]
27
+
28
+ Options:
29
+ --projects-as-lists Convert projects in Things to lists in THL (default)
30
+ --projects-as-tasks Convert projects in Things to tasks in THL
31
+ --[no-]areas Transfer areas from Things (default: yes)
32
+ -C, --context-tags-regex REGEX Regular expression to identify tags that should be interpreted as contexts.
33
+ (default: ^@)
34
+ --top-level-folder FOLDER If specified, do the import inside the named folders, instead of the top level
35
+ (Inbox, etc. will also be created there instead of their corresponding places)
36
+ --projects-folder FOLDER If specified, the named folder will be created to contain all projects when
37
+ --projects-as-lists is used (otherwise they will be put in the top folders group).
38
+ If --projects-as-tasks is used, a 'Projects' list is always created, but this option
39
+ can be used to specify its name.
40
+ -c, --completed Transfer also completed/canceled tasks and projects (default: no)
41
+ --[no-]archive-completed If transferring completed/canceled tasks, also mark them as archived (default: yes)
42
+ -q, --quiet Do not print items as they are processed
43
+ -h, --help Shows this help message
44
+ -v, --version Shows version
45
+
46
+ Options you should seldom need:
47
+ --things THINGSAPP Location of the Things application (default: /Applications/Things.app)
48
+ --thl THLAPP Location of the The Hit List application (default: /Applications/The Hit List.app)
30
49
 
31
50
 
32
51
  Functionality still missing:
33
52
  ---------------------------
34
53
 
35
- - Handling contexts vs tags
36
-
37
- Plan: make it a user option which Things tasks should be considered
38
- as contexts.
39
-
40
54
  - Handle rich-text notes (with attachments, links, etc.) properly
41
55
 
42
56
  Plan: not sure yet. Need to investigate how notes are stored in
@@ -46,6 +60,12 @@ Functionality still missing:
46
60
 
47
61
  Not sure how to transfer this to THL. Ideas are welcome.
48
62
 
63
+ - Handle "time estimate" tags.
64
+
65
+ Plan: Allow specifying certain Things tags (e.g. I use "10min",
66
+ "30min", "60min") that should be used to set the time estimate for
67
+ the task in THL.
68
+
49
69
  Known issues:
50
70
  -------------
51
71
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
data/bin/things2thl CHANGED
@@ -5,16 +5,7 @@ require File.join(File.dirname(__FILE__), *%w".. lib Things2THL")
5
5
  require "optparse"
6
6
  require "ostruct"
7
7
 
8
- # Command line options and defaults
9
- options=OpenStruct.new
10
- options.completed = false
11
- options.database = nil
12
- options.structure = :projects_as_lists
13
- options.areas = true
14
- options.quiet = false
15
- options.archivecompleted = true
16
- options.projectsfolder = nil
17
- options.contexttagsregex = '^@'
8
+ options=Things2THL.default_options
18
9
  opts = OptionParser.new do |opts|
19
10
  opts.separator ''
20
11
  opts.separator 'Options:'
@@ -26,9 +17,9 @@ opts = OptionParser.new do |opts|
26
17
  exit
27
18
  end
28
19
 
29
- opts.on("--projects-as-lists", "Convert projects in Things to lists in THL (default)") { options.structure = :projects_as_lists }
30
- opts.on("--projects-as-tasks", "Convert projects in Things to tasks in THL") { options.structure = :projects_as_tasks }
31
- opts.on("--no-areas", "Ignore areas in Things") { options.areas = false }
20
+ opts.on("--projects-as-lists", "Convert projects in Things to lists in THL" + ((options.structure == :projects_as_lists) ? " (default)" : "") ) { options.structure = :projects_as_lists }
21
+ opts.on("--projects-as-tasks", "Convert projects in Things to tasks in THL" + ((options.structure == :projects_as_tasks) ? " (default)" : "") ) { options.structure = :projects_as_tasks }
22
+ opts.on("--[no-]areas", "Transfer areas from Things (default: #{options.areas ? 'yes' : 'no'})") { |v| options.areas = v }
32
23
  opts.on('-C REGEX', '--context-tags-regex REGEX', 'Regular expression to identify tags that should be interpreted as contexts.',
33
24
  " (default: #{options.contexttagsregex})") do |regex|
34
25
  options.contexttagsregex = regex
@@ -45,8 +36,8 @@ opts = OptionParser.new do |opts|
45
36
  options.projectsfolder = projfolder
46
37
  end
47
38
 
48
- opts.on("-c", "--completed", 'Transfer also completed/canceled tasks and projects (default: no)') { options.completed = true }
49
- opts.on("--no-archive-completed", 'If transferring completed/canceled tasks, also mark them as archived (default: yes)') {options.archivecompleted = false }
39
+ opts.on("-c", "--completed", "Transfer also completed/canceled tasks and projects (default: #{options.completed ? 'yes' : 'no'})") { options.completed = true }
40
+ opts.on("--[no-]archive-completed", "If transferring completed/canceled tasks, also mark them as archived (default: #{options.archivecompleted ? 'yes' : 'no'})") {|v| options.archivecompleted = v }
50
41
  opts.on("-q", "--quiet", "Do not print items as they are processed") { options.quiet = true }
51
42
  # opts.on("-n", "--dry-run", "Do not create anything in THL, just print the items that would be created") { options.dryrun = true }
52
43
  # opts.on("-n", "--notes", "Shows only tasks with notes") { options[:tasks] = { :onlynotes => true } }
@@ -84,13 +75,22 @@ thl = converter.thl
84
75
 
85
76
  # First, traverse all areas
86
77
  if options.areas
78
+ puts "Processing Areas of Responsibility" unless options.quiet
87
79
  things.areas.get.each do |area|
88
80
  converter.process(Things2THL::ThingsNode.new(area))
89
81
  end
90
82
  end
91
83
 
92
84
  # Next, traverse all projects, putting each one inside its corresponding area
93
- things.projects.get.each do |project|
85
+ puts "Processing Projects" unless options.quiet
86
+ if options.completed
87
+ puts " (fetching all projects - this may take a while)" unless options.quiet
88
+ projlist=things.projects.get
89
+ else
90
+ puts " (fetching only open projects - this may take a while)" unless options.quiet
91
+ projlist=things.projects[its.status.eq(:open)].get
92
+ end
93
+ projlist.each do |project|
94
94
  converter.process(Things2THL::ThingsNode.new(project))
95
95
  end
96
96
 
@@ -99,7 +99,15 @@ end
99
99
  # - to_dos returns not only tasks, also projects (not areas)
100
100
  # - to-dos returns tasks from all the views: Inbox, Today, Scheduled, Someday, and Next, so we have
101
101
  # to separate them and create the appropriate containers as needed
102
- things.to_dos.get.each do |t|
102
+ puts "Processing tasks" unless options.quiet
103
+ if options.completed
104
+ puts " (fetching all tasks - this may take a while)" unless options.quiet
105
+ tasklist=things.to_dos.get
106
+ else
107
+ puts " (fetching only open tasks - this may take a while)" unless options.quiet
108
+ tasklist=things.to_dos[its.status.eq(:open)].get
109
+ end
110
+ tasklist.each do |t|
103
111
  task=Things2THL::ThingsNode.new(t)
104
112
  next if task.type != :selected_to_do
105
113
  converter.process(task)
data/lib/Things2THL.rb CHANGED
@@ -11,7 +11,7 @@ require 'appscript'; include Appscript
11
11
  module Things2THL
12
12
  module Version
13
13
  MAJOR = 0
14
- MINOR = 3
14
+ MINOR = 4
15
15
  PATCH = 0
16
16
 
17
17
  STRING = [MAJOR, MINOR, PATCH].join(".")
@@ -217,7 +217,7 @@ module Things2THL
217
217
  attr_accessor :options, :things, :thl
218
218
 
219
219
  def initialize(opt_struct = nil, things_location = nil, thl_location = nil)
220
- @options=opt_struct || OpenStruct.new
220
+ @options=opt_struct || Things2THL.default_options
221
221
  thingsappname=things_location || 'Things'
222
222
  thlappname=thl_location || 'The Hit List'
223
223
  begin
@@ -539,7 +539,7 @@ module Things2THL
539
539
 
540
540
  unless (options.quiet)
541
541
  bullet = (node.type == :area) ? "*" : ((node.status == :completed) ? "✓" : (node.status == :canceled) ? "×" : "-")
542
- puts bullet + " " + node.name + " (#{node.type})"
542
+ puts bullet + " " + node.name
543
543
  end
544
544
 
545
545
  newnode=create_in_thl(node, container)
@@ -704,6 +704,20 @@ module Things2THL
704
704
 
705
705
  ####################################################################
706
706
 
707
+ # Return a structure with the default option values
708
+ def Things2THL.default_options
709
+ options=OpenStruct.new
710
+ options.completed = false
711
+ options.database = nil
712
+ options.structure = :projects_as_lists
713
+ options.areas = true
714
+ options.quiet = false
715
+ options.archivecompleted = true
716
+ options.projectsfolder = nil
717
+ options.contexttagsregex = '^@'
718
+ return options
719
+ end
720
+
707
721
  def Things2THL.new(opt_struct = nil, things_db = nil, thl_location = nil)
708
722
  Converter.new(opt_struct, things_db, thl_location)
709
723
  end
data/things2thl.gemspec CHANGED
@@ -2,20 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{things2thl}
5
- s.version = "0.3.0"
5
+ s.version = "0.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Diego Zamboni"]
9
- s.date = %q{2009-05-18}
9
+ s.date = %q{2009-05-19}
10
10
  s.default_executable = %q{things2thl}
11
11
  s.description = %q{Library and command-line tool for migrating Things data to The Hit List}
12
12
  s.email = %q{diego@zzamboni.org}
13
13
  s.executables = ["things2thl"]
14
14
  s.extra_rdoc_files = [
15
- "README"
15
+ "ChangeLog",
16
+ "README"
16
17
  ]
17
18
  s.files = [
18
- "Manifest",
19
+ "ChangeLog",
20
+ "Manifest",
19
21
  "README",
20
22
  "Rakefile",
21
23
  "VERSION",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zzamboni-things2thl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Zamboni
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-18 00:00:00 -07:00
12
+ date: 2009-05-19 00:00:00 -07:00
13
13
  default_executable: things2thl
14
14
  dependencies: []
15
15
 
@@ -20,8 +20,10 @@ executables:
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
+ - ChangeLog
23
24
  - README
24
25
  files:
26
+ - ChangeLog
25
27
  - Manifest
26
28
  - README
27
29
  - Rakefile