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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +15 -9
  4. data/Dockerfile +21 -7
  5. data/Guardfile +11 -0
  6. data/README.md +12 -7
  7. data/Rakefile +11 -7
  8. data/bin/markdo +1 -1
  9. data/docker-compose.yml +9 -0
  10. data/lib/markdo/cli.rb +23 -55
  11. data/lib/markdo/command_support.rb +14 -0
  12. data/lib/markdo/commands.rb +16 -0
  13. data/lib/markdo/{add_command.rb → commands/add_command.rb} +2 -6
  14. data/lib/markdo/commands/command.rb +33 -0
  15. data/lib/markdo/{edit_command.rb → commands/edit_command.rb} +2 -2
  16. data/lib/markdo/commands/forecast_command.rb +41 -0
  17. data/lib/markdo/{help_command.rb → commands/help_command.rb} +7 -8
  18. data/lib/markdo/commands/ics_command.rb +15 -0
  19. data/lib/markdo/commands/inbox_command.rb +11 -0
  20. data/lib/markdo/commands/overdue_command.rb +11 -0
  21. data/lib/markdo/commands/overview_command.rb +16 -0
  22. data/lib/markdo/commands/process_command.rb +91 -0
  23. data/lib/markdo/commands/query_command.rb +14 -0
  24. data/lib/markdo/commands/star_command.rb +11 -0
  25. data/lib/markdo/commands/summary_command.rb +25 -0
  26. data/lib/markdo/commands/tag_command.rb +11 -0
  27. data/lib/markdo/commands/today_command.rb +12 -0
  28. data/lib/markdo/commands/tomorrow_command.rb +12 -0
  29. data/lib/markdo/{version_command.rb → commands/version_command.rb} +1 -1
  30. data/lib/markdo/commands/week_command.rb +16 -0
  31. data/lib/markdo/data_source.rb +27 -0
  32. data/lib/markdo/ics_exporter.rb +65 -0
  33. data/lib/markdo/models/task.rb +46 -0
  34. data/lib/markdo/models/task_attribute.rb +22 -0
  35. data/lib/markdo/models/task_collection.rb +75 -0
  36. data/lib/markdo/version.rb +1 -1
  37. data/markdo.gemspec +6 -0
  38. data/script/build +9 -0
  39. data/spec/fixtures/add_command/Inbox.md +0 -0
  40. data/spec/fixtures/date_commands/Inbox.md +6 -0
  41. data/spec/fixtures/date_commands/Sprint.md +6 -0
  42. data/spec/fixtures/ics_command/Inbox.md +0 -0
  43. data/{test/fixtures/ics_command.md → spec/fixtures/ics_command/Sprint.md} +0 -0
  44. data/spec/fixtures/inbox_command/Inbox.md +2 -0
  45. data/spec/fixtures/inbox_command/Sprint.md +2 -0
  46. data/spec/fixtures/process_command/Backlog.md +0 -0
  47. data/spec/fixtures/process_command/Inbox.md +0 -0
  48. data/spec/fixtures/process_command/Maybe.md +0 -0
  49. data/spec/fixtures/process_command/Sprint.md +0 -0
  50. data/spec/fixtures/query_command/Inbox.md +4 -0
  51. data/spec/fixtures/query_command/Sprint.md +4 -0
  52. data/spec/fixtures/tag_command/Inbox.md +2 -0
  53. data/spec/fixtures/tag_command/Sprint.md +2 -0
  54. data/spec/lib/cli_spec.rb +79 -0
  55. data/spec/lib/commands/add_command_spec.rb +70 -0
  56. data/spec/lib/commands/edit_command_spec.rb +32 -0
  57. data/spec/lib/commands/forecast_command_spec.rb +24 -0
  58. data/spec/lib/commands/ics_command_spec.rb +30 -0
  59. data/spec/lib/commands/inbox_command_spec.rb +22 -0
  60. data/spec/lib/commands/overdue_command_spec.rb +19 -0
  61. data/spec/lib/commands/overview_command_spec.rb +25 -0
  62. data/spec/lib/commands/process_command_spec.rb +178 -0
  63. data/spec/lib/commands/query_command_spec.rb +23 -0
  64. data/spec/lib/commands/star_command_spec.rb +19 -0
  65. data/spec/lib/commands/summary_command_spec.rb +23 -0
  66. data/spec/lib/commands/tag_command_spec.rb +21 -0
  67. data/spec/lib/commands/today_command_spec.rb +19 -0
  68. data/spec/lib/commands/tomorrow_command_spec.rb +19 -0
  69. data/spec/lib/commands/week_command_spec.rb +23 -0
  70. data/spec/lib/ics_exporter_spec.rb +59 -0
  71. data/spec/lib/models/task_attribute_spec.rb +85 -0
  72. data/spec/lib/models/task_collection_spec.rb +168 -0
  73. data/spec/lib/models/task_spec.rb +79 -0
  74. data/spec/spec_helper.rb +40 -0
  75. metadata +189 -42
  76. data/.ruby-version +0 -1
  77. data/lib/markdo/command.rb +0 -12
  78. data/lib/markdo/date_command.rb +0 -9
  79. data/lib/markdo/forecast_command.rb +0 -61
  80. data/lib/markdo/ics_command.rb +0 -73
  81. data/lib/markdo/inbox_command.rb +0 -15
  82. data/lib/markdo/overdue_command.rb +0 -47
  83. data/lib/markdo/overview_command.rb +0 -17
  84. data/lib/markdo/process_command.rb +0 -68
  85. data/lib/markdo/query_command.rb +0 -24
  86. data/lib/markdo/rss_command.rb +0 -67
  87. data/lib/markdo/star_command.rb +0 -9
  88. data/lib/markdo/summary_command.rb +0 -30
  89. data/lib/markdo/tag_command.rb +0 -9
  90. data/lib/markdo/today_command.rb +0 -10
  91. data/lib/markdo/tomorrow_command.rb +0 -10
  92. data/lib/markdo/week_command.rb +0 -36
  93. data/test/fixtures/inbox.md +0 -2
  94. data/test/fixtures/rss_command.md +0 -4
  95. data/test/ics_command_test.rb +0 -38
  96. data/test/inbox_command_test.rb +0 -19
  97. data/test/rss_command_test.rb +0 -39
  98. data/test/summary_command_test.rb +0 -19
  99. 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
@@ -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.1.12.alpha
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-08-14 00:00:00.000000000 Z
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/command.rb
76
- - lib/markdo/date_command.rb
77
- - lib/markdo/edit_command.rb
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/forecast_command.rb
80
- - lib/markdo/help_command.rb
81
- - lib/markdo/ics_command.rb
82
- - lib/markdo/inbox_command.rb
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
- - test/fixtures/ics_command.md
98
- - test/fixtures/inbox.md
99
- - test/fixtures/rss_command.md
100
- - test/ics_command_test.rb
101
- - test/inbox_command_test.rb
102
- - test/rss_command_test.rb
103
- - test/summary_command_test.rb
104
- - test/test_helper.rb
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: 1.3.1
241
+ version: '0'
123
242
  requirements: []
124
243
  rubyforge_project:
125
- rubygems_version: 2.4.6
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
- - test/fixtures/ics_command.md
131
- - test/fixtures/inbox.md
132
- - test/fixtures/rss_command.md
133
- - test/ics_command_test.rb
134
- - test/inbox_command_test.rb
135
- - test/rss_command_test.rb
136
- - test/summary_command_test.rb
137
- - test/test_helper.rb
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
@@ -1 +0,0 @@
1
- 2.3.1
@@ -1,12 +0,0 @@
1
- module Markdo
2
- class Command
3
- def initialize(stdout, stderr, env)
4
- @stdout = stdout
5
- @stderr = stderr
6
- @env = env
7
- end
8
-
9
- def run
10
- end
11
- end
12
- end
@@ -1,9 +0,0 @@
1
- require 'markdo/query_command'
2
-
3
- module Markdo
4
- class DateCommand < QueryCommand
5
- def run(date)
6
- super(date.iso8601)
7
- end
8
- end
9
- end
@@ -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