markdo 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/markdo/cli.rb +3 -0
- data/lib/markdo/help_command.rb +1 -0
- data/lib/markdo/summary_command.rb +6 -3
- data/lib/markdo/version.rb +1 -1
- data/lib/markdo/week_command.rb +34 -0
- data/test/summary_command_test.rb +0 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f01c7fa9361facf00e0de5d7e02a0e9a03d5ef8
|
4
|
+
data.tar.gz: acc0d01bd6062f486ecc57bf1d5de7660832e124
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c341a17f7c126a143549302d1fd3b1b86e1956887ae29f4619ecd5b951a27e2e79daa21913e28ce7b18dc6d787488e5c1bc5eff44064afab8677fa2c84bdbd9
|
7
|
+
data.tar.gz: a4800eb2eaf0a83b54dde36e1dca63279dfa568ab658109f0f48c22081fcb36378728a9d2378709763d07799c00795986f96df72302ac59a4c26abd69f21f40a
|
data/README.md
CHANGED
@@ -56,6 +56,7 @@ See `markdo help` for more information.
|
|
56
56
|
tomorrow Search *.md files for tomorrow's date. (YYYY-MM-DD format.)
|
57
57
|
rss Make an RSS feed of all links in Markdo. Useful as a live bookmark.
|
58
58
|
star, starred Search *.md files for @star.
|
59
|
+
summary Display counts.
|
59
60
|
query, q "string" Search *.md files for string.
|
60
61
|
version, --version Display the version.
|
61
62
|
|
data/lib/markdo/cli.rb
CHANGED
@@ -10,6 +10,7 @@ require 'markdo/summary_command'
|
|
10
10
|
require 'markdo/tag_command'
|
11
11
|
require 'markdo/today_command'
|
12
12
|
require 'markdo/tomorrow_command'
|
13
|
+
require 'markdo/week_command'
|
13
14
|
require 'markdo/version_command'
|
14
15
|
|
15
16
|
module Markdo
|
@@ -48,6 +49,8 @@ module Markdo
|
|
48
49
|
TomorrowCommand
|
49
50
|
when 'version', '--version'
|
50
51
|
VersionCommand
|
52
|
+
when 'week'
|
53
|
+
WeekCommand
|
51
54
|
else
|
52
55
|
HelpCommand
|
53
56
|
end
|
data/lib/markdo/help_command.rb
CHANGED
@@ -20,6 +20,7 @@ Markdown-based task manager.
|
|
20
20
|
star, starred Search *.md files for @star.
|
21
21
|
summary Display counts.
|
22
22
|
query, q "string" Search *.md files for string.
|
23
|
+
week Search *.md files for dates in the next week. (YYYY-MM-DD format.)
|
23
24
|
version, --version Display the version.
|
24
25
|
EOF
|
25
26
|
|
@@ -5,11 +5,12 @@ require 'markdo/overdue_command'
|
|
5
5
|
require 'markdo/star_command'
|
6
6
|
require 'markdo/today_command'
|
7
7
|
require 'markdo/tomorrow_command'
|
8
|
+
require 'markdo/week_command'
|
8
9
|
|
9
10
|
module Markdo
|
10
11
|
class SummaryCommand < Command
|
11
12
|
def run
|
12
|
-
commands = [OverdueCommand, StarCommand, TodayCommand, TomorrowCommand]
|
13
|
+
commands = [OverdueCommand, StarCommand, TodayCommand, TomorrowCommand, WeekCommand]
|
13
14
|
|
14
15
|
commands.each do |command|
|
15
16
|
out = StringIO.new
|
@@ -17,9 +18,11 @@ module Markdo
|
|
17
18
|
|
18
19
|
title = command.to_s.sub(/^Markdo::/, '').sub(/Command$/, '')
|
19
20
|
lines = out.string.split("\n")
|
20
|
-
sum = lines.length
|
21
|
+
sum = lines.length
|
21
22
|
|
22
|
-
|
23
|
+
unless sum.zero?
|
24
|
+
@stdout.puts("#{title}: #{sum}")
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
data/lib/markdo/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'markdo/query_command'
|
3
|
+
|
4
|
+
module Markdo
|
5
|
+
# TODO: More testing of this logic. As of 2016-01-23, I was building this
|
6
|
+
# project as a proof of concept.
|
7
|
+
class WeekCommand < Command
|
8
|
+
def initialize(*)
|
9
|
+
@date = Date.today
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
query_command = QueryCommand.new(@stdout, @stderr, @env)
|
15
|
+
|
16
|
+
dates_over_the_next_week.each do |query|
|
17
|
+
query_command.run(query)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def dates_over_the_next_week
|
24
|
+
(0..7).to_a.map { |offset|
|
25
|
+
adjusted_date = @date + offset
|
26
|
+
"#{adjusted_date.year}-#{justify(adjusted_date.month)}-#{justify(adjusted_date.day)}"
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def justify(less_than_100)
|
31
|
+
less_than_100.to_s.rjust(2, '0')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
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.
|
4
|
+
version: 0.1.8
|
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-05-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/markdo/tomorrow_command.rb
|
89
89
|
- lib/markdo/version.rb
|
90
90
|
- lib/markdo/version_command.rb
|
91
|
+
- lib/markdo/week_command.rb
|
91
92
|
- markdo.gemspec
|
92
93
|
- test/fixtures/ics_command.md
|
93
94
|
- test/fixtures/rss_command.md
|