diff --git a/.gitignore b/.gitignore index e49ee52..be196d5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ .rspec_status .byebug_history -todo_tracker-*.gem +todo_agent-*.gem diff --git a/Gemfile b/Gemfile index 52fce30..eaa897d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -# Specify your gem's dependencies in todo_tracker.gemspec +# Specify your gem's dependencies in todo_agent.gemspec gemspec gem "byebug" diff --git a/Gemfile.lock b/Gemfile.lock index ab38786..0cdc209 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - todo_tracker (0.1.0) + todo_agent (0.1.0) GEM remote: https://rubygems.org/ @@ -51,7 +51,7 @@ DEPENDENCIES rake (~> 12.0) rspec (~> 3.0) rubocop - todo_tracker! + todo_agent! BUNDLED WITH 2.1.4 diff --git a/README.md b/README.md index 5f85729..b24f4e1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TodoTracker +# TodoAgent Searches the code for TODOs and creates issues in the configured tracker @@ -13,7 +13,7 @@ Might be interesting to extract some of the features from story_branch gem to a Add this line to your application's Gemfile: ```ruby -gem 'todo_tracker' +gem 'todo_agent' ``` And then execute: @@ -22,7 +22,7 @@ And then execute: Or install it yourself as: - $ gem install todo_tracker + $ gem install todo_agent ## Usage @@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/rpbaltazar/todo_tracker. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rpbaltazar/todo_tracker/blob/master/CODE_OF_CONDUCT.md). +Bug reports and pull requests are welcome on GitHub at https://github.com/rpbaltazar/todo_agent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rpbaltazar/todo_agent/blob/master/CODE_OF_CONDUCT.md). ## License @@ -45,4 +45,4 @@ The gem is available as open source under the terms of the [MIT License](https:/ ## Code of Conduct -Everyone interacting in the TodoTracker project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rpbaltazar/todo_tracker/blob/master/CODE_OF_CONDUCT.md). +Everyone interacting in the TodoAgent project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rpbaltazar/todo_agent/blob/master/CODE_OF_CONDUCT.md). diff --git a/bin/console b/bin/console index 11f2a4a..ef5187c 100755 --- a/bin/console +++ b/bin/console @@ -3,7 +3,7 @@ # frozen_string_literal: true require "bundler/setup" -require "todo_tracker" +require "todo_agent" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/exe/todo_tracker b/exe/todo_agent similarity index 75% rename from exe/todo_tracker rename to exe/todo_agent index 938da13..303b19b 100755 --- a/exe/todo_tracker +++ b/exe/todo_agent @@ -3,7 +3,7 @@ lib_path = File.expand_path('../lib', __dir__) $:.unshift(lib_path) if !$:.include?(lib_path) -require 'todo_tracker/cli' +require 'todo_agent/cli' Signal.trap('INT') do warn("\n#{caller.join("\n")}: interrupted") @@ -11,8 +11,8 @@ Signal.trap('INT') do end begin - TodoTracker::CLI.start -rescue TodoTracker::CLI::Error => err + TodoAgent::CLI.start +rescue TodoAgent::CLI::Error => err puts "ERROR: #{err.message}" exit 1 end diff --git a/lib/todo_agent.rb b/lib/todo_agent.rb new file mode 100644 index 0000000..f178b26 --- /dev/null +++ b/lib/todo_agent.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require_relative "todo_agent/version" +require_relative "todo_agent/file_identifier" +require_relative "todo_agent/parsers/ruby" + +module TodoAgent + class Error < StandardError; end + # Your code goes here... +end diff --git a/lib/todo_tracker/cli.rb b/lib/todo_agent/cli.rb similarity index 84% rename from lib/todo_tracker/cli.rb rename to lib/todo_agent/cli.rb index eea02a0..47300cf 100644 --- a/lib/todo_tracker/cli.rb +++ b/lib/todo_agent/cli.rb @@ -2,7 +2,7 @@ require "thor" -module TodoTracker +module TodoAgent # Handle the application command line parsing # and the dispatch to various command objects # @@ -11,10 +11,10 @@ class CLI < Thor # Error raised by this runner Error = Class.new(StandardError) - desc "version", "todo_tracker version" + desc "version", "todo_agent version" def version require_relative "version" - puts "v#{TodoTracker::VERSION}" + puts "v#{TodoAgent::VERSION}" end map %w[--version -v] => :version @@ -28,7 +28,7 @@ def analyze(path = ".") invoke :help, ["analyze"] else require_relative "commands/analyze" - TodoTracker::Commands::Analyze.new(path, options).execute + TodoAgent::Commands::Analyze.new(path, options).execute end end end diff --git a/lib/todo_tracker/command.rb b/lib/todo_agent/command.rb similarity index 99% rename from lib/todo_tracker/command.rb rename to lib/todo_agent/command.rb index a2d34d7..7cd41f1 100644 --- a/lib/todo_tracker/command.rb +++ b/lib/todo_agent/command.rb @@ -2,7 +2,7 @@ require 'forwardable' -module TodoTracker +module TodoAgent class Command extend Forwardable diff --git a/lib/todo_tracker/commands/.gitkeep b/lib/todo_agent/commands/.gitkeep similarity index 100% rename from lib/todo_tracker/commands/.gitkeep rename to lib/todo_agent/commands/.gitkeep diff --git a/lib/todo_tracker/commands/analyze.rb b/lib/todo_agent/commands/analyze.rb similarity index 80% rename from lib/todo_tracker/commands/analyze.rb rename to lib/todo_agent/commands/analyze.rb index b01cc56..486a6e1 100644 --- a/lib/todo_tracker/commands/analyze.rb +++ b/lib/todo_agent/commands/analyze.rb @@ -6,9 +6,9 @@ # TODO: load remaining parsers require_relative "../parsers/ruby" -module TodoTracker +module TodoAgent module Commands - class Analyze < TodoTracker::Command + class Analyze < TodoAgent::Command def initialize(path, options) @path = path @options = options @@ -17,10 +17,10 @@ def initialize(path, options) def execute(_input: $stdin, _output: $stdout) comments = [] Rake::FileList["#{@path}/**/*"].exclude(paths_to_ignore).each do |filepath| - parser = TodoTracker::FileIdentifier.based_on_file_extension(filepath) + parser = TodoAgent::FileIdentifier.based_on_file_extension(filepath) next unless parser - parser_class = Object.const_get("TodoTracker::Parsers::#{parser}") + parser_class = Object.const_get("TodoAgent::Parsers::#{parser}") result = parser_class.parse(filepath) comments += result end @@ -50,7 +50,7 @@ def output(comments) end def output_file - @options["output_file"] || "todo_tracker.log" + @options["output_file"] || "todo_agent.log" end end end diff --git a/lib/todo_tracker/comment.rb b/lib/todo_agent/comment.rb similarity index 94% rename from lib/todo_tracker/comment.rb rename to lib/todo_agent/comment.rb index 7092839..5e07608 100644 --- a/lib/todo_tracker/comment.rb +++ b/lib/todo_agent/comment.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module TodoTracker +module TodoAgent class Comment attr_reader :line, :filename diff --git a/lib/todo_tracker/file_identifier.rb b/lib/todo_agent/file_identifier.rb similarity index 92% rename from lib/todo_tracker/file_identifier.rb rename to lib/todo_agent/file_identifier.rb index 4783453..6ddb470 100644 --- a/lib/todo_tracker/file_identifier.rb +++ b/lib/todo_agent/file_identifier.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module TodoTracker +module TodoAgent class FileIdentifier def self.based_on_file_extension(filename) supported_files = { diff --git a/lib/todo_tracker/parsers/default_tags.rb b/lib/todo_agent/parsers/default_tags.rb similarity index 92% rename from lib/todo_tracker/parsers/default_tags.rb rename to lib/todo_agent/parsers/default_tags.rb index 198638d..826a013 100644 --- a/lib/todo_tracker/parsers/default_tags.rb +++ b/lib/todo_agent/parsers/default_tags.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module TodoTracker +module TodoAgent module Parsers class DefaultTags # TODO: read from config or fallback to defaults diff --git a/lib/todo_tracker/parsers/regex_builder.rb b/lib/todo_agent/parsers/regex_builder.rb similarity index 98% rename from lib/todo_tracker/parsers/regex_builder.rb rename to lib/todo_agent/parsers/regex_builder.rb index 5a6ff31..b20e4f1 100644 --- a/lib/todo_tracker/parsers/regex_builder.rb +++ b/lib/todo_agent/parsers/regex_builder.rb @@ -2,7 +2,7 @@ require_relative "default_tags" -module TodoTracker +module TodoAgent module Parsers class RegexBuilder DEFAULT_TAGS = [DefaultTags.todo, DefaultTags.fixme].freeze diff --git a/lib/todo_tracker/parsers/ruby.rb b/lib/todo_agent/parsers/ruby.rb similarity index 74% rename from lib/todo_tracker/parsers/ruby.rb rename to lib/todo_agent/parsers/ruby.rb index f05ec7c..b1a00e3 100644 --- a/lib/todo_tracker/parsers/ruby.rb +++ b/lib/todo_agent/parsers/ruby.rb @@ -4,11 +4,11 @@ require_relative "regex_builder" require_relative "../comment" -module TodoTracker +module TodoAgent module Parsers class Ruby def self.parse(file) - regex_str = TodoTracker::Parsers::RegexBuilder.regex + regex_str = TodoAgent::Parsers::RegexBuilder.regex regexp = Regexp.new("^\\s*##{regex_str}$", "mig") comments = [] @@ -16,7 +16,7 @@ def self.parse(file) # This only matches single line. IO.foreach(file) do |line| match = regexp.match(line) - comments << TodoTracker::Comment.new(match, file, $INPUT_LINE_NUMBER) if match + comments << TodoAgent::Comment.new(match, file, $INPUT_LINE_NUMBER) if match end comments diff --git a/lib/todo_tracker/templates/.gitkeep b/lib/todo_agent/templates/.gitkeep similarity index 100% rename from lib/todo_tracker/templates/.gitkeep rename to lib/todo_agent/templates/.gitkeep diff --git a/lib/todo_tracker/templates/analyze/.gitkeep b/lib/todo_agent/templates/analyze/.gitkeep similarity index 100% rename from lib/todo_tracker/templates/analyze/.gitkeep rename to lib/todo_agent/templates/analyze/.gitkeep diff --git a/lib/todo_tracker/version.rb b/lib/todo_agent/version.rb similarity index 74% rename from lib/todo_tracker/version.rb rename to lib/todo_agent/version.rb index 17023ef..4a79d9a 100644 --- a/lib/todo_tracker/version.rb +++ b/lib/todo_agent/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module TodoTracker +module TodoAgent VERSION = "0.1.0" end diff --git a/lib/todo_tracker.rb b/lib/todo_tracker.rb deleted file mode 100644 index 98a72f6..0000000 --- a/lib/todo_tracker.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require_relative "todo_tracker/version" -require_relative "todo_tracker/file_identifier" -require_relative "todo_tracker/parsers/ruby" - -module TodoTracker - class Error < StandardError; end - # Your code goes here... -end diff --git a/spec/integration/analyze_spec.rb b/spec/integration/analyze_spec.rb index 84174af..bd17142 100644 --- a/spec/integration/analyze_spec.rb +++ b/spec/integration/analyze_spec.rb @@ -1,9 +1,9 @@ -RSpec.describe "`todo_tracker run` command", type: :cli do - it "executes `todo_tracker help run` command successfully" do - output = `todo_tracker help run` +RSpec.describe "`todo_agent run` command", type: :cli do + it "executes `todo_agent help run` command successfully" do + output = `todo_agent help run` expected_output = <<-OUT Usage: - todo_tracker run [PATH] + todo_agent run [PATH] Options: -h, [--help], [--no-help] # Display usage information diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f976906..a4d0bcb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "bundler/setup" -require "todo_tracker" +require "todo_agent" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure diff --git a/spec/todo_tracker_spec.rb b/spec/todo_agent_spec.rb similarity index 64% rename from spec/todo_tracker_spec.rb rename to spec/todo_agent_spec.rb index 6f72052..1f960ca 100644 --- a/spec/todo_tracker_spec.rb +++ b/spec/todo_agent_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -RSpec.describe TodoTracker do +RSpec.describe TodoAgent do it "has a version number" do - expect(TodoTracker::VERSION).not_to be nil + expect(TodoAgent::VERSION).not_to be nil end it "does something useful" do diff --git a/spec/unit/analyze_spec.rb b/spec/unit/analyze_spec.rb index 61d3d1f..42b790c 100644 --- a/spec/unit/analyze_spec.rb +++ b/spec/unit/analyze_spec.rb @@ -1,11 +1,11 @@ -require 'todo_tracker/commands/run' +require 'todo_agent/commands/run' -RSpec.describe TodoTracker::Commands::Run do +RSpec.describe TodoAgent::Commands::Run do it "executes `run` command successfully" do output = StringIO.new path = nil options = {} - command = TodoTracker::Commands::Run.new(path, options) + command = TodoAgent::Commands::Run.new(path, options) command.execute(output: output) diff --git a/todo_tracker.gemspec b/todo_agent.gemspec similarity index 90% rename from todo_tracker.gemspec rename to todo_agent.gemspec index 5db464e..e4f868f 100644 --- a/todo_tracker.gemspec +++ b/todo_agent.gemspec @@ -1,10 +1,10 @@ # frozen_string_literal: true -require_relative "lib/todo_tracker/version" +require_relative "lib/todo_agent/version" Gem::Specification.new do |spec| - spec.name = "todo_tracker" - spec.version = TodoTracker::VERSION + spec.name = "todo_agent" + spec.version = TodoAgent::VERSION spec.authors = ["Rui Baltazar"] spec.email = ["rui.p.baltazar@gmail.com"]