todoloo 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: 9391333b3186bf9acd092a3d2477768f4f47ae4ef929667e71ae7b3011567a37
4
- data.tar.gz: 3b85f78433162892ceade94dfebdddff29d9662be2ad6f923ec33b4e24731a6d
3
+ metadata.gz: 30e603e6f88a2ac0a52654b71d81714936db242648786c9bd1b0ac602cff03e6
4
+ data.tar.gz: 609ee891b2a8d01817c63725a4a4b4197c63e86cabeb5f44b32a8b4a470c224a
5
5
  SHA512:
6
- metadata.gz: c79bf5aee911bf8d3a262e0489f72c28bf67b52ad249a702dee70cde08c59eafb8c477c0d9d42e38e26fc824cd5e6f8a953eb85a92ec91235f5a4f203936f897
7
- data.tar.gz: e3fcbd9542607dcbb603224232f94d0e90c4a7639d6c45f23e8fb3242afaf1a693d3cee3f4299c85640d2d9211d0e6d9f0e13ee6c47b31691449d948902b2e33
6
+ metadata.gz: e6f09e526d68283bc2ce77bdf9a2439f4d4a03bcb6b9dc199cdcd41356625fd7968eba57e6f2dade51a61aee5b280041e0e9ec82a2db99a093ce279006135ffd
7
+ data.tar.gz: 7e37cf807c222e8320e0af0eebaab9bd390beb2bb523c6174237a5f40d6a699e8d905e239a0c2b6e0ba917468885fd685d718526bb485fffa29d96cba867f5b5
data/CHANGELOG CHANGED
@@ -1,5 +1,13 @@
1
1
  Unreleased
2
2
 
3
+ 0.0.4 - 13 August 2024
4
+ - Add more extensive CLI tests to catch some corner cases
5
+ - Fix `--exclude` flag not being repeatable
6
+ - Add `--pattern` flag for repeatable file matching pattern specification
7
+ - Add `--verbose` switch to opt-in for printing out scanned files
8
+ - Add `--output [FILENAME]` flag for specifying where to write the todos/tasks
9
+ - Fix remove file repeatitions when using `--pattern` that matches repeatedly
10
+
3
11
  0.0.3 - 8 August 2024
4
12
  - Add sorting support to `TaskList` and now sort CLI output by default
5
13
  - Fix parsing for multiple tags, as in `TODO(a,b,c)`
data/Rakefile CHANGED
@@ -6,3 +6,7 @@ require "minitest/test_task"
6
6
  Minitest::TestTask.create
7
7
 
8
8
  task default: :test
9
+
10
+ task "test:watch" do
11
+ system("rerun bundle exec rake")
12
+ end
data/lib/todoloo/cli.rb CHANGED
@@ -3,14 +3,28 @@ require "thor"
3
3
  class Todoloo::CLI < Thor
4
4
  package_name "Todoloo"
5
5
 
6
+ DEFAULT_PATTERN = [
7
+ "**/*.rb",
8
+ "*.rb"
9
+ ].freeze
10
+
6
11
  desc "scan", "Scans all files that match the given globs and outputs a tasks.yml"
7
- method_option :exclude, type: :array, aliases: "-e", desc: "List of path globs to exclude"
12
+ method_option :pattern, type: :string, repeatable: true, aliases: "-p", desc: "Path globs to match; can be repeated"
13
+ method_option :exclude, type: :string, repeatable: true, aliases: "-e", desc: "List of path globs to exclude"
14
+ method_option :output, type: :string, aliases: "-o", default: "tasks.yml", desc: "Name of the output file"
15
+ method_option :verbose, type: :boolean, default: false
8
16
  def scan
17
+ patterns = options.fetch(:pattern, DEFAULT_PATTERN)
18
+
9
19
  Todoloo::FileScanner
10
- .new("**/*.rb", excludes: options[:exclude] || [], trace: true)
20
+ .new(
21
+ patterns,
22
+ excludes: options.fetch(:exclude, []),
23
+ trace: options.fetch(:verbose)
24
+ )
11
25
  .scan
12
26
  .sort
13
- .write("tasks.yml")
27
+ .write(options.fetch(:output))
14
28
  end
15
29
 
16
30
  desc "io", "Reads input from stdio and writes to stdout"
@@ -6,7 +6,9 @@ module Todoloo
6
6
  # TODO We need to optimize how we traverse the file-system so that we can short-circuit the excludes instead
7
7
  # of only filtering after finding them.
8
8
  #
9
- # @pattern [String]
9
+ # TODO Optimize the seen_path handling
10
+ #
11
+ # @pattern [String, Array<String>]
10
12
  # The file paths to glob
11
13
  #
12
14
  # @excludes [Array<String>]
@@ -14,9 +16,15 @@ module Todoloo
14
16
  #
15
17
  # @return [Enumerator<String>]
16
18
  def glob_paths(pattern, excludes: [])
19
+ seen_paths = Set.new
20
+
17
21
  Enumerator.new do |y|
18
- Dir[pattern].lazy.each do |path|
19
- y << path unless excludes.any? { |e| File.fnmatch(e, path) }
22
+ Dir[*Array(pattern)].lazy.each do |path|
23
+ if !(seen_paths.include?(path) || excludes.any? { |e| File.fnmatch(e, path) })
24
+ y << path
25
+ end
26
+
27
+ seen_paths << path
20
28
  end
21
29
  end
22
30
  end
@@ -41,6 +41,7 @@ module Todoloo
41
41
  @tasks.sort_by! do |t|
42
42
  [t.topics, task_severity(t), t.path, t.line, t.column]
43
43
  end
44
+
44
45
  self
45
46
  end
46
47
 
@@ -19,7 +19,7 @@ module Todoloo
19
19
  {type: type, topics: topics, description: description.empty? ? "" : (raise "must be empty")}
20
20
  end
21
21
 
22
- rule(topic: simple(:x)) { x }
22
+ rule(topic: simple(:x)) { x.to_s }
23
23
 
24
24
  rule(task: subtree(:task)) { task }
25
25
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Todoloo
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todoloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Coetzee
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2024-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -102,7 +102,6 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - ".direnv"
106
105
  - CHANGELOG
107
106
  - CODE_OF_CONDUCT.md
108
107
  - LICENSE.txt
data/.direnv DELETED
@@ -1 +0,0 @@
1
- PATH_add bin