todo_marker 0.1.0 → 0.2.2
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 +4 -4
- data/bin/todo_marker +23 -0
- data/lib/todo_marker/version.rb +1 -1
- data/lib/todo_marker.rb +25 -3
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bca81325f56048674c08b2159e78ffa15c8e2115f221d02c67fb6e267be6d496
|
4
|
+
data.tar.gz: d8d65957d51ff2b8c99ebd54cd86c5c159226b90a7abe04c435c623cf94adeb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deeb78bec21739a40a24ed2cd21535de2927cb0e75324550219e9fed64a5565910fefb8b3aa95ffca6eed64928026d7c824172eaa7352688ba91bebab58c8300
|
7
|
+
data.tar.gz: ff9d4c5e0aca9893bbdff5e51218e249f8a0eb3c9cb898235cd1c042af7cd516568b4adf95147f2b67bcf5cdc86419395bfeee2d925ebdbd45a858df451187db
|
data/bin/todo_marker
CHANGED
@@ -4,6 +4,10 @@
|
|
4
4
|
# !/usr/bin/env ruby
|
5
5
|
|
6
6
|
require 'todo_marker'
|
7
|
+
require 'date'
|
8
|
+
|
9
|
+
DONATION_LINK = 'https://www.paypal.com/donate/?hosted_button_id=YF5XS7ZXQ6F8A'
|
10
|
+
TIMESTAMP_FILE = File.join(Dir.home, '.todo_marker_last_donation_prompt')
|
7
11
|
|
8
12
|
if ARGV.empty?
|
9
13
|
puts 'Usage: todo_marker <directory>'
|
@@ -18,3 +22,22 @@ end
|
|
18
22
|
|
19
23
|
TodoMarker.generate_todo_md(directory)
|
20
24
|
puts "TODO.md has been generated in the #{directory} directory."
|
25
|
+
|
26
|
+
def should_show_donation_message?
|
27
|
+
return true unless File.exist?(TIMESTAMP_FILE)
|
28
|
+
|
29
|
+
last_prompt = Date.parse(File.read(TIMESTAMP_FILE).strip)
|
30
|
+
(Date.today - last_prompt).to_i >= 7 # Show message once a week
|
31
|
+
rescue ArgumentError
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
def update_timestamp
|
36
|
+
File.write(TIMESTAMP_FILE, Date.today.to_s)
|
37
|
+
end
|
38
|
+
|
39
|
+
if should_show_donation_message?
|
40
|
+
puts "\nEnjoying TodoMarker? Consider donating to support development:"
|
41
|
+
puts DONATION_LINK
|
42
|
+
update_timestamp
|
43
|
+
end
|
data/lib/todo_marker/version.rb
CHANGED
data/lib/todo_marker.rb
CHANGED
@@ -5,7 +5,13 @@ require 'todo_marker/version'
|
|
5
5
|
require 'find'
|
6
6
|
|
7
7
|
module TodoMarker
|
8
|
-
TODO_REGEX = /# !!TODO!! "(.*?)"/
|
8
|
+
TODO_REGEX = /# !!TODO!!(?: style: (\w+))? "(.*?)"/
|
9
|
+
STYLES = {
|
10
|
+
'title1' => '# %s',
|
11
|
+
'title2' => '## %s',
|
12
|
+
'title3' => '### %s',
|
13
|
+
'sublist' => ' - %s'
|
14
|
+
}.freeze
|
9
15
|
|
10
16
|
def self.generate_todo_md(directory)
|
11
17
|
todos = []
|
@@ -16,8 +22,10 @@ module TodoMarker
|
|
16
22
|
File.readlines(path).each_with_index do |line, index|
|
17
23
|
next unless line.match(TODO_REGEX)
|
18
24
|
|
25
|
+
style, message = line.match(TODO_REGEX).captures
|
19
26
|
todos << {
|
20
|
-
|
27
|
+
style:,
|
28
|
+
message:,
|
21
29
|
file: path,
|
22
30
|
line: index + 1
|
23
31
|
}
|
@@ -31,8 +39,22 @@ module TodoMarker
|
|
31
39
|
File.open(File.join(directory, 'TODO.md'), 'w') do |file|
|
32
40
|
file.puts "# TODO List\n\n"
|
33
41
|
todos.each do |todo|
|
34
|
-
|
42
|
+
formatted_message = format_message(todo[:style], todo[:message])
|
43
|
+
file.puts formatted_message
|
44
|
+
file.puts " (#{todo[:file]}:#{todo[:line]})" if todo[:style].nil?
|
35
45
|
end
|
36
46
|
end
|
37
47
|
end
|
48
|
+
|
49
|
+
def self.format_message(style, message)
|
50
|
+
if style
|
51
|
+
if style == 'sublist'
|
52
|
+
" - #{message}"
|
53
|
+
else
|
54
|
+
STYLES[style] % message
|
55
|
+
end
|
56
|
+
else
|
57
|
+
"- #{message}"
|
58
|
+
end
|
59
|
+
end
|
38
60
|
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: todo_marker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VetheonGames
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
This standalone gem takes in source code files written in Ruby, and generates a TODO.md file from
|
15
|
-
them.
|
16
|
-
|
15
|
+
them. Mark things to add to the TODO.md with the # !!TODO!! magic comment. Ensure to checkout the
|
16
|
+
documentation to learn styles!
|
17
17
|
email:
|
18
18
|
- connor@pixelridgesoftworks.com
|
19
19
|
executables:
|
@@ -26,12 +26,15 @@ files:
|
|
26
26
|
- bin/todo_marker
|
27
27
|
- lib/todo_marker.rb
|
28
28
|
- lib/todo_marker/version.rb
|
29
|
-
homepage: https://git.pixelridgesoftworks.com/PixelRidge-Softworks
|
29
|
+
homepage: https://git.pixelridgesoftworks.com/PixelRidge-Softworks
|
30
30
|
licenses:
|
31
|
-
-
|
31
|
+
- GNU V3.0
|
32
32
|
metadata:
|
33
|
-
homepage_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks
|
33
|
+
homepage_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks
|
34
34
|
source_code_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker
|
35
|
+
documentation_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker/src/branch/main/README.md
|
36
|
+
changelog_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker/src/branch/main/changelog.md
|
37
|
+
funding_uri: https://www.paypal.com/donate/?hosted_button_id=YF5XS7ZXQ6F8A
|
35
38
|
rubygems_mfa_required: 'true'
|
36
39
|
post_install_message:
|
37
40
|
rdoc_options: []
|
@@ -48,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
51
|
- !ruby/object:Gem::Version
|
49
52
|
version: '0'
|
50
53
|
requirements: []
|
51
|
-
rubygems_version: 3.5.
|
54
|
+
rubygems_version: 3.5.14
|
52
55
|
signing_key:
|
53
56
|
specification_version: 4
|
54
57
|
summary: Standalone gem for generating TODO.md files
|