todo_marker 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1611c99217fb8bdc944629afe27af2b603314ff4164e1c71738a50928d2ef58e
4
+ data.tar.gz: 377b5b8dcaeae8400dc51ae5a66b62ed7a41f8770c7f4fcd8f7942db452a96c3
5
+ SHA512:
6
+ metadata.gz: 31a68e4191f0bd55054ef1626e2e724562b7dfabee66c1c9a04605287f6850aa6cb282f697325bdc6c1d116638f5f933670a29317ec4cee8e4546ae3b3da876c
7
+ data.tar.gz: 10abd7e84f082bf4d134f871b45726995eb07632af18620cc553586fdd7010c96c9401781befe9a7de890c52b7dd891ead9bce262f91ec0af21d22c2ebf92d6e
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'todo_marker'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ require 'irb'
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/todo_marker ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # bin/todo_marker
4
+ # !/usr/bin/env ruby
5
+
6
+ require 'todo_marker'
7
+
8
+ if ARGV.empty?
9
+ puts 'Usage: todo_marker <directory>'
10
+ exit 1
11
+ end
12
+
13
+ directory = ARGV[0]
14
+ unless Dir.exist?(directory)
15
+ puts "Directory #{directory} does not exist"
16
+ exit 1
17
+ end
18
+
19
+ TodoMarker.generate_todo_md(directory)
20
+ puts "TODO.md has been generated in the #{directory} directory."
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/todo_marker/version.rb
4
+ module TodoMarker
5
+ VERSION = '0.1.0'
6
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/todo_marker.rb
4
+ require 'todo_marker/version'
5
+ require 'find'
6
+
7
+ module TodoMarker
8
+ TODO_REGEX = /# !!TODO!! "(.*?)"/
9
+
10
+ def self.generate_todo_md(directory)
11
+ todos = []
12
+
13
+ Find.find(directory) do |path|
14
+ next unless path.end_with?('.rb')
15
+
16
+ File.readlines(path).each_with_index do |line, index|
17
+ next unless line.match(TODO_REGEX)
18
+
19
+ todos << {
20
+ message: line.match(TODO_REGEX)[1],
21
+ file: path,
22
+ line: index + 1
23
+ }
24
+ end
25
+ end
26
+
27
+ create_todo_file(directory, todos)
28
+ end
29
+
30
+ def self.create_todo_file(directory, todos)
31
+ File.open(File.join(directory, 'TODO.md'), 'w') do |file|
32
+ file.puts "# TODO List\n\n"
33
+ todos.each do |todo|
34
+ file.puts "- #{todo[:message]} (#{todo[:file]}:#{todo[:line]})"
35
+ end
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: todo_marker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - VetheonGames
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: |-
14
+ This standalone gem takes in source code files written in Ruby, and generates a TODO.md file from
15
+ them.
16
+ mark things to add to the TODO.md with the `# !!TODO!!` magic comment
17
+ email:
18
+ - connor@pixelridgesoftworks.com
19
+ executables:
20
+ - todo_marker
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - bin/console
25
+ - bin/setup
26
+ - bin/todo_marker
27
+ - lib/todo_marker.rb
28
+ - lib/todo_marker/version.rb
29
+ homepage: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker
30
+ licenses:
31
+ - MIT
32
+ metadata:
33
+ homepage_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker
34
+ source_code_uri: https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Todo_Marker
35
+ rubygems_mfa_required: 'true'
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '3.2'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.5.7
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Standalone gem for generating TODO.md files
55
+ test_files: []