markdo 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b3775cdadd82ba88f3ca92750b7a081e4362ac9
4
- data.tar.gz: 5f6068f43fa78660fdd2455729fcd62b0ecba744
3
+ metadata.gz: 7f01c7fa9361facf00e0de5d7e02a0e9a03d5ef8
4
+ data.tar.gz: acc0d01bd6062f486ecc57bf1d5de7660832e124
5
5
  SHA512:
6
- metadata.gz: 5998abd2cd3388336d635e73ddedcac2eed39510a5e2197ffcae9ca1b889b8ddbed87376fc647c8c2a8c3abb13cd2c050f35295acc815be937b356593826d600
7
- data.tar.gz: f757c1887e68055df0b25894f54b79d1c2518a8cd004157f33921c0081a85c1335db5532ad00520fcf1b6a6becebcc2479b918f259de7edf0c63a6e12eaa09c9
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
 
@@ -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
@@ -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.inspect
21
+ sum = lines.length
21
22
 
22
- @stdout.puts("#{title}: #{sum}")
23
+ unless sum.zero?
24
+ @stdout.puts("#{title}: #{sum}")
25
+ end
23
26
  end
24
27
  end
25
28
  end
@@ -1,3 +1,3 @@
1
1
  module Markdo
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -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
@@ -12,9 +12,6 @@ module Markdo
12
12
 
13
13
  out.string.must_equal <<-XML
14
14
  Overdue: 2
15
- Star: 0
16
- Today: 0
17
- Tomorrow: 0
18
15
  XML
19
16
  end
20
17
  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.7
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-09 00:00:00.000000000 Z
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