todo-txt 0.11 → 0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -6
- data/lib/todo/syntax.rb +2 -1
- data/lib/todo/task.rb +4 -2
- data/spec/todo-txt/syntax_spec.rb +6 -2
- data/spec/todo-txt/task_spec.rb +24 -0
- data/todo-txt.gemspec +3 -3
- data/todo.txt +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7a77690c0596d1dc7ab740024ced36e746b8371
|
4
|
+
data.tar.gz: ace4ecb0e56427567374642cae500ac5f8914373
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef210708fbf399f7e88ec46eb62baaaebb22420d0ed51db02470a9b3cdd3121dc6abb8c827dba187c16024efa9cfb8f0a3320943427f62baa00e4034d6d5ec87
|
7
|
+
data.tar.gz: c69513629db8e4b058c4020c42e71d34da2e1c4813c6f9ba5e74e051dc8a15a5a17e97f64894ba274721073e50afe4d90832a66e5525384eb878bce5af4a8153
|
data/.travis.yml
CHANGED
data/lib/todo/syntax.rb
CHANGED
@@ -22,7 +22,7 @@ module Todo
|
|
22
22
|
DUE_ON_PATTERN = /(?:due:)(\d{4}-\d{2}-\d{2})(?:\s+|$)/i
|
23
23
|
|
24
24
|
# The regex used to match generic tags.
|
25
|
-
TAGS_PATTERN = /([a-z]+):([
|
25
|
+
TAGS_PATTERN = /([a-z]+):([A-Za-z0-9_-]+)/i
|
26
26
|
|
27
27
|
# Extracts the readable text content of a task line, stripping out all the
|
28
28
|
# discrete pieces of metadata (priority, dates, completion flag, projects,
|
@@ -38,6 +38,7 @@ module Todo
|
|
38
38
|
.gsub(CONTEXTS_PATTERN, '')
|
39
39
|
.gsub(PROJECTS_PATTERN, '')
|
40
40
|
.gsub(DUE_ON_PATTERN, '')
|
41
|
+
.gsub(TAGS_PATTERN, '')
|
41
42
|
.strip
|
42
43
|
end
|
43
44
|
|
data/lib/todo/task.rb
CHANGED
@@ -12,7 +12,9 @@ module Todo
|
|
12
12
|
include Todo::Logger
|
13
13
|
include Todo::Syntax
|
14
14
|
|
15
|
-
|
15
|
+
# @param line [String]
|
16
|
+
# @param options [Todo::Options]
|
17
|
+
def initialize(line, options=Todo.options)
|
16
18
|
@raw = line
|
17
19
|
@priority = extract_priority(raw)
|
18
20
|
@created_on = extract_created_on(raw)
|
@@ -20,7 +22,7 @@ module Todo
|
|
20
22
|
@contexts ||= extract_contexts(raw)
|
21
23
|
@projects ||= extract_projects(raw)
|
22
24
|
|
23
|
-
if
|
25
|
+
if options.require_completed_on
|
24
26
|
@completed_on = extract_completed_date(raw)
|
25
27
|
@is_completed = !@completed_on.nil?
|
26
28
|
else
|
@@ -135,6 +135,10 @@ describe Todo::Syntax do
|
|
135
135
|
specify 'task with multiple tags' do
|
136
136
|
expect(extract_tags('something to do hello:world and foo:bar')).to eq(:hello => 'world', :foo => 'bar')
|
137
137
|
end
|
138
|
+
|
139
|
+
specify 'task with uppercase letters' do
|
140
|
+
expect(extract_tags('something to do TagKey:TagValue attrKey:attrValue')).to eq(:tagkey => 'TagValue', :attrkey => 'attrValue')
|
141
|
+
end
|
138
142
|
end
|
139
143
|
|
140
144
|
describe '#extract_item_text' do
|
@@ -146,8 +150,8 @@ describe Todo::Syntax do
|
|
146
150
|
expect(extract_item_text('something to do')).to eq('something to do')
|
147
151
|
end
|
148
152
|
|
149
|
-
specify 'task with date, priority, projects and
|
150
|
-
expect(extract_item_text('(A) 2016-03-29 something to do +experiment @work')).to eq('something to do')
|
153
|
+
specify 'task with date, priority, projects, context and tags' do
|
154
|
+
expect(extract_item_text('(A) 2016-03-29 something to do tag:val +experiment @work')).to eq('something to do')
|
151
155
|
end
|
152
156
|
|
153
157
|
specify 'completed task with projects and context' do
|
data/spec/todo-txt/task_spec.rb
CHANGED
@@ -434,4 +434,28 @@ describe Todo::Task do
|
|
434
434
|
task.orig
|
435
435
|
end
|
436
436
|
end
|
437
|
+
|
438
|
+
describe 'customizable options' do
|
439
|
+
before(:all) do
|
440
|
+
Todo.customize do |options|
|
441
|
+
options.require_completed_on = false
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
after(:all) do
|
446
|
+
Todo.options.reset
|
447
|
+
end
|
448
|
+
|
449
|
+
it 'should default to global options' do
|
450
|
+
task = Todo::Task.new('x this is an outstanding task')
|
451
|
+
expect(task.done?).to eq(true)
|
452
|
+
end
|
453
|
+
|
454
|
+
it 'accepts options instance' do
|
455
|
+
options = Todo::Options.new
|
456
|
+
options.require_completed_on = true
|
457
|
+
task = Todo::Task.new('x this is an outstanding task', options)
|
458
|
+
expect(task.done?).to eq(false)
|
459
|
+
end
|
460
|
+
end
|
437
461
|
end
|
data/todo-txt.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'todo-txt'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.12'
|
4
4
|
s.authors = ['Sam Rose']
|
5
5
|
s.email = 'samwho@lbak.co.uk'
|
6
6
|
s.summary = 'A client library for parsing todo.txt files.'
|
7
7
|
s.homepage = 'http://github.com/samwho/todo-txt-gem'
|
8
8
|
s.description = 'Allows for simple parsing of todo.txt files, as per Gina Trapani\'s todo.txt project.'
|
9
|
-
s.required_ruby_version = '>= 2.
|
10
|
-
s.license = 'GPL-2'
|
9
|
+
s.required_ruby_version = '>= 2.2'
|
10
|
+
s.license = 'GPL-2.0'
|
11
11
|
s.files = `git ls-files`.split(/\n/)
|
12
12
|
end
|
data/todo.txt
CHANGED
@@ -9,7 +9,7 @@ use << operation to move tasks between lists +api +feature
|
|
9
9
|
create github issue with roadmap for 1.0 release +feature +api
|
10
10
|
consider rewriting file write tests with mocking and stringio +refactor +build
|
11
11
|
remove deprecated date and orig methods from task +api
|
12
|
-
pass in options as an instance rather than make it always global +refactor +api
|
12
|
+
x 2016-08-18 pass in options as an instance rather than make it always global +refactor +api
|
13
13
|
save a backup of an existing todo file when the IO object is read in +feature
|
14
14
|
x 2016-06-16 extract `due:` formatting into a more general syntax for adding tags +feature +refactor +api
|
15
15
|
x rename lib path to match standard gem conventions +refactor
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todo-txt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Rose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Allows for simple parsing of todo.txt files, as per Gina Trapani's todo.txt
|
14
14
|
project.
|
@@ -46,7 +46,7 @@ files:
|
|
46
46
|
- todo.txt
|
47
47
|
homepage: http://github.com/samwho/todo-txt-gem
|
48
48
|
licenses:
|
49
|
-
- GPL-2
|
49
|
+
- GPL-2.0
|
50
50
|
metadata: {}
|
51
51
|
post_install_message:
|
52
52
|
rdoc_options: []
|
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '2.
|
59
|
+
version: '2.2'
|
60
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
@@ -64,8 +64,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.6.11
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: A client library for parsing todo.txt files.
|
71
71
|
test_files: []
|
72
|
+
has_rdoc:
|