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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7d702d4739e83cb71e7663bf0feb86ab11b8d81
4
- data.tar.gz: 107da665b03b10d335e16b582a31cfdee9ce6569
3
+ metadata.gz: d7a77690c0596d1dc7ab740024ced36e746b8371
4
+ data.tar.gz: ace4ecb0e56427567374642cae500ac5f8914373
5
5
  SHA512:
6
- metadata.gz: b1d76f95cee15a70800ecb80c96927ec5d9978e264f415c95170069b73d5388ba7b49ec6dbfe8d53252e9b7166496a5ff5a7b0e2f6c5223048ede4b757a13b22
7
- data.tar.gz: 914f9766d4c6932d37f70f0be79e526a4487a70ffad95c377b6e461744c9d3fe7b0147f1633a9de8f6658f00ab1a7561e8d52fcc72b79e1531c859b6cb801fe4
6
+ metadata.gz: ef210708fbf399f7e88ec46eb62baaaebb22420d0ed51db02470a9b3cdd3121dc6abb8c827dba187c16024efa9cfb8f0a3320943427f62baa00e4034d6d5ec87
7
+ data.tar.gz: c69513629db8e4b058c4020c42e71d34da2e1c4813c6f9ba5e74e051dc8a15a5a17e97f64894ba274721073e50afe4d90832a66e5525384eb878bce5af4a8153
@@ -1,11 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1
4
- - 2.2
5
- - 2.3.0
6
- - rbx-2
3
+ - 2.2.7
4
+ - 2.3.4
5
+ - 2.4.1
7
6
  - jruby-9000
8
- - jruby-head
9
- - ruby-head
10
7
  before_install: gem install bundler -v 1.10.6
11
8
  script: bundle exec rspec
@@ -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]+):([a-z0-9_-]+)/i
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
 
@@ -12,7 +12,9 @@ module Todo
12
12
  include Todo::Logger
13
13
  include Todo::Syntax
14
14
 
15
- def initialize(line)
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 Todo.options.require_completed_on
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 context' do
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
@@ -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
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'todo-txt'
3
- s.version = '0.11'
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.0'
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.11'
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: 2016-07-03 00:00:00.000000000 Z
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.0'
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.4.5
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: