syc-task 0.2.1 → 0.3.1
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.
- checksums.yaml +8 -8
- data/README.rdoc +75 -6
- data/bin/syctask +30 -5
- data/lib/syctask.rb +1 -0
- data/lib/syctask/environment.rb +4 -4
- data/lib/syctask/task.rb +14 -9
- data/lib/syctask/task_scheduler.rb +8 -4
- data/lib/syctask/version.rb +1 -1
- metadata +51 -21
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTA1MGU1ZWJhNTQwMTQ2MzczY2M0ZjcyODUwMjdjYWFhY2Y4NzE5OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjliNTYxODBjMTYxYTc4NjM1YTY0YjA5YmZlMDEyZDkyNDlmMjFjNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGE4YzkwMWYyMjZkOWI0ZDMwYzVlZWIyY2I1NWY4YTgyODIzZmNhMjAzNThi
|
10
|
+
NjIzZjZlOTQ0N2IwOTU4ZjI4MTJlNjQ2YzYxOWI5NTBiMTMxMjVhMjVkNDQ5
|
11
|
+
N2JiYWU5MDRjNjQ0NWU0NTlmYzUwODliMWU2YWQxMjRiNTIwODI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjdkMTFlMzExMjA3YjIwM2RlZTdjN2JjZTc5YWMwNTQ0YTIxZmE4ZmE0N2I1
|
14
|
+
NmZhMGQyMGIyZjcwMDEwMmIxMTBiZTNhZWU3MjEwODUxMzBlYWQ4ZmQwY2My
|
15
|
+
ODA4N2Q1NmNmMjQxZjlmZWZkOGQ1ZTU4MTc4Njg3OWQ2ODUxNWE=
|
data/README.rdoc
CHANGED
@@ -36,6 +36,60 @@ will prompt for task titles. Ctrl-D will end input.
|
|
36
36
|
|
37
37
|
Except for --description you can also provide short forms for the options.
|
38
38
|
|
39
|
+
===Create tasks by scanning from files
|
40
|
+
When writing minutes of meetings tasks that should be followed up in syctask
|
41
|
+
can be annotated so they will be recognized by the scan command. The following
|
42
|
+
structure shows how to annotade tasks
|
43
|
+
|
44
|
+
Some text before
|
45
|
+
|
46
|
+
@task;
|
47
|
+
title;description;follow_up;due_date,prio
|
48
|
+
Schedule meeting;Invite all developers;2016-09-12;2016-10-12;1
|
49
|
+
Write letter;Practice writing letters;;;3
|
50
|
+
|
51
|
+
Some text after
|
52
|
+
|
53
|
+
The above annotation will only scan the next task because of the singular 'task'
|
54
|
+
where the task values are separated with ';'. The line after the annotation
|
55
|
+
'@task' lists the sequence of the fields of the task. It is also possible to
|
56
|
+
list the tasks in a table, e.g. markdown
|
57
|
+
|
58
|
+
Some text before
|
59
|
+
|
60
|
+
@tasks|
|
61
|
+
title |description |follow_up |due_date |prio
|
62
|
+
----------------|--------------------------|----------|----------|----
|
63
|
+
Schedule meeting|Invite all developers |2016-09-12|2016-10-12|1
|
64
|
+
Write letter |Practice writing letters | | |3
|
65
|
+
|
66
|
+
Some text after
|
67
|
+
|
68
|
+
Call partner |Ask for project's progress|2016-09-14| |1
|
69
|
+
|
70
|
+
Even more text
|
71
|
+
|
72
|
+
The example above scans all tasks due to the plural 'tasks'. It also scans all
|
73
|
+
tasks that are separated with non-task text and occur after the annotation and
|
74
|
+
confirm to the field structure. Lines that start with '-' will be ignored. So
|
75
|
+
if you want to skip only a view tasks within a task list prepend them with '-'.
|
76
|
+
If you have tasks with different fields then you have to add another annotation
|
77
|
+
with the new field structure.
|
78
|
+
|
79
|
+
Possible fields are
|
80
|
+
|
81
|
+
title - the title of the task
|
82
|
+
description - the description of the task
|
83
|
+
follow_up - the follow-up date of the task in the form yyyy-mm-dd
|
84
|
+
due_date - the due-date of the task in the form yyyy-mm-dd
|
85
|
+
prio - the priority of the task
|
86
|
+
tags - tags the task is annotated with
|
87
|
+
note - a note for the task
|
88
|
+
|
89
|
+
Scanning tasks from a file
|
90
|
+
|
91
|
+
$ syctask scan 2016-09-10-mom.md 2016-09-09-mom.md
|
92
|
+
|
39
93
|
===Plan tasks
|
40
94
|
The plan command will print tasks and prompts whether to (a)dd or (s)kip the
|
41
95
|
task. If (q)uit is selected the tasks already added will be add to the today's
|
@@ -57,9 +111,9 @@ Invoke plan with a filter
|
|
57
111
|
Move tasks to another days plan
|
58
112
|
$ syctask plan today --move tomorrow --id 3,5
|
59
113
|
|
60
|
-
This will move the tasks with ID 3 and 5 from the today's plan to the
|
61
|
-
plan. The duration will be set to the remaining processing time but
|
62
|
-
30 minutes.
|
114
|
+
This will move the tasks with ID 3 and 5 from the today's plan to the
|
115
|
+
tomorrow's plan. The duration will be set to the remaining processing time but
|
116
|
+
at least to 30 minutes.
|
63
117
|
|
64
118
|
===Prioritize tasks
|
65
119
|
Planned tasks can be prioritized in a pair wise comparisson. So each task is
|
@@ -521,18 +575,26 @@ Version 0.2.1
|
|
521
575
|
also define directories to be excluded. This is especially helpful to omit
|
522
576
|
search in large mounted directories, like from NAS servers.
|
523
577
|
|
578
|
+
Version 0.3.1
|
579
|
+
* Add csv output spearated by ';' to the list command
|
580
|
+
* Fix bug when schedule file is empty
|
581
|
+
* Add scan command to scan tasks from files
|
582
|
+
|
524
583
|
==Development
|
525
584
|
Pull from Github and then run
|
526
585
|
|
527
586
|
$ bundle install
|
528
587
|
|
588
|
+
New classes have to be added to 'lib/syctask.rb'
|
589
|
+
|
529
590
|
Debugging the interface can be done with GLI_DEBUG:
|
530
591
|
|
531
592
|
$ bundle exec env GLI_DEBUG=true bin/syctask
|
532
593
|
|
533
|
-
Building the gemfile
|
594
|
+
Building and pushing the gemfile to Rubygems
|
534
595
|
|
535
596
|
$ gem build syctask.gemspec
|
597
|
+
$ gem push syc-task-0.2.1.gem
|
536
598
|
|
537
599
|
==Tests
|
538
600
|
The test files live in the folder test and start with test_.
|
@@ -541,10 +603,17 @@ There is a rake file available to run all tests
|
|
541
603
|
|
542
604
|
$ rake test
|
543
605
|
|
606
|
+
The CLI is tested with Cucumber. To run the Cucumber features in verbose mode
|
607
|
+
|
608
|
+
$ cucumber
|
609
|
+
|
610
|
+
or if you prefer cleaner output run
|
611
|
+
|
612
|
+
$ rake features
|
613
|
+
|
544
614
|
==License
|
545
615
|
syc-task is released under the {MIT License}[http://opensource.org/licenses/MIT]
|
546
616
|
|
547
617
|
==Links
|
548
618
|
* [http://www.github.com/sugaryourcoffee/syc-task] - Source code on GitHub
|
549
|
-
* [
|
550
|
-
* [https://rubygems.org/gems/syc-backup] - RubyGems
|
619
|
+
* [https://rubygems.org/gems/syc-task] - RubyGems
|
data/bin/syctask
CHANGED
@@ -97,7 +97,7 @@ command :info do |c|
|
|
97
97
|
|
98
98
|
c.action do |global_options,options,args|
|
99
99
|
dir = options[:dir]
|
100
|
-
dir ||=
|
100
|
+
dir ||= ENV['HOME']
|
101
101
|
dir = File.expand_path(dir)
|
102
102
|
help_now! "Directory #{dir} does not exists" unless File.exists? dir
|
103
103
|
id = options[:id]
|
@@ -184,7 +184,24 @@ desc 'Extract tasks from a file'
|
|
184
184
|
arg_name 'TASK_FILE'
|
185
185
|
command :scan do |c|
|
186
186
|
c.action do |global_options,options,args|
|
187
|
-
|
187
|
+
help_now! "You must provide file(s) to extract tasks from" if args.empty?
|
188
|
+
scanner = Syctask::Scanner.new
|
189
|
+
task_numbers = []
|
190
|
+
args.each do |file|
|
191
|
+
scanner.scan(file).each do |title, options|
|
192
|
+
task_number = @service.create(global_options[:t], options, title)
|
193
|
+
add_task_to_plan @service.read(global_options[:t], task_number)
|
194
|
+
task_numbers << task_number
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
if task_numbers.empty?
|
199
|
+
puts
|
200
|
+
help_now! "#{args.join(', ')} doesn't contain tasks"
|
201
|
+
else
|
202
|
+
STDOUT.puts sprintf("%s %s", "--> created tasks with task numbers",
|
203
|
+
" #{task_numbers.join(', ')}").color(:green)
|
204
|
+
end
|
188
205
|
end
|
189
206
|
end
|
190
207
|
|
@@ -225,6 +242,9 @@ command :list do |c|
|
|
225
242
|
c.desc 'Print complete task'
|
226
243
|
c.switch [:c, :complete]
|
227
244
|
|
245
|
+
c.desc 'Print as csv separated by ";"'
|
246
|
+
c.switch [:csv]
|
247
|
+
|
228
248
|
c.desc 'Filter for ID'
|
229
249
|
c.arg_name 'ID1,ID2,ID3|[<|=|>]ID'
|
230
250
|
c.flag [:i, :id], :must_match => /^\d+(?:,\d+)*|^[<|=|>]\d+/
|
@@ -260,15 +280,20 @@ command :list do |c|
|
|
260
280
|
c.action do |global_options,options,args|
|
261
281
|
filter = [:id, :tags, :description, :prio, :due_date, :follow_up,
|
262
282
|
:note, :title]
|
283
|
+
csv = options[:csv]
|
263
284
|
all = options[:all]
|
264
285
|
complete = options[:complete]
|
265
286
|
options.keep_if {|key, value| filter.find_index(key) and value != nil}
|
266
287
|
count = 0
|
267
288
|
@service.find(global_options[:t], options, all).each do |task|
|
268
|
-
|
269
|
-
|
289
|
+
if csv
|
290
|
+
task.print_csv
|
291
|
+
else
|
292
|
+
task.print_pretty(complete)
|
293
|
+
count += 1
|
294
|
+
end
|
270
295
|
end
|
271
|
-
STDOUT.puts sprintf("--> found %d tasks", count).color(:green)
|
296
|
+
STDOUT.puts sprintf("--> found %d tasks", count).color(:green) unless csv
|
272
297
|
end
|
273
298
|
end
|
274
299
|
|
data/lib/syctask.rb
CHANGED
@@ -4,6 +4,7 @@ require 'syctask/task.rb'
|
|
4
4
|
require 'syctask/task_service.rb'
|
5
5
|
require 'syctask/task_scheduler.rb'
|
6
6
|
require 'syctask/task_planner.rb'
|
7
|
+
require 'syctask/scanner.rb'
|
7
8
|
require 'syctask/schedule.rb'
|
8
9
|
require 'syctask/task_tracker.rb'
|
9
10
|
require 'syctask/environment.rb'
|
data/lib/syctask/environment.rb
CHANGED
@@ -3,7 +3,7 @@ require 'find'
|
|
3
3
|
module Syctask
|
4
4
|
|
5
5
|
# System directory of syctask
|
6
|
-
SYC_DIR = File.expand_path('~/.syc/syctask')
|
6
|
+
SYC_DIR = File.join(ENV['HOME'], '.syc/syctask') # expand_path('~/.syc/syctask')
|
7
7
|
# ID file where the last issued ID is saved
|
8
8
|
ID = SYC_DIR + "/id"
|
9
9
|
# File that contains all issued IDs
|
@@ -28,7 +28,7 @@ module Syctask
|
|
28
28
|
# User specified default working directory
|
29
29
|
work_dir = dir if not dir.nil? and not dir.empty? and File.exists? dir
|
30
30
|
# Set eather user defined work directory or default
|
31
|
-
WORK_DIR = work_dir.nil? ? File.
|
31
|
+
WORK_DIR = work_dir.nil? ? File.join(ENV['HOME'], '.tasks') : work_dir
|
32
32
|
|
33
33
|
# Logs a task regarding create, update, done, delete
|
34
34
|
def log_task(type, task)
|
@@ -177,9 +177,9 @@ module Syctask
|
|
177
177
|
blacklisted_dirs = gets.chomp.split(/\s+/)
|
178
178
|
.map { |f| File.expand_path(f) }
|
179
179
|
else
|
180
|
-
whitelisted_dir = [
|
180
|
+
whitelisted_dir = [ENV['HOME']]
|
181
181
|
puts "Searching directories and all sub-directories starting in\n"+
|
182
|
-
"#{
|
182
|
+
"#{ENV['HOME']}"
|
183
183
|
end
|
184
184
|
end
|
185
185
|
[1, whitelisted_dirs, blacklisted_dirs]
|
data/lib/syctask/task.rb
CHANGED
@@ -13,14 +13,19 @@ module Syctask
|
|
13
13
|
|
14
14
|
include Comparable
|
15
15
|
|
16
|
+
# The fields that can be set for a task
|
17
|
+
FIELDS = ["title", "description",
|
18
|
+
"follow_up", "due_date", "prio",
|
19
|
+
"note", "tags"]
|
16
20
|
# Holds the options of the task.
|
17
21
|
# Options are
|
18
22
|
# * description - additional information about the task
|
19
|
-
# * follow_up
|
20
|
-
# *
|
21
|
-
# * prio
|
22
|
-
# * note
|
23
|
-
# * tags
|
23
|
+
# * follow_up - follow-up date of the task
|
24
|
+
# * due_date - due date of the task
|
25
|
+
# * prio - priority of the task
|
26
|
+
# * note - information about the progress or state of the task
|
27
|
+
# * tags - can be used to search for tasks that belong to a certain
|
28
|
+
# category
|
24
29
|
attr_accessor :options
|
25
30
|
# Title of the class
|
26
31
|
attr_reader :title
|
@@ -285,14 +290,14 @@ module Syctask
|
|
285
290
|
# id;title;description;prio;follow-up;due;note;tags;created;
|
286
291
|
# updated|UNCHANGED;DONE|OPEN
|
287
292
|
def csv_string
|
288
|
-
string =
|
289
|
-
string
|
293
|
+
string = "#{@id};#{@title};"
|
294
|
+
string += "#{@options[:description]};#{@options[:prio]};"
|
290
295
|
string += "#{@options[:follow_up]};#{@options[:due_date]};"
|
291
|
-
string += "#{@options[:note].gsub(/\n/, '\\n')};"
|
296
|
+
string += "#{@options[:note] ? @options[:note].gsub(/\n/, '\\n') : ""};"
|
292
297
|
string += "#{@options[:tags]};"
|
293
298
|
string += "#{@creation_date};"
|
294
299
|
string += "#{@udpate_date ? "UPDATED" : "UNCHANGED"};"
|
295
|
-
string += "#{@done_date ? "DONE" : "OPEN"}
|
300
|
+
string += "#{@done_date ? "DONE" : "OPEN"}"
|
296
301
|
string
|
297
302
|
end
|
298
303
|
|
@@ -166,10 +166,14 @@ module Syctask
|
|
166
166
|
state_file = WORK_DIR+'/'+Time.now.strftime("%Y-%m-%d_time_schedule")
|
167
167
|
return [[], [], [], []] unless File.exists? state_file
|
168
168
|
state = YAML.load_file(state_file)
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
169
|
+
if state
|
170
|
+
[state[:work_time],
|
171
|
+
state[:busy_time],
|
172
|
+
state[:meetings],
|
173
|
+
state[:assignments]]
|
174
|
+
else
|
175
|
+
[[], [], [], []]
|
176
|
+
end
|
173
177
|
end
|
174
178
|
|
175
179
|
end
|
data/lib/syctask/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syc-task
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Sugar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -126,17 +126,42 @@ description: ! "= Simple task organizer\nsyctask can be used to create, plan, pr
|
|
126
126
|
--due \"2013-03-11\"\n\nSet a proirity for a task\n $ syctask new \"My first
|
127
127
|
task\" --prio 3\n\nPrompt for task input\n $ syctask new\nwill prompt for task
|
128
128
|
titles. Ctrl-D will end input.\n\nExcept for --description you can also provide
|
129
|
-
short forms for the options.\n\n===
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
\
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
129
|
+
short forms for the options.\n\n===Create tasks by scanning from files\nWhen writing
|
130
|
+
minutes of meetings tasks that should be followed up in syctask\ncan be annotated
|
131
|
+
so they will be recognized by the scan command. The following\nstructure shows how
|
132
|
+
to annotade tasks\n\n Some text before\n\n @task;\n title;description;follow_up;due_date,prio\n
|
133
|
+
\ Schedule meeting;Invite all developers;2016-09-12;2016-10-12;1\n Write letter;Practice
|
134
|
+
writing letters;;;3\n\n Some text after\n\nThe above annotation will only scan
|
135
|
+
the next task because of the singular 'task'\nwhere the task values are separated
|
136
|
+
with ';'. The line after the annotation\n'@task' lists the sequence of the fields
|
137
|
+
of the task. It is also possible to \nlist the tasks in a table, e.g. markdown\n\n
|
138
|
+
\ Some text before\n\n @tasks|\n title |description |follow_up
|
139
|
+
|due_date |prio\n ----------------|--------------------------|----------|----------|----\n
|
140
|
+
\ Schedule meeting|Invite all developers |2016-09-12|2016-10-12|1\n Write
|
141
|
+
letter |Practice writing letters | | |3\n\n Some text after\n\n
|
142
|
+
\ Call partner |Ask for project's progress|2016-09-14| |1\n\n Even
|
143
|
+
more text \n\nThe example above scans all tasks due to the plural 'tasks'. It also
|
144
|
+
scans all\ntasks that are separated with non-task text and occur after the annotation
|
145
|
+
and \nconfirm to the field structure. Lines that start with '-' will be ignored.
|
146
|
+
So \nif you want to skip only a view tasks within a task list prepend them with
|
147
|
+
'-'.\nIf you have tasks with different fields then you have to add another annotation\nwith
|
148
|
+
the new field structure. \n\nPossible fields are\n\n title - the title
|
149
|
+
of the task\n description - the description of the task\n follow_up - the
|
150
|
+
follow-up date of the task in the form yyyy-mm-dd\n due_date - the due-date
|
151
|
+
of the task in the form yyyy-mm-dd\n prio - the priority of the task\n
|
152
|
+
\ tags - tags the task is annotated with\n note - a note for
|
153
|
+
the task\n\nScanning tasks from a file\n\n $ syctask scan 2016-09-10-mom.md 2016-09-09-mom.md\n\n===Plan
|
154
|
+
tasks\nThe plan command will print tasks and prompts whether to (a)dd or (s)kip
|
155
|
+
the \ntask. If (q)uit is selected the tasks already added will be add to the today's
|
156
|
+
\ntask list. If (c)omplete is selected the complete task will be printed and the
|
157
|
+
\nuser will be prompted again for adding the task.\n\nInvoke plan without filter\n
|
158
|
+
\ $ syctask plan\n 1 - My first task\n (a)dd, (c)omplete, (s)kip, (q)uit?
|
159
|
+
a\n Duration (1 = 15 minutes, return 30 minutes): 3\n --> 1 task(s) planned\n\nInvoke
|
160
|
+
plan with a filter\n $ syctask plan --id \"1,3,5,8\"\n 1 - My first task\n
|
161
|
+
\ (a)dd, (c)omplete, (s)kip, (q)uit?\n\nMove tasks to another days plan\n $
|
162
|
+
syctask plan today --move tomorrow --id 3,5\n\nThis will move the tasks with ID
|
163
|
+
3 and 5 from the today's plan to the \ntomorrow's plan. The duration will be set
|
164
|
+
to the remaining processing time but \nat least to 30 minutes.\n\n===Prioritize
|
140
165
|
tasks\nPlanned tasks can be prioritized in a pair wise comparisson. So each task
|
141
166
|
is\ncompared to all other tasks. The task with the highest priority will bubble
|
142
167
|
on\ntop followed by the task with the next highest priority and so on.\n\n $
|
@@ -334,14 +359,19 @@ description: ! "= Simple task organizer\nsyctask can be used to create, plan, pr
|
|
334
359
|
contains notes\n* Refactor migration from version 0.0.7 and when user has deleted
|
335
360
|
system files.\n The user can now specify the directories where the tasks are located
|
336
361
|
and can\n also define directories to be excluded. This is especially helpful to
|
337
|
-
omit \n search in large mounted directories, like from NAS servers.\n\
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
362
|
+
omit \n search in large mounted directories, like from NAS servers.\n\nVersion
|
363
|
+
0.3.1\n* Add csv output spearated by ';' to the list command\n* Fix bug when schedule
|
364
|
+
file is empty\n* Add scan command to scan tasks from files\n\n==Development\nPull
|
365
|
+
from Github and then run \n\n $ bundle install \n \nNew classes have to be
|
366
|
+
added to 'lib/syctask.rb'\n\nDebugging the interface can be done with GLI_DEBUG:
|
367
|
+
\n\n $ bundle exec env GLI_DEBUG=true bin/syctask\n\nBuilding and pushing the
|
368
|
+
gemfile to Rubygems\n\n $ gem build syctask.gemspec\n $ gem push syc-task-0.2.1.gem\n\n==Tests\nThe
|
369
|
+
test files live in the folder test and start with test_.\n\nThere is a rake file
|
370
|
+
available to run all tests\n\n $ rake test\n \nThe CLI is tested with Cucumber.
|
371
|
+
To run the Cucumber features in verbose mode\n\n $ cucumber\n\nor if you prefer
|
372
|
+
cleaner output run\n\n $ rake features\n\n==License\nsyc-task is released under
|
373
|
+
the {MIT License}[http://opensource.org/licenses/MIT]\n\n==Links\n* [http://www.github.com/sugaryourcoffee/syc-task]
|
374
|
+
- Source code on GitHub\n* [https://rubygems.org/gems/syc-task] - RubyGems\n"
|
345
375
|
email: pierre@sugaryourcoffee.de
|
346
376
|
executables:
|
347
377
|
- syctask
|