syc-task 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWMwMWJhYWJhZGY4YTNjZGUyMmY1ODEwMTJhNzI4ZDZlZjYzOTI2NQ==
4
+ ZTA1MGU1ZWJhNTQwMTQ2MzczY2M0ZjcyODUwMjdjYWFhY2Y4NzE5OA==
5
5
  data.tar.gz: !binary |-
6
- YTcyYzcyOThjZDFlYzQyOTgyNWI0YWZiYzNhMmE5NDMwNzFhNGE4Zg==
6
+ NjliNTYxODBjMTYxYTc4NjM1YTY0YjA5YmZlMDEyZDkyNDlmMjFjNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWYyYjM0Njk1MDM3ZGY2MTMwYWU1M2RjODZhYTE0MjAzOGIyNTc0YzkxNTVh
10
- MDliMjVmODgyZDY5ZGVhMDg2ZWQyNzRiYzMyZTZmNDY5MDFmNmQwZmM3Yzdi
11
- MjNjMTA0YTJiMmZlZmUxZTExMjE3YzI2MWMwNmEzMzhjNDgxMDk=
9
+ MGE4YzkwMWYyMjZkOWI0ZDMwYzVlZWIyY2I1NWY4YTgyODIzZmNhMjAzNThi
10
+ NjIzZjZlOTQ0N2IwOTU4ZjI4MTJlNjQ2YzYxOWI5NTBiMTMxMjVhMjVkNDQ5
11
+ N2JiYWU5MDRjNjQ0NWU0NTlmYzUwODliMWU2YWQxMjRiNTIwODI=
12
12
  data.tar.gz: !binary |-
13
- ZTYyNzAyNzAzNzdiYWZjYTI3MzU0N2YzYzU1NGNiZTRiNWY5NzhjMmY3MzA5
14
- ZjBkYTJjMjE5N2FjZGE0YzQ4OTgyNmM1ZTJhNTY0ZjVhNTliMmY5M2E1MGJi
15
- NWQ1YzAyODc0MzRiMmQ0ZDc4YWQ3MGZjMzZhZDg2NTdjZWI5OTU=
13
+ YjdkMTFlMzExMjA3YjIwM2RlZTdjN2JjZTc5YWMwNTQ0YTIxZmE4ZmE0N2I1
14
+ NmZhMGQyMGIyZjcwMDEwMmIxMTBiZTNhZWU3MjEwODUxMzBlYWQ4ZmQwY2My
15
+ ODA4N2Q1NmNmMjQxZjlmZWZkOGQ1ZTU4MTc4Njg3OWQ2ODUxNWE=
@@ -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 tomorrow's
61
- plan. The duration will be set to the remaining processing time but at least to
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
- * [http://syc.dyndns.org/drupal/wiki/syc-task] - Development notebook
550
- * [https://rubygems.org/gems/syc-backup] - RubyGems
619
+ * [https://rubygems.org/gems/syc-task] - RubyGems
@@ -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
- puts "scan command not implemented yet"
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
- task.print_pretty(complete)
269
- count += 1
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
 
@@ -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'
@@ -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.expand_path('~/.tasks') : work_dir
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 = [File.expand_path("~")]
180
+ whitelisted_dir = [ENV['HOME']]
181
181
  puts "Searching directories and all sub-directories starting in\n"+
182
- "#{File.expand_path("~")}"
182
+ "#{ENV['HOME']}"
183
183
  end
184
184
  end
185
185
  [1, whitelisted_dirs, blacklisted_dirs]
@@ -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 - follow-up date of the task
20
- # * due - due date of the task
21
- # * prio - priority of the task
22
- # * note - information about the progress or state of the task
23
- # * tags - can be used to search for tasks that belong to a certain category
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 = "\n#{@id};#{@title};"
289
- string +" #{@options[:description]};#{@options[:prio]};"
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"}\n"
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
- [state[:work_time],
170
- state[:busy_time],
171
- state[:meetings],
172
- state[:assignments]]
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
@@ -1,5 +1,5 @@
1
1
  # Syctask provides functions for managing tasks in a task list
2
2
  module Syctask
3
3
  #Holds the version number of syctask
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.1'
5
5
  end
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.2.1
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-03 00:00:00.000000000 Z
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===Plan tasks\nThe plan command will print tasks
130
- and prompts whether to (a)dd or (s)kip the \ntask. If (q)uit is selected the tasks
131
- already added will be add to the today's \ntask list. If (c)omplete is selected
132
- the complete task will be printed and the \nuser will be prompted again for adding
133
- the task.\n\nInvoke plan without filter\n $ syctask plan\n 1 - My first task\n
134
- \ (a)dd, (c)omplete, (s)kip, (q)uit? a\n Duration (1 = 15 minutes, return 30
135
- minutes): 3\n --> 1 task(s) planned\n\nInvoke plan with a filter\n $ syctask
136
- plan --id \"1,3,5,8\"\n 1 - My first task\n (a)dd, (c)omplete, (s)kip, (q)uit?\n\nMove
137
- tasks to another days plan\n $ syctask plan today --move tomorrow --id 3,5\n\nThis
138
- will move the tasks with ID 3 and 5 from the today's plan to the tomorrow's \nplan.
139
- The duration will be set to the remaining processing time but at least to\n30 minutes.\n\n===Prioritize
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\n==Development\nPull
338
- from Github and then run \n\n $ bundle install \n \nDebugging the interface
339
- can be done with GLI_DEBUG: \n\n $ bundle exec env GLI_DEBUG=true bin/syctask\n\nBuilding
340
- the gemfile\n\n $ gem build syctask.gemspec\n\n==Tests\nThe test files live in
341
- the folder test and start with test_.\n\nThere is a rake file available to run all
342
- tests\n\n $ rake test\n \n==License\nsyc-task is released under the {MIT License}[http://opensource.org/licenses/MIT]\n\n==Links\n*
343
- [http://www.github.com/sugaryourcoffee/syc-task] - Source code on GitHub\n* [http://syc.dyndns.org/drupal/wiki/syc-task]
344
- - Development notebook\n* [https://rubygems.org/gems/syc-backup] - RubyGems\n"
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