task-list 0.4 → 0.5

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: f810f7a8f3caac1fa3fd505a1145fb7d3c26d359
4
- data.tar.gz: ca797339f20080c53f3411778fdc8b595c5e7335
3
+ metadata.gz: 0ecdf05a74c6c2d7c09a9689daf5f7615da4e1ce
4
+ data.tar.gz: 4a03aff8f84e34b1c7b536a6d3994754cb6fa059
5
5
  SHA512:
6
- metadata.gz: 60c4656630e430c3b811bc038f85463424dc1f4a32ba80d23694f170172086b4980abc59e21f8a0863d82fb7a00e3b80a627812efee95ce7994be169514b215c
7
- data.tar.gz: f15a7e1ef88be707b1e12e9b8746862416b6d7dc51334fd80d145974305c5c1e5dd5f2f548f3949f19e5774e324020a70ee6d2568c886e044d72fedcd61b1dcd
6
+ metadata.gz: 0662d7d1a013b6237019399fa43389646dbe2f811845cab6dc7ad15940c6d5634dc2e062db54dedf518937e152563828d0a8ae8dd0fae8f53de8ec34a52684f1
7
+ data.tar.gz: c9f6f942baf8098cff9ab25279287b7326f11b1ca08ec34ca972194377db9412da3391be0c2dcea2747d340200165d6a9af37e8bc8717b51c11f14714c5fe641
data/bin/tl CHANGED
@@ -12,6 +12,10 @@ OptionParser.new do |opts|
12
12
  options[:plain] = true
13
13
  end
14
14
 
15
+ opts.on("-d", "--directory DIRECTORY", "Specify the directory to search (default to cwd)") do |o|
16
+ options[:search_path] = o
17
+ end
18
+
15
19
  opts.on("-t", "--type", "Type of tasks to list") do |o|
16
20
  options[:type] = o
17
21
  end
@@ -2,9 +2,10 @@ require "find"
2
2
 
3
3
  module TaskList
4
4
  class Parser
5
- attr_reader :files, :tasks
5
+ attr_reader :files, :tasks, :search_path
6
6
 
7
7
  def initialize(arguments: [], options: {})
8
+ self.search_path = options[:search_path]
8
9
  @plain = options[:plain] if options[:plain]
9
10
  @type = options[:type].upcase if options[:type]
10
11
  @files = fuzzy_find_files queries: arguments
@@ -12,6 +13,14 @@ module TaskList
12
13
  VALID_TASKS.each { |t| @tasks[t.to_sym] = [] }
13
14
  end
14
15
 
16
+ def search_path=(value)
17
+ if value.nil? || value.empty?
18
+ @search_path = "."
19
+ else
20
+ @search_path = value
21
+ end
22
+ end
23
+
15
24
  # Parse all the collected files to find tasks
16
25
  # and populate the tasks hash
17
26
  def parse!
@@ -52,8 +61,7 @@ module TaskList
52
61
  patterns = regexify queries
53
62
 
54
63
  paths = []
55
- # FIXME: Search in the root of a project if in a git repo
56
- Find.find('.') do |path|
64
+ Find.find(self.search_path) do |path|
57
65
  paths << path unless FileTest.directory?(path)
58
66
  end
59
67
 
@@ -1,3 +1,3 @@
1
1
  module TaskList
2
- VERSION = "0.4"
2
+ VERSION = "0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: task-list
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aziz Light
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-21 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: TaskList parses source code to find code tags and list them in a terminal.
14
14
  See README.md for more info.