markdo 0.1.12.alpha → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +15 -9
- data/Dockerfile +21 -7
- data/Guardfile +11 -0
- data/README.md +12 -7
- data/Rakefile +11 -7
- data/bin/markdo +1 -1
- data/docker-compose.yml +9 -0
- data/lib/markdo/cli.rb +23 -55
- data/lib/markdo/command_support.rb +14 -0
- data/lib/markdo/commands.rb +16 -0
- data/lib/markdo/{add_command.rb → commands/add_command.rb} +2 -6
- data/lib/markdo/commands/command.rb +33 -0
- data/lib/markdo/{edit_command.rb → commands/edit_command.rb} +2 -2
- data/lib/markdo/commands/forecast_command.rb +41 -0
- data/lib/markdo/{help_command.rb → commands/help_command.rb} +7 -8
- data/lib/markdo/commands/ics_command.rb +15 -0
- data/lib/markdo/commands/inbox_command.rb +11 -0
- data/lib/markdo/commands/overdue_command.rb +11 -0
- data/lib/markdo/commands/overview_command.rb +16 -0
- data/lib/markdo/commands/process_command.rb +91 -0
- data/lib/markdo/commands/query_command.rb +14 -0
- data/lib/markdo/commands/star_command.rb +11 -0
- data/lib/markdo/commands/summary_command.rb +25 -0
- data/lib/markdo/commands/tag_command.rb +11 -0
- data/lib/markdo/commands/today_command.rb +12 -0
- data/lib/markdo/commands/tomorrow_command.rb +12 -0
- data/lib/markdo/{version_command.rb → commands/version_command.rb} +1 -1
- data/lib/markdo/commands/week_command.rb +16 -0
- data/lib/markdo/data_source.rb +27 -0
- data/lib/markdo/ics_exporter.rb +65 -0
- data/lib/markdo/models/task.rb +46 -0
- data/lib/markdo/models/task_attribute.rb +22 -0
- data/lib/markdo/models/task_collection.rb +75 -0
- data/lib/markdo/version.rb +1 -1
- data/markdo.gemspec +6 -0
- data/script/build +9 -0
- data/spec/fixtures/add_command/Inbox.md +0 -0
- data/spec/fixtures/date_commands/Inbox.md +6 -0
- data/spec/fixtures/date_commands/Sprint.md +6 -0
- data/spec/fixtures/ics_command/Inbox.md +0 -0
- data/{test/fixtures/ics_command.md → spec/fixtures/ics_command/Sprint.md} +0 -0
- data/spec/fixtures/inbox_command/Inbox.md +2 -0
- data/spec/fixtures/inbox_command/Sprint.md +2 -0
- data/spec/fixtures/process_command/Backlog.md +0 -0
- data/spec/fixtures/process_command/Inbox.md +0 -0
- data/spec/fixtures/process_command/Maybe.md +0 -0
- data/spec/fixtures/process_command/Sprint.md +0 -0
- data/spec/fixtures/query_command/Inbox.md +4 -0
- data/spec/fixtures/query_command/Sprint.md +4 -0
- data/spec/fixtures/tag_command/Inbox.md +2 -0
- data/spec/fixtures/tag_command/Sprint.md +2 -0
- data/spec/lib/cli_spec.rb +79 -0
- data/spec/lib/commands/add_command_spec.rb +70 -0
- data/spec/lib/commands/edit_command_spec.rb +32 -0
- data/spec/lib/commands/forecast_command_spec.rb +24 -0
- data/spec/lib/commands/ics_command_spec.rb +30 -0
- data/spec/lib/commands/inbox_command_spec.rb +22 -0
- data/spec/lib/commands/overdue_command_spec.rb +19 -0
- data/spec/lib/commands/overview_command_spec.rb +25 -0
- data/spec/lib/commands/process_command_spec.rb +178 -0
- data/spec/lib/commands/query_command_spec.rb +23 -0
- data/spec/lib/commands/star_command_spec.rb +19 -0
- data/spec/lib/commands/summary_command_spec.rb +23 -0
- data/spec/lib/commands/tag_command_spec.rb +21 -0
- data/spec/lib/commands/today_command_spec.rb +19 -0
- data/spec/lib/commands/tomorrow_command_spec.rb +19 -0
- data/spec/lib/commands/week_command_spec.rb +23 -0
- data/spec/lib/ics_exporter_spec.rb +59 -0
- data/spec/lib/models/task_attribute_spec.rb +85 -0
- data/spec/lib/models/task_collection_spec.rb +168 -0
- data/spec/lib/models/task_spec.rb +79 -0
- data/spec/spec_helper.rb +40 -0
- metadata +189 -42
- data/.ruby-version +0 -1
- data/lib/markdo/command.rb +0 -12
- data/lib/markdo/date_command.rb +0 -9
- data/lib/markdo/forecast_command.rb +0 -61
- data/lib/markdo/ics_command.rb +0 -73
- data/lib/markdo/inbox_command.rb +0 -15
- data/lib/markdo/overdue_command.rb +0 -47
- data/lib/markdo/overview_command.rb +0 -17
- data/lib/markdo/process_command.rb +0 -68
- data/lib/markdo/query_command.rb +0 -24
- data/lib/markdo/rss_command.rb +0 -67
- data/lib/markdo/star_command.rb +0 -9
- data/lib/markdo/summary_command.rb +0 -30
- data/lib/markdo/tag_command.rb +0 -9
- data/lib/markdo/today_command.rb +0 -10
- data/lib/markdo/tomorrow_command.rb +0 -10
- data/lib/markdo/week_command.rb +0 -36
- data/test/fixtures/inbox.md +0 -2
- data/test/fixtures/rss_command.md +0 -4
- data/test/ics_command_test.rb +0 -38
- data/test/inbox_command_test.rb +0 -19
- data/test/rss_command_test.rb +0 -39
- data/test/summary_command_test.rb +0 -19
- data/test/test_helper.rb +0 -3
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'markdo/models/task'
|
3
|
+
|
4
|
+
module Markdo
|
5
|
+
describe Task do
|
6
|
+
describe '#==' do
|
7
|
+
it 'is equal if the line is equal' do
|
8
|
+
assert_equality(Task.new('- [ ] Foo'),
|
9
|
+
Task.new('- [ ] Foo'))
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'is inequal if the line is equal' do
|
13
|
+
assert_inequality(Task.new('- [ ] Foo'),
|
14
|
+
Task.new('- [ ] Bar'))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#complete?' do
|
19
|
+
describe 'given an incomplete task' do
|
20
|
+
it 'is false' do
|
21
|
+
expect(Task.new('- [ ] Incomplete task').complete?).to eq(false)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'given a complete task' do
|
26
|
+
it 'is true' do
|
27
|
+
expect(Task.new('- [x] Complete task').complete?).to eq(true)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#body' do
|
33
|
+
it 'strips the markdown checkbox' do
|
34
|
+
expect(Task.new('- [ ] Incomplete task').body).to eq('Incomplete task')
|
35
|
+
expect(Task.new('- [x] Complete task').body).to eq('Complete task')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'strips whitespace' do
|
39
|
+
expect(Task.new(" \t - [ ] Incomplete task\n").body).to eq('Incomplete task')
|
40
|
+
expect(Task.new(" \t - [x] Complete task\n").body).to eq('Complete task')
|
41
|
+
expect(Task.new("- [x] Complete task \t \n").body).to eq('Complete task')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'given no tags' do
|
46
|
+
describe '#tags' do
|
47
|
+
it 'is empty' do
|
48
|
+
expect(Task.new('- [ ] A task').tags).to eq([])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#attributes' do
|
53
|
+
it 'is empty' do
|
54
|
+
expect(Task.new('- [ ] A task').attributes).to eq({})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'given tags' do
|
60
|
+
describe '#tags' do
|
61
|
+
it 'is an array of lowercase tags in the order they appear, without arguments' do
|
62
|
+
task = Task.new('- [ ] A task @downtown @star @due(2016-01-01) @ALLCAPS')
|
63
|
+
expect(task.tags).to eq(%w(downtown star due allcaps))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#attributes' do
|
68
|
+
it 'is a hash of attributes including arguments' do
|
69
|
+
task = Task.new('- [ ] A task @downtown @star @due(2016-01-01)')
|
70
|
+
expect(task.attributes).to eq({
|
71
|
+
'downtown' => TaskAttribute.new('downtown', nil),
|
72
|
+
'star' => TaskAttribute.new('star', nil),
|
73
|
+
'due' => TaskAttribute.new('due', '2016-01-01'),
|
74
|
+
})
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
unless RUBY_ENGINE == 'opal'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'stringio'
|
7
|
+
|
8
|
+
def build_command_support(env = {})
|
9
|
+
stdin = StringIO.new
|
10
|
+
stdout = StringIO.new
|
11
|
+
stderr = StringIO.new
|
12
|
+
Markdo::CommandSupport.new(stdin: stdin, stdout: stdout, stderr: stderr, env: env)
|
13
|
+
end
|
14
|
+
|
15
|
+
def build_command_support_for_date_commands
|
16
|
+
stdin = StringIO.new
|
17
|
+
stdout = StringIO.new
|
18
|
+
stderr = StringIO.new
|
19
|
+
env = {
|
20
|
+
'MARKDO_ROOT' => 'spec/fixtures/date_commands',
|
21
|
+
'MARKDO_INBOX' => 'Inbox.md'
|
22
|
+
}
|
23
|
+
today = Date.new(2016, 2, 28)
|
24
|
+
|
25
|
+
Markdo::CommandSupport.new(stdin: stdin, stdout: stdout, stderr: stderr, env: env, today: today)
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_equality(left, right)
|
29
|
+
expect(left).to eq(left)
|
30
|
+
|
31
|
+
expect(left).to eq(right)
|
32
|
+
expect(right).to eq(left)
|
33
|
+
|
34
|
+
expect(right).to eq(right)
|
35
|
+
end
|
36
|
+
|
37
|
+
def assert_inequality(left, right)
|
38
|
+
expect(left).not_to eq(right)
|
39
|
+
expect(right).not_to eq(left)
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Oakes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,90 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: opal
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: opal-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
55
139
|
description: Markdown-based task manager
|
56
140
|
email:
|
57
141
|
- hello@benjaminoakes.com
|
@@ -61,47 +145,82 @@ extensions: []
|
|
61
145
|
extra_rdoc_files: []
|
62
146
|
files:
|
63
147
|
- ".gitignore"
|
64
|
-
- ".ruby-version"
|
65
148
|
- ".travis.yml"
|
66
149
|
- Dockerfile
|
67
150
|
- Gemfile
|
151
|
+
- Guardfile
|
68
152
|
- LICENSE.txt
|
69
153
|
- README.md
|
70
154
|
- Rakefile
|
71
155
|
- bin/markdo
|
156
|
+
- docker-compose.yml
|
72
157
|
- lib/markdo.rb
|
73
|
-
- lib/markdo/add_command.rb
|
74
158
|
- lib/markdo/cli.rb
|
75
|
-
- lib/markdo/
|
76
|
-
- lib/markdo/
|
77
|
-
- lib/markdo/
|
159
|
+
- lib/markdo/command_support.rb
|
160
|
+
- lib/markdo/commands.rb
|
161
|
+
- lib/markdo/commands/add_command.rb
|
162
|
+
- lib/markdo/commands/command.rb
|
163
|
+
- lib/markdo/commands/edit_command.rb
|
164
|
+
- lib/markdo/commands/forecast_command.rb
|
165
|
+
- lib/markdo/commands/help_command.rb
|
166
|
+
- lib/markdo/commands/ics_command.rb
|
167
|
+
- lib/markdo/commands/inbox_command.rb
|
168
|
+
- lib/markdo/commands/overdue_command.rb
|
169
|
+
- lib/markdo/commands/overview_command.rb
|
170
|
+
- lib/markdo/commands/process_command.rb
|
171
|
+
- lib/markdo/commands/query_command.rb
|
172
|
+
- lib/markdo/commands/star_command.rb
|
173
|
+
- lib/markdo/commands/summary_command.rb
|
174
|
+
- lib/markdo/commands/tag_command.rb
|
175
|
+
- lib/markdo/commands/today_command.rb
|
176
|
+
- lib/markdo/commands/tomorrow_command.rb
|
177
|
+
- lib/markdo/commands/version_command.rb
|
178
|
+
- lib/markdo/commands/week_command.rb
|
179
|
+
- lib/markdo/data_source.rb
|
78
180
|
- lib/markdo/fake_version.rb
|
79
|
-
- lib/markdo/
|
80
|
-
- lib/markdo/
|
81
|
-
- lib/markdo/
|
82
|
-
- lib/markdo/
|
83
|
-
- lib/markdo/overdue_command.rb
|
84
|
-
- lib/markdo/overview_command.rb
|
85
|
-
- lib/markdo/process_command.rb
|
86
|
-
- lib/markdo/query_command.rb
|
87
|
-
- lib/markdo/rss_command.rb
|
88
|
-
- lib/markdo/star_command.rb
|
89
|
-
- lib/markdo/summary_command.rb
|
90
|
-
- lib/markdo/tag_command.rb
|
91
|
-
- lib/markdo/today_command.rb
|
92
|
-
- lib/markdo/tomorrow_command.rb
|
181
|
+
- lib/markdo/ics_exporter.rb
|
182
|
+
- lib/markdo/models/task.rb
|
183
|
+
- lib/markdo/models/task_attribute.rb
|
184
|
+
- lib/markdo/models/task_collection.rb
|
93
185
|
- lib/markdo/version.rb
|
94
|
-
- lib/markdo/version_command.rb
|
95
|
-
- lib/markdo/week_command.rb
|
96
186
|
- markdo.gemspec
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
187
|
+
- script/build
|
188
|
+
- spec/fixtures/add_command/Inbox.md
|
189
|
+
- spec/fixtures/date_commands/Inbox.md
|
190
|
+
- spec/fixtures/date_commands/Sprint.md
|
191
|
+
- spec/fixtures/ics_command/Inbox.md
|
192
|
+
- spec/fixtures/ics_command/Sprint.md
|
193
|
+
- spec/fixtures/inbox_command/Inbox.md
|
194
|
+
- spec/fixtures/inbox_command/Sprint.md
|
195
|
+
- spec/fixtures/process_command/Backlog.md
|
196
|
+
- spec/fixtures/process_command/Inbox.md
|
197
|
+
- spec/fixtures/process_command/Maybe.md
|
198
|
+
- spec/fixtures/process_command/Sprint.md
|
199
|
+
- spec/fixtures/query_command/Inbox.md
|
200
|
+
- spec/fixtures/query_command/Sprint.md
|
201
|
+
- spec/fixtures/tag_command/Inbox.md
|
202
|
+
- spec/fixtures/tag_command/Sprint.md
|
203
|
+
- spec/lib/cli_spec.rb
|
204
|
+
- spec/lib/commands/add_command_spec.rb
|
205
|
+
- spec/lib/commands/edit_command_spec.rb
|
206
|
+
- spec/lib/commands/forecast_command_spec.rb
|
207
|
+
- spec/lib/commands/ics_command_spec.rb
|
208
|
+
- spec/lib/commands/inbox_command_spec.rb
|
209
|
+
- spec/lib/commands/overdue_command_spec.rb
|
210
|
+
- spec/lib/commands/overview_command_spec.rb
|
211
|
+
- spec/lib/commands/process_command_spec.rb
|
212
|
+
- spec/lib/commands/query_command_spec.rb
|
213
|
+
- spec/lib/commands/star_command_spec.rb
|
214
|
+
- spec/lib/commands/summary_command_spec.rb
|
215
|
+
- spec/lib/commands/tag_command_spec.rb
|
216
|
+
- spec/lib/commands/today_command_spec.rb
|
217
|
+
- spec/lib/commands/tomorrow_command_spec.rb
|
218
|
+
- spec/lib/commands/week_command_spec.rb
|
219
|
+
- spec/lib/ics_exporter_spec.rb
|
220
|
+
- spec/lib/models/task_attribute_spec.rb
|
221
|
+
- spec/lib/models/task_collection_spec.rb
|
222
|
+
- spec/lib/models/task_spec.rb
|
223
|
+
- spec/spec_helper.rb
|
105
224
|
homepage: http://github.com/benjaminoakes/markdo
|
106
225
|
licenses:
|
107
226
|
- MIT
|
@@ -117,21 +236,49 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
236
|
version: '0'
|
118
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
238
|
requirements:
|
120
|
-
- - "
|
239
|
+
- - ">="
|
121
240
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
241
|
+
version: '0'
|
123
242
|
requirements: []
|
124
243
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.4.
|
244
|
+
rubygems_version: 2.4.8
|
126
245
|
signing_key:
|
127
246
|
specification_version: 4
|
128
247
|
summary: Markdown-based task manager
|
129
248
|
test_files:
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
249
|
+
- spec/fixtures/add_command/Inbox.md
|
250
|
+
- spec/fixtures/date_commands/Inbox.md
|
251
|
+
- spec/fixtures/date_commands/Sprint.md
|
252
|
+
- spec/fixtures/ics_command/Inbox.md
|
253
|
+
- spec/fixtures/ics_command/Sprint.md
|
254
|
+
- spec/fixtures/inbox_command/Inbox.md
|
255
|
+
- spec/fixtures/inbox_command/Sprint.md
|
256
|
+
- spec/fixtures/process_command/Backlog.md
|
257
|
+
- spec/fixtures/process_command/Inbox.md
|
258
|
+
- spec/fixtures/process_command/Maybe.md
|
259
|
+
- spec/fixtures/process_command/Sprint.md
|
260
|
+
- spec/fixtures/query_command/Inbox.md
|
261
|
+
- spec/fixtures/query_command/Sprint.md
|
262
|
+
- spec/fixtures/tag_command/Inbox.md
|
263
|
+
- spec/fixtures/tag_command/Sprint.md
|
264
|
+
- spec/lib/cli_spec.rb
|
265
|
+
- spec/lib/commands/add_command_spec.rb
|
266
|
+
- spec/lib/commands/edit_command_spec.rb
|
267
|
+
- spec/lib/commands/forecast_command_spec.rb
|
268
|
+
- spec/lib/commands/ics_command_spec.rb
|
269
|
+
- spec/lib/commands/inbox_command_spec.rb
|
270
|
+
- spec/lib/commands/overdue_command_spec.rb
|
271
|
+
- spec/lib/commands/overview_command_spec.rb
|
272
|
+
- spec/lib/commands/process_command_spec.rb
|
273
|
+
- spec/lib/commands/query_command_spec.rb
|
274
|
+
- spec/lib/commands/star_command_spec.rb
|
275
|
+
- spec/lib/commands/summary_command_spec.rb
|
276
|
+
- spec/lib/commands/tag_command_spec.rb
|
277
|
+
- spec/lib/commands/today_command_spec.rb
|
278
|
+
- spec/lib/commands/tomorrow_command_spec.rb
|
279
|
+
- spec/lib/commands/week_command_spec.rb
|
280
|
+
- spec/lib/ics_exporter_spec.rb
|
281
|
+
- spec/lib/models/task_attribute_spec.rb
|
282
|
+
- spec/lib/models/task_collection_spec.rb
|
283
|
+
- spec/lib/models/task_spec.rb
|
284
|
+
- spec/spec_helper.rb
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.3.1
|
data/lib/markdo/command.rb
DELETED
data/lib/markdo/date_command.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'date'
|
2
|
-
require 'stringio'
|
3
|
-
require 'markdo/query_command'
|
4
|
-
require 'markdo/week_command'
|
5
|
-
|
6
|
-
module Markdo
|
7
|
-
# TODO: More testing of this logic. As of 2016-01-23, I was building this
|
8
|
-
# project as a proof of concept.
|
9
|
-
class ForecastCommand < WeekCommand
|
10
|
-
def initialize(*)
|
11
|
-
@date = Date.today
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
def run
|
16
|
-
# This is pretty ugly, but works. Just testing out how useful the concept is.
|
17
|
-
dates = dates_over_the_next_week
|
18
|
-
dates.shift
|
19
|
-
dates.shift
|
20
|
-
|
21
|
-
dates.each do |query|
|
22
|
-
stringio = StringIO.new
|
23
|
-
query_command = QueryCommand.new(stringio, @stderr, @env)
|
24
|
-
query_command.run(query)
|
25
|
-
|
26
|
-
abbreviation = weekday_abbreviation(query)
|
27
|
-
count = stringio.string.split("\n").length
|
28
|
-
|
29
|
-
@stdout.puts("#{abbreviation}: #{count}")
|
30
|
-
end
|
31
|
-
|
32
|
-
stringio = StringIO.new
|
33
|
-
next_week_command = WeekCommand.new(stringio, @stderr, @env)
|
34
|
-
next_week_command.date = @date + 7
|
35
|
-
next_week_command.run
|
36
|
-
next_week_count = stringio.string.split("\n").length
|
37
|
-
@stdout.puts("Next: #{next_week_count}")
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def abbreviations_by_wday(wday)
|
43
|
-
abbrevs = {
|
44
|
-
0 => 'Su',
|
45
|
-
1 => 'Mo',
|
46
|
-
2 => 'Tu',
|
47
|
-
3 => 'We',
|
48
|
-
4 => 'Th',
|
49
|
-
5 => 'Fr',
|
50
|
-
6 => 'Sa',
|
51
|
-
}
|
52
|
-
|
53
|
-
abbrevs[wday]
|
54
|
-
end
|
55
|
-
|
56
|
-
def weekday_abbreviation(iso8601_date)
|
57
|
-
wday = Date.strptime(iso8601_date, '%Y-%m-%d').wday
|
58
|
-
abbreviations_by_wday(wday)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|