makit 0.0.99 → 0.0.111
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/README.md +41 -0
- data/exe/makit +5 -0
- data/lib/makit/apache.rb +7 -11
- data/lib/makit/cli/build_commands.rb +500 -0
- data/lib/makit/cli/generators/base_generator.rb +74 -0
- data/lib/makit/cli/generators/dotnet_generator.rb +50 -0
- data/lib/makit/cli/generators/generator_factory.rb +49 -0
- data/lib/makit/cli/generators/node_generator.rb +50 -0
- data/lib/makit/cli/generators/ruby_generator.rb +77 -0
- data/lib/makit/cli/generators/rust_generator.rb +50 -0
- data/lib/makit/cli/generators/templates/dotnet_templates.rb +167 -0
- data/lib/makit/cli/generators/templates/node_templates.rb +161 -0
- data/lib/makit/cli/generators/templates/ruby/gemfile.rb +26 -0
- data/lib/makit/cli/generators/templates/ruby/gemspec.rb +40 -0
- data/lib/makit/cli/generators/templates/ruby/main_lib.rb +33 -0
- data/lib/makit/cli/generators/templates/ruby/rakefile.rb +35 -0
- data/lib/makit/cli/generators/templates/ruby/readme.rb +63 -0
- data/lib/makit/cli/generators/templates/ruby/test.rb +39 -0
- data/lib/makit/cli/generators/templates/ruby/test_helper.rb +29 -0
- data/lib/makit/cli/generators/templates/ruby/version.rb +29 -0
- data/lib/makit/cli/generators/templates/rust_templates.rb +128 -0
- data/lib/makit/cli/main.rb +48 -19
- data/lib/makit/cli/project_commands.rb +868 -0
- data/lib/makit/cli/repository_commands.rb +661 -0
- data/lib/makit/cli/utility_commands.rb +521 -0
- data/lib/makit/command_runner.rb +187 -128
- data/lib/makit/commands/compatibility.rb +365 -0
- data/lib/makit/commands/factory.rb +359 -0
- data/lib/makit/commands/middleware/base.rb +73 -0
- data/lib/makit/commands/middleware/cache.rb +248 -0
- data/lib/makit/commands/middleware/command_logger.rb +323 -0
- data/lib/makit/commands/middleware/unified_logger.rb +243 -0
- data/lib/makit/commands/middleware/validator.rb +269 -0
- data/lib/makit/commands/request.rb +254 -0
- data/lib/makit/commands/result.rb +323 -0
- data/lib/makit/commands/runner.rb +317 -0
- data/lib/makit/commands/strategies/base.rb +160 -0
- data/lib/makit/commands/strategies/synchronous.rb +134 -0
- data/lib/makit/commands.rb +24 -3
- data/lib/makit/configuration/gitlab_helper.rb +60 -0
- data/lib/makit/configuration/project.rb +127 -0
- data/lib/makit/configuration/rakefile_helper.rb +43 -0
- data/lib/makit/configuration/step.rb +34 -0
- data/lib/makit/configuration.rb +14 -0
- data/lib/makit/content/default_gitignore.rb +4 -2
- data/lib/makit/content/default_rakefile.rb +4 -2
- data/lib/makit/content/gem_rakefile.rb +4 -2
- data/lib/makit/context.rb +1 -0
- data/lib/makit/data.rb +9 -10
- data/lib/makit/directories.rb +48 -52
- data/lib/makit/directory.rb +38 -52
- data/lib/makit/docs/files.rb +5 -10
- data/lib/makit/docs/rake.rb +16 -20
- data/lib/makit/dotnet/cli.rb +65 -0
- data/lib/makit/dotnet/project.rb +153 -0
- data/lib/makit/dotnet/solution.rb +38 -0
- data/lib/makit/dotnet/solution_classlib.rb +239 -0
- data/lib/makit/dotnet/solution_console.rb +264 -0
- data/lib/makit/dotnet/solution_maui.rb +354 -0
- data/lib/makit/dotnet/solution_wasm.rb +275 -0
- data/lib/makit/dotnet/solution_wpf.rb +304 -0
- data/lib/makit/dotnet.rb +54 -171
- data/lib/makit/email.rb +46 -17
- data/lib/makit/environment.rb +22 -19
- data/lib/makit/examples/runner.rb +370 -0
- data/lib/makit/exceptions.rb +45 -0
- data/lib/makit/fileinfo.rb +3 -5
- data/lib/makit/files.rb +12 -16
- data/lib/makit/gems.rb +40 -39
- data/lib/makit/git/cli.rb +54 -0
- data/lib/makit/git/repository.rb +90 -0
- data/lib/makit/git.rb +44 -91
- data/lib/makit/gitlab_runner.rb +0 -1
- data/lib/makit/humanize.rb +31 -23
- data/lib/makit/indexer.rb +15 -24
- data/lib/makit/logging/configuration.rb +305 -0
- data/lib/makit/logging/format_registry.rb +84 -0
- data/lib/makit/logging/formatters/base.rb +39 -0
- data/lib/makit/logging/formatters/console_formatter.rb +127 -0
- data/lib/makit/logging/formatters/json_formatter.rb +65 -0
- data/lib/makit/logging/formatters/plain_text_formatter.rb +71 -0
- data/lib/makit/logging/formatters/text_formatter.rb +64 -0
- data/lib/makit/logging/log_request.rb +115 -0
- data/lib/makit/logging/logger.rb +159 -0
- data/lib/makit/logging/sinks/base.rb +91 -0
- data/lib/makit/logging/sinks/console.rb +72 -0
- data/lib/makit/logging/sinks/file_sink.rb +92 -0
- data/lib/makit/logging/sinks/structured.rb +129 -0
- data/lib/makit/logging/sinks/unified_file_sink.rb +303 -0
- data/lib/makit/logging.rb +452 -37
- data/lib/makit/markdown.rb +18 -18
- data/lib/makit/mp/basic_object_mp.rb +5 -4
- data/lib/makit/mp/command_mp.rb +5 -5
- data/lib/makit/mp/command_request.mp.rb +3 -2
- data/lib/makit/mp/project_mp.rb +85 -96
- data/lib/makit/mp/string_mp.rb +245 -73
- data/lib/makit/nuget.rb +27 -25
- data/lib/makit/port.rb +25 -27
- data/lib/makit/process.rb +127 -29
- data/lib/makit/protoc.rb +27 -24
- data/lib/makit/rake/cli.rb +196 -0
- data/lib/makit/rake.rb +6 -6
- data/lib/makit/ruby/cli.rb +185 -0
- data/lib/makit/ruby.rb +25 -0
- data/lib/makit/secrets.rb +18 -18
- data/lib/makit/serializer.rb +29 -27
- data/lib/makit/services/builder.rb +186 -0
- data/lib/makit/services/error_handler.rb +226 -0
- data/lib/makit/services/repository_manager.rb +229 -0
- data/lib/makit/services/validator.rb +112 -0
- data/lib/makit/setup/classlib.rb +53 -0
- data/lib/makit/setup/gem.rb +250 -0
- data/lib/makit/setup/runner.rb +40 -0
- data/lib/makit/show.rb +16 -16
- data/lib/makit/storage.rb +32 -37
- data/lib/makit/symbols.rb +12 -0
- data/lib/makit/task_hooks.rb +125 -0
- data/lib/makit/task_info.rb +63 -21
- data/lib/makit/tasks/at_exit.rb +13 -0
- data/lib/makit/tasks/build.rb +18 -0
- data/lib/makit/tasks/clean.rb +11 -0
- data/lib/makit/tasks/hook_manager.rb +239 -0
- data/lib/makit/tasks/init.rb +47 -0
- data/lib/makit/tasks/integrate.rb +15 -0
- data/lib/makit/tasks/pull_incoming.rb +12 -0
- data/lib/makit/tasks/setup.rb +6 -0
- data/lib/makit/tasks/sync.rb +11 -0
- data/lib/makit/tasks/task_monkey_patch.rb +79 -0
- data/lib/makit/tasks.rb +5 -150
- data/lib/makit/test_cache.rb +239 -0
- data/lib/makit/v1/makit.v1_pb.rb +34 -35
- data/lib/makit/v1/makit.v1_services_pb.rb +2 -0
- data/lib/makit/version.rb +1 -57
- data/lib/makit/wix.rb +23 -23
- data/lib/makit/yaml.rb +18 -6
- data/lib/makit.rb +2 -261
- metadata +109 -145
- data/lib/makit/cli/clean.rb +0 -14
- data/lib/makit/cli/clone.rb +0 -59
- data/lib/makit/cli/init.rb +0 -38
- data/lib/makit/cli/make.rb +0 -54
- data/lib/makit/cli/new.rb +0 -37
- data/lib/makit/cli/nuget_cache.rb +0 -38
- data/lib/makit/cli/pull.rb +0 -31
- data/lib/makit/cli/setup.rb +0 -71
- data/lib/makit/cli/work.rb +0 -21
- data/lib/makit/content/default_gitignore.txt +0 -222
    
        data/lib/makit/data.rb
    CHANGED
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 2 3 | 
             
            require "digest"
         | 
| 3 4 | 
             
            # This module provides classes for the Makit gem.
         | 
| 4 5 | 
             
            module Makit
         | 
| @@ -17,12 +18,12 @@ module Makit | |
| 17 18 | 
             
                # remove all data
         | 
| 18 19 | 
             
                def clear
         | 
| 19 20 | 
             
                  # remove the data directory
         | 
| 20 | 
            -
                  FileUtils.rm_rf(@directory) | 
| 21 | 
            +
                  FileUtils.rm_rf(@directory)
         | 
| 21 22 | 
             
                end
         | 
| 22 23 |  | 
| 23 24 | 
             
                def get_content_id(item)
         | 
| 24 25 | 
             
                  # get the content id for the item
         | 
| 25 | 
            -
                  bytes_string = item.to_proto.bytes.pack("C*") | 
| 26 | 
            +
                  bytes_string = item.to_proto.bytes.pack("C*") # Convert the byte array to a string
         | 
| 26 27 | 
             
                  Digest::SHA256.hexdigest(bytes_string)
         | 
| 27 28 | 
             
                end
         | 
| 28 29 |  | 
| @@ -31,20 +32,18 @@ module Makit | |
| 31 32 | 
             
                def save(item)
         | 
| 32 33 | 
             
                  content_id = get_content_id(item)
         | 
| 33 34 | 
             
                  # save the content
         | 
| 34 | 
            -
                   | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
                    end
         | 
| 39 | 
            -
                  end
         | 
| 35 | 
            +
                  return unless @use_json
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  # save the content to a json file
         | 
| 38 | 
            +
                  File.write(File.join(@directory, "#{content_id}.json"), item.to_json)
         | 
| 40 39 | 
             
                end
         | 
| 41 40 |  | 
| 42 | 
            -
                def get_content( | 
| 41 | 
            +
                def get_content(_content_id)
         | 
| 43 42 | 
             
                  nil
         | 
| 44 43 | 
             
                end
         | 
| 45 44 |  | 
| 46 45 | 
             
                def self.gem_db_filename
         | 
| 47 | 
            -
                   | 
| 46 | 
            +
                  File.join(Dir.home, ".makit", "makit.db")
         | 
| 48 47 | 
             
                end
         | 
| 49 48 | 
             
              end
         | 
| 50 49 | 
             
            end
         | 
    
        data/lib/makit/directories.rb
    CHANGED
    
    | @@ -28,48 +28,48 @@ module Makit | |
| 28 28 | 
             
                ONEDRIVE_INSTALLER_SOURCE = File.join(ONEDRIVE, "code", "artifacts", "installer")
         | 
| 29 29 | 
             
                CURRENT = Dir.pwd
         | 
| 30 30 | 
             
                LOCAL_APPLICATION_DATA = File.join(HOME, "AppData", "Local")
         | 
| 31 | 
            -
                #Rake.application.init
         | 
| 32 | 
            -
                #Rake.application.load_rakefile
         | 
| 33 | 
            -
                RAKEDIR = Dir.pwd #File.dirname(Rake.application.rakefile)
         | 
| 31 | 
            +
                # Rake.application.init
         | 
| 32 | 
            +
                # Rake.application.load_rakefile
         | 
| 33 | 
            +
                RAKEDIR = Dir.pwd # File.dirname(Rake.application.rakefile)
         | 
| 34 34 |  | 
| 35 35 | 
             
                PROJECT_ROOT = Makit::Directory.find_directory_with_patterns(RAKEDIR, ["Rakefile", "rakefile.rb", ".gitignore"])
         | 
| 36 | 
            -
                #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "Rakefile")
         | 
| 37 | 
            -
                #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "rakefile.rb")
         | 
| 38 | 
            -
                #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, ".gitignore")
         | 
| 39 | 
            -
                if  | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 36 | 
            +
                # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "Rakefile")
         | 
| 37 | 
            +
                # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "rakefile.rb")
         | 
| 38 | 
            +
                # PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, ".gitignore")
         | 
| 39 | 
            +
                PROJECT_ARTIFACTS = if PROJECT_ROOT.nil?
         | 
| 40 | 
            +
                    nil
         | 
| 41 | 
            +
                  else
         | 
| 42 | 
            +
                    File.join(PROJECT_ROOT, "artifacts")
         | 
| 43 | 
            +
                  end
         | 
| 44 44 | 
             
                LOCAL_NUGET_SOURCE = File.join(Dir.home, ".makit", "nuget")
         | 
| 45 | 
            -
                if Makit::Environment | 
| 46 | 
            -
                  #NUGET_PACKAGE_CACHE = "#{ENV["USERPROFILE"]}\\.nuget\\packages"
         | 
| 45 | 
            +
                if Makit::Environment.get_os == "Windows"
         | 
| 46 | 
            +
                  # NUGET_PACKAGE_CACHE = "#{ENV["USERPROFILE"]}\\.nuget\\packages"
         | 
| 47 47 | 
             
                  NUGET_PACKAGE_CACHE = File.join(HOME, ".nuget", "packages")
         | 
| 48 48 | 
             
                  SERVICES = File.join("C:", "Program Files")
         | 
| 49 49 | 
             
                else
         | 
| 50 | 
            -
                  NUGET_PACKAGE_CACHE = Makit::Directory.normalize("#{ | 
| 51 | 
            -
                  if Makit::Environment | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 50 | 
            +
                  NUGET_PACKAGE_CACHE = Makit::Directory.normalize("#{Dir.home}/.nuget/packages")
         | 
| 51 | 
            +
                  SERVICES = if Makit::Environment.get_os == "macOS"
         | 
| 52 | 
            +
                      "/Library/LaunchDaemons"
         | 
| 53 | 
            +
                    else
         | 
| 54 | 
            +
                      "/etc/systemd/system"
         | 
| 55 | 
            +
                    end
         | 
| 56 56 | 
             
                end
         | 
| 57 | 
            -
                if Makit::NuGet | 
| 57 | 
            +
                if Makit::NuGet.get_latest_version("Grpc.Tools").nil?
         | 
| 58 58 | 
             
                  puts "  warning: Grpc.Tools not found in Nuget cache"
         | 
| 59 59 | 
             
                else
         | 
| 60 | 
            -
                  GRPC_TOOLS_PATH = File.join(NUGET_PACKAGE_CACHE, "grpc.tools", Makit::Protoc | 
| 61 | 
            -
                  GRPC_CSHARP_PLUGIN_PATH = Makit::Protoc | 
| 60 | 
            +
                  GRPC_TOOLS_PATH = File.join(NUGET_PACKAGE_CACHE, "grpc.tools", Makit::Protoc.get_latest_grpc_tools_version)
         | 
| 61 | 
            +
                  GRPC_CSHARP_PLUGIN_PATH = Makit::Protoc.find_plugin_path("grpc_csharp_plugin")
         | 
| 62 62 | 
             
                end
         | 
| 63 63 |  | 
| 64 | 
            -
                 | 
| 65 | 
            -
                 | 
| 66 | 
            -
                 | 
| 67 | 
            -
                 | 
| 68 | 
            -
                 | 
| 69 | 
            -
                 | 
| 70 | 
            -
                 | 
| 71 | 
            -
                 | 
| 72 | 
            -
                 | 
| 64 | 
            +
                FileUtils.mkdir_p(ROOT)
         | 
| 65 | 
            +
                FileUtils.mkdir_p(CLONE)
         | 
| 66 | 
            +
                FileUtils.mkdir_p(MAKE)
         | 
| 67 | 
            +
                FileUtils.mkdir_p(LOG)
         | 
| 68 | 
            +
                FileUtils.mkdir_p(WORK)
         | 
| 69 | 
            +
                FileUtils.mkdir_p(REPOS)
         | 
| 70 | 
            +
                FileUtils.mkdir_p(TEMP)
         | 
| 71 | 
            +
                FileUtils.mkdir_p(INSTALL)
         | 
| 72 | 
            +
                unless Dir.exist?(LOCAL_NUGET_SOURCE)
         | 
| 73 73 | 
             
                  Dir.mkdir(LOCAL_NUGET_SOURCE)
         | 
| 74 74 | 
             
                  system("dotnet nuget add source #{LOCAL_NUGET_SOURCE} --name local")
         | 
| 75 75 | 
             
                end
         | 
| @@ -97,15 +97,15 @@ module Makit | |
| 97 97 | 
             
                def self.get_log_directory(url)
         | 
| 98 98 | 
             
                  File.join(LOG, get_relative_directory(url))
         | 
| 99 99 | 
             
                end
         | 
| 100 | 
            +
             | 
| 100 101 | 
             
                def self.get_make_commit_log_filename(url, commit_id)
         | 
| 101 | 
            -
                  File.join(LOG, get_relative_directory(url), commit_id | 
| 102 | 
            +
                  File.join(LOG, get_relative_directory(url), "#{commit_id}.json")
         | 
| 102 103 | 
             
                end
         | 
| 103 104 |  | 
| 104 105 | 
             
                def self.get_relative_directory(url)
         | 
| 105 106 | 
             
                  # if url start with Directories::REPOS, then it is a local repository
         | 
| 106 | 
            -
                  if url.start_with?(REPOS)
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                  end
         | 
| 107 | 
            +
                  return url.gsub(REPOS, "") if url.start_with?(REPOS)
         | 
| 108 | 
            +
             | 
| 109 109 | 
             
                  url = url.gsub("https://", "").gsub("http://", "")
         | 
| 110 110 | 
             
                  url = url.gsub("gitlab.com", "gitlab")
         | 
| 111 111 | 
             
                  url = url.gsub("github.com", "github")
         | 
| @@ -118,28 +118,24 @@ module Makit | |
| 118 118 | 
             
                # show all the directory constants in a nicely formatted table format with the name of the constant and the value
         | 
| 119 119 | 
             
                def self.show
         | 
| 120 120 | 
             
                  # Array of constant names (symbols)
         | 
| 121 | 
            -
                  constant_names = [ | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
             | 
| 121 | 
            +
                  constant_names = %i[ROOT CLONE MAKE LOG WORK REPOS TEMP INSTALL HOME ONEDRIVE
         | 
| 122 | 
            +
                                      CURRENT RAKEDIR
         | 
| 123 | 
            +
                                      PROJECT_ROOT PROJECT_ARTIFACTS LOCAL_NUGET_SOURCE NUGET_PACKAGE_CACHE SERVICES
         | 
| 124 | 
            +
                                      GRPC_TOOLS_PATH GRPC_CSHARP_PLUGIN_PATH]
         | 
| 125 125 |  | 
| 126 126 | 
             
                  # Find the length of the longest constant name and add 1
         | 
| 127 127 | 
             
                  max_length = constant_names.map(&:to_s).max_by(&:length).length + 1
         | 
| 128 128 |  | 
| 129 129 | 
             
                  # Iterate through each constant name
         | 
| 130 130 | 
             
                  constant_names.each do |constant_name|
         | 
| 131 | 
            -
                     | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
                    rescue NameError
         | 
| 139 | 
            -
                      # Handle the case where the constant is not defined
         | 
| 140 | 
            -
                      puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
         | 
| 141 | 
            -
                    end
         | 
| 131 | 
            +
                    constant_value = const_get(constant_name) # Fetch the value of the constant
         | 
| 132 | 
            +
                    constant_value = constant_value.colorize(:green) if !constant_value.nil? && Dir.exist?(constant_value)
         | 
| 133 | 
            +
                    # Print the constant name right justified to the max_length
         | 
| 134 | 
            +
                    puts "#{constant_name.to_s.rjust(max_length)} = #{constant_value}"
         | 
| 135 | 
            +
                  rescue NameError
         | 
| 136 | 
            +
                    # Handle the case where the constant is not defined
         | 
| 137 | 
            +
                    puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
         | 
| 142 138 | 
             
                  end
         | 
| 143 139 | 
             
                end
         | 
| 144 | 
            -
              end | 
| 145 | 
            -
            end | 
| 140 | 
            +
              end
         | 
| 141 | 
            +
            end
         | 
    
        data/lib/makit/directory.rb
    CHANGED
    
    | @@ -2,7 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require "find"
         | 
| 4 4 | 
             
            require "pathname"
         | 
| 5 | 
            -
            #require "gitignore"
         | 
| 6 5 |  | 
| 7 6 | 
             
            # This module provides classes for the Makit gem.
         | 
| 8 7 | 
             
            module Makit
         | 
| @@ -19,11 +18,11 @@ module Makit | |
| 19 18 | 
             
                                   .sum { |f| File.size(f) }
         | 
| 20 19 |  | 
| 21 20 | 
             
                  human_size(total_bytes)
         | 
| 22 | 
            -
                  puts "  directory  | 
| 21 | 
            +
                  puts "  directory #{dir.to_s.colorize(:green)} size is #{human_size(total_bytes).to_s.colorize(:green)}"
         | 
| 23 22 | 
             
                end
         | 
| 24 23 |  | 
| 25 24 | 
             
                def self.show_largest_files(dir, limit)
         | 
| 26 | 
            -
                  puts "  directory  | 
| 25 | 
            +
                  puts "  directory #{dir.to_s.colorize(:green)} #{limit} largest files"
         | 
| 27 26 | 
             
                  files = Dir.glob(File.join(dir, "**", "*"), File::FNM_DOTMATCH)
         | 
| 28 27 | 
             
                             .select { |f| File.file?(f) }
         | 
| 29 28 |  | 
| @@ -39,24 +38,25 @@ module Makit | |
| 39 38 | 
             
                end
         | 
| 40 39 |  | 
| 41 40 | 
             
                def human_size(bytes)
         | 
| 42 | 
            -
                  units = [ | 
| 43 | 
            -
                  return "0 B" if bytes | 
| 41 | 
            +
                  units = %w[B KB MB GB TB]
         | 
| 42 | 
            +
                  return "0 B" if bytes.zero?
         | 
| 44 43 |  | 
| 45 44 | 
             
                  exp = (Math.log(bytes) / Math.log(1024)).to_i
         | 
| 46 45 | 
             
                  exp = units.size - 1 if exp >= units.size
         | 
| 47 46 |  | 
| 48 | 
            -
                  "%.2f %s"  | 
| 47 | 
            +
                  format("%.2f %s", bytes.to_f / (1024 ** exp), units[exp])
         | 
| 49 48 | 
             
                end
         | 
| 50 49 |  | 
| 51 50 | 
             
                def self.human_size(bytes)
         | 
| 52 | 
            -
                  units = [ | 
| 53 | 
            -
                  return "0 B" if bytes | 
| 51 | 
            +
                  units = %w[B KB MB GB TB]
         | 
| 52 | 
            +
                  return "0 B" if bytes.zero?
         | 
| 54 53 |  | 
| 55 54 | 
             
                  exp = (Math.log(bytes) / Math.log(1024)).to_i
         | 
| 56 55 | 
             
                  exp = units.size - 1 if exp >= units.size
         | 
| 57 56 |  | 
| 58 | 
            -
                  "%.2f %s"  | 
| 57 | 
            +
                  format("%.2f %s", bytes.to_f / (1024 ** exp), units[exp])
         | 
| 59 58 | 
             
                end
         | 
| 59 | 
            +
             | 
| 60 60 | 
             
                def self.get_line_count(file)
         | 
| 61 61 | 
             
                  line_count = 0
         | 
| 62 62 | 
             
                  File.foreach(file) { line_count += 1 }
         | 
| @@ -66,9 +66,7 @@ module Makit | |
| 66 66 | 
             
                def self.find_directory_with_patterns(starting_directory, patterns)
         | 
| 67 67 | 
             
                  patterns.each do |pattern|
         | 
| 68 68 | 
             
                    result = find_directory_with_pattern(starting_directory, pattern)
         | 
| 69 | 
            -
                    if  | 
| 70 | 
            -
                      return result
         | 
| 71 | 
            -
                    end
         | 
| 69 | 
            +
                    return result if Dir.exist?(result)
         | 
| 72 70 | 
             
                  end
         | 
| 73 71 |  | 
| 74 72 | 
             
                  nil
         | 
| @@ -107,40 +105,33 @@ module Makit | |
| 107 105 | 
             
                  total_size
         | 
| 108 106 | 
             
                end
         | 
| 109 107 |  | 
| 110 | 
            -
                def self.get_humanized_size(size_in_bytes, precision = 2)
         | 
| 111 | 
            -
                end
         | 
| 108 | 
            +
                def self.get_humanized_size(size_in_bytes, precision = 2); end
         | 
| 112 109 |  | 
| 113 110 | 
             
                def self.zip_source_files(directory_path, zip_file_name)
         | 
| 114 111 | 
             
                  raise ArgumentError, "Directory path cannot be nil" if directory_path.nil?
         | 
| 115 112 | 
             
                  raise ArgumentError, "Zip file name cannot be nil or empty" if zip_file_name.nil? || zip_file_name.strip.empty?
         | 
| 116 113 |  | 
| 117 | 
            -
                  unless Dir.exist?(directory_path)
         | 
| 118 | 
            -
                    raise ArgumentError, "Directory '#{directory_path}' does not exist."
         | 
| 119 | 
            -
                  end
         | 
| 114 | 
            +
                  raise ArgumentError, "Directory '#{directory_path}' does not exist." unless Dir.exist?(directory_path)
         | 
| 120 115 |  | 
| 121 116 | 
             
                  tracked_files = get_git_tracked_files(directory_path)
         | 
| 122 117 |  | 
| 123 | 
            -
                  if tracked_files.empty?
         | 
| 124 | 
            -
                    raise "No tracked files found in the directory."
         | 
| 125 | 
            -
                  end
         | 
| 118 | 
            +
                  raise "No tracked files found in the directory." if tracked_files.empty?
         | 
| 126 119 |  | 
| 127 120 | 
             
                  Zip::File.open(zip_file_name, Zip::File::CREATE) do |zipfile|
         | 
| 128 121 | 
             
                    tracked_files.each do |file|
         | 
| 129 122 | 
             
                      full_path = File.join(directory_path, file)
         | 
| 130 | 
            -
                      if File.exist?(full_path)
         | 
| 131 | 
            -
                        zipfile.add(file, full_path)
         | 
| 132 | 
            -
                      end
         | 
| 123 | 
            +
                      zipfile.add(file, full_path) if File.exist?(full_path)
         | 
| 133 124 | 
             
                    end
         | 
| 134 125 | 
             
                  end
         | 
| 135 126 | 
             
                end
         | 
| 136 127 |  | 
| 137 128 | 
             
                def self.get_git_tracked_files(directory_path)
         | 
| 138 | 
            -
                  #raise "do not use this method"
         | 
| 139 | 
            -
                  #output, status = Open3.capture2("git ls-files directory", chdir: directory_path)
         | 
| 140 | 
            -
                  #raise "Failed to list git-tracked files" unless status.success?
         | 
| 141 | 
            -
                  #command = "git ls-files #{directory_path}".run
         | 
| 129 | 
            +
                  # raise "do not use this method"
         | 
| 130 | 
            +
                  # output, status = Open3.capture2("git ls-files directory", chdir: directory_path)
         | 
| 131 | 
            +
                  # raise "Failed to list git-tracked files" unless status.success?
         | 
| 132 | 
            +
                  # command = "git ls-files #{directory_path}".run
         | 
| 142 133 |  | 
| 143 | 
            -
                  #command.output.split("\n")
         | 
| 134 | 
            +
                  # command.output.split("\n")
         | 
| 144 135 | 
             
                  `git ls-files #{directory_path}`.split("\n")
         | 
| 145 136 | 
             
                end
         | 
| 146 137 |  | 
| @@ -161,7 +152,7 @@ module Makit | |
| 161 152 | 
             
                # and replacing any backslashes with forward slashes
         | 
| 162 153 | 
             
                def self.normalize(path)
         | 
| 163 154 | 
             
                  path = path.gsub("\\", "/")
         | 
| 164 | 
            -
                  #path = path[1..-1] if path.start_with?("/")
         | 
| 155 | 
            +
                  # path = path[1..-1] if path.start_with?("/")
         | 
| 165 156 | 
             
                  path = path[0..-2] if path.end_with?("/")
         | 
| 166 157 | 
             
                  path
         | 
| 167 158 | 
             
                end
         | 
| @@ -172,14 +163,16 @@ module Makit | |
| 172 163 | 
             
                  version_directories = []
         | 
| 173 164 | 
             
                  Dir.foreach(path) do |entry|
         | 
| 174 165 | 
             
                    next if [".", ".."].include?(entry)
         | 
| 166 | 
            +
             | 
| 175 167 | 
             
                    version_directories << entry if entry.match?(/^\d+\.\d+\.\d+$/)
         | 
| 176 168 | 
             
                  end
         | 
| 177 169 | 
             
                  version_directories
         | 
| 178 170 | 
             
                end
         | 
| 179 171 |  | 
| 180 172 | 
             
                def self.modified(path)
         | 
| 181 | 
            -
                   | 
| 173 | 
            +
                  get_newest_file(path)
         | 
| 182 174 | 
             
                end
         | 
| 175 | 
            +
             | 
| 183 176 | 
             
                # for a given path, get the most recent file change date for any file in the directory
         | 
| 184 177 | 
             
                def self.get_latest_file_change_date(path)
         | 
| 185 178 | 
             
                  # loop over all files in the directory
         | 
| @@ -197,13 +190,13 @@ module Makit | |
| 197 190 | 
             
                def self.get_newest_file(path)
         | 
| 198 191 | 
             
                  newest_file = nil
         | 
| 199 192 | 
             
                  latest_date = nil
         | 
| 200 | 
            -
                  if  | 
| 193 | 
            +
                  if Dir.exist?(path)
         | 
| 201 194 | 
             
                    Find.find(path) do |file|
         | 
| 202 | 
            -
                       | 
| 203 | 
            -
             | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 206 | 
            -
                       | 
| 195 | 
            +
                      next unless File.file?(file)
         | 
| 196 | 
            +
             | 
| 197 | 
            +
                      date = File.mtime(file)
         | 
| 198 | 
            +
                      latest_date = date if latest_date.nil? || date > latest_date
         | 
| 199 | 
            +
                      newest_file = file if date == latest_date
         | 
| 207 200 | 
             
                    end
         | 
| 208 201 | 
             
                  end
         | 
| 209 202 | 
             
                  newest_file
         | 
| @@ -214,12 +207,11 @@ module Makit | |
| 214 207 | 
             
                end
         | 
| 215 208 |  | 
| 216 209 | 
             
                def self.generate_manifest(dir)
         | 
| 217 | 
            -
                   | 
| 218 | 
            -
                    File.delete("#{dir}/manifest.txt")
         | 
| 219 | 
            -
                  end
         | 
| 210 | 
            +
                  FileUtils.rm_f("#{dir}/manifest.txt")
         | 
| 220 211 | 
             
                  File.open("#{dir}/manifest.txt", "w") do |f|
         | 
| 221 212 | 
             
                    Dir.glob("#{dir}/**/*").each do |file|
         | 
| 222 213 | 
             
                      next if File.directory?(file)
         | 
| 214 | 
            +
             | 
| 223 215 | 
             
                      f.puts file.sub("#{dir}/", "")
         | 
| 224 216 | 
             
                    end
         | 
| 225 217 | 
             
                  end
         | 
| @@ -227,32 +219,26 @@ module Makit | |
| 227 219 |  | 
| 228 220 | 
             
                def self.remove_empty_directories(dir)
         | 
| 229 221 | 
             
                  Find.find(dir) do |path|
         | 
| 230 | 
            -
                    if File.directory?(path) && Dir.empty?(path)
         | 
| 231 | 
            -
                      FileUtils.rm_rf(path)
         | 
| 232 | 
            -
                    end
         | 
| 222 | 
            +
                    FileUtils.rm_rf(path) if File.directory?(path) && Dir.empty?(path)
         | 
| 233 223 | 
             
                  end
         | 
| 234 224 | 
             
                end
         | 
| 235 225 |  | 
| 236 226 | 
             
                def self.remove_empty_directories_recursively(dir)
         | 
| 237 227 | 
             
                  Find.find(dir) do |path|
         | 
| 238 | 
            -
                    if File.directory?(path) && Dir.empty?(path)
         | 
| 239 | 
            -
                      FileUtils.rm_rf(path)
         | 
| 240 | 
            -
                    end
         | 
| 228 | 
            +
                    FileUtils.rm_rf(path) if File.directory?(path) && Dir.empty?(path)
         | 
| 241 229 | 
             
                  end
         | 
| 242 230 | 
             
                end
         | 
| 243 231 |  | 
| 244 232 | 
             
                # cleans all git repositories found in the given directory
         | 
| 245 233 | 
             
                def self.deep_clean(dir)
         | 
| 246 234 | 
             
                  git_dirs = []
         | 
| 247 | 
            -
                  #Dir.chdir(dir) do
         | 
| 235 | 
            +
                  # Dir.chdir(dir) do
         | 
| 248 236 | 
             
                  # scan all subdirectories for git repositories
         | 
| 249 237 | 
             
                  puts "  scanning #{dir} for git repositories".colorize(:green)
         | 
| 250 238 | 
             
                  Find.find(dir) do |path|
         | 
| 251 | 
            -
                    if File.directory?(path) && File.exist?("#{path}/.git")
         | 
| 252 | 
            -
                      git_dirs << path
         | 
| 253 | 
            -
                    end
         | 
| 239 | 
            +
                    git_dirs << path if File.directory?(path) && File.exist?("#{path}/.git")
         | 
| 254 240 | 
             
                  end
         | 
| 255 | 
            -
                  #end
         | 
| 241 | 
            +
                  # end
         | 
| 256 242 | 
             
                  git_dirs.each do |path|
         | 
| 257 243 | 
             
                    puts "  cleaning #{path} of untracked files".colorize(:green)
         | 
| 258 244 | 
             
                    Dir.chdir(path) do
         | 
| @@ -263,13 +249,13 @@ module Makit | |
| 263 249 |  | 
| 264 250 | 
             
                def self.get_relative_paths(directory_path, pattern = "**/*")
         | 
| 265 251 | 
             
                  relative_paths = []
         | 
| 266 | 
            -
             | 
| 252 | 
            +
             | 
| 267 253 | 
             
                  Dir.chdir(directory_path) do
         | 
| 268 254 | 
             
                    Dir.glob(pattern).each do |file|
         | 
| 269 255 | 
             
                      relative_paths << file
         | 
| 270 256 | 
             
                    end
         | 
| 271 257 | 
             
                  end
         | 
| 272 | 
            -
             | 
| 258 | 
            +
             | 
| 273 259 | 
             
                  relative_paths
         | 
| 274 260 | 
             
                end
         | 
| 275 261 | 
             
              end
         | 
    
        data/lib/makit/docs/files.rb
    CHANGED
    
    | @@ -2,7 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require "find"
         | 
| 4 4 | 
             
            require "pathname"
         | 
| 5 | 
            -
            #require "gitignore"
         | 
| 6 5 |  | 
| 7 6 | 
             
            # This module provides classes for the Makit gem.
         | 
| 8 7 | 
             
            module Makit
         | 
| @@ -16,22 +15,18 @@ module Makit | |
| 16 15 | 
             
                class Files
         | 
| 17 16 | 
             
                  def self.generate
         | 
| 18 17 | 
             
                    filename = "docs/Files.md"
         | 
| 19 | 
            -
                     | 
| 20 | 
            -
                      Dir.mkdir("docs")
         | 
| 21 | 
            -
                    end
         | 
| 18 | 
            +
                    FileUtils.mkdir_p("docs")
         | 
| 22 19 | 
             
                    # overwrite the file if it exists
         | 
| 23 | 
            -
                     | 
| 24 | 
            -
                      File.delete(filename)
         | 
| 25 | 
            -
                    end
         | 
| 20 | 
            +
                    FileUtils.rm_f(filename)
         | 
| 26 21 | 
             
                    File.open(filename, "w") do |file|
         | 
| 27 22 | 
             
                      file.write("# Files\n\n")
         | 
| 28 | 
            -
                      file.write("A file summary for the project #{Makit::Git::get_remote_url}.\n\n")
         | 
| 23 | 
            +
                      file.write("A file summary for the project #{Makit::Git::Repository.get_remote_url}.\n\n")
         | 
| 29 24 |  | 
| 30 25 | 
             
                      #
         | 
| 31 26 | 
             
                      # Tracked Files
         | 
| 32 27 | 
             
                      #
         | 
| 33 28 | 
             
                      # report on the file tracked by git.
         | 
| 34 | 
            -
                      tracked_file_infos = Makit::Git::get_file_infos
         | 
| 29 | 
            +
                      tracked_file_infos = Makit::Git::Repository.get_file_infos
         | 
| 35 30 |  | 
| 36 31 | 
             
                      # first display the count and total size of the files tracked by git.
         | 
| 37 32 | 
             
                      file.write("## Tracked Files\n\n")
         | 
| @@ -65,7 +60,7 @@ module Makit | |
| 65 60 | 
             
                      # Untracked Files
         | 
| 66 61 | 
             
                      #
         | 
| 67 62 | 
             
                      # report on the files that are not tracked by git.
         | 
| 68 | 
            -
                      untracked_file_infos = Makit::Git::get_untracked_file_infos
         | 
| 63 | 
            +
                      untracked_file_infos = Makit::Git::Repository.get_untracked_file_infos
         | 
| 69 64 | 
             
                      # display the count and total size of the files that are not tracked by git.
         | 
| 70 65 | 
             
                      file.write("## Untracked Files\n\n")
         | 
| 71 66 | 
             
                      file.write("#{untracked_file_infos.count} files with a total size of #{Makit::Humanize.get_humanized_size(untracked_file_infos.sum(&:size))}.\n\n")
         | 
    
        data/lib/makit/docs/rake.rb
    CHANGED
    
    | @@ -2,7 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require "find"
         | 
| 4 4 | 
             
            require "pathname"
         | 
| 5 | 
            -
            #require "gitignore"
         | 
| 6 5 |  | 
| 7 6 | 
             
            # This module provides classes for the Makit gem.
         | 
| 8 7 | 
             
            module Makit
         | 
| @@ -19,7 +18,7 @@ module Makit | |
| 19 18 | 
             
                  end
         | 
| 20 19 |  | 
| 21 20 | 
             
                  def self.get_top_task_name
         | 
| 22 | 
            -
                     | 
| 21 | 
            +
                    get_top_level_tasks.first
         | 
| 23 22 | 
             
                  end
         | 
| 24 23 |  | 
| 25 24 | 
             
                  def self.duration
         | 
| @@ -33,33 +32,32 @@ module Makit | |
| 33 32 | 
             
                  # return a hash of name => value for properties of the rake execution
         | 
| 34 33 | 
             
                  def self.properties
         | 
| 35 34 | 
             
                    {
         | 
| 36 | 
            -
                      "top_level_tasks" =>  | 
| 35 | 
            +
                      "top_level_tasks" => get_top_level_tasks,
         | 
| 37 36 | 
             
                      # If global VERSION is defined, then add it to the properties (this is NOT the Makit::VERSION)
         | 
| 38 37 | 
             
                      "version" => (defined?(VERSION) ? VERSION : ""),
         | 
| 39 | 
            -
                      "branch" => Makit::Git.branch,
         | 
| 38 | 
            +
                      "branch" => Makit::Git::Repository.branch,
         | 
| 40 39 | 
             
                      # add the current user name
         | 
| 41 | 
            -
                      "user" => ENV | 
| 40 | 
            +
                      "user" => ENV.fetch("USER", nil),
         | 
| 42 41 | 
             
                      # add the current machine name
         | 
| 43 | 
            -
                      "machine" => ENV | 
| 42 | 
            +
                      "machine" => ENV.fetch("COMPUTERNAME", nil),
         | 
| 44 43 | 
             
                      # add the os name
         | 
| 45 | 
            -
                      "os" => ENV | 
| 46 | 
            -
                      "duration" => Makit::Humanize.get_humanized_duration( | 
| 47 | 
            -
                      "start_time" => Makit::Humanize.get_humanized_timestamp( | 
| 48 | 
            -
                      "source_file_count" => Makit::Git.get_file_infos.count,
         | 
| 49 | 
            -
                      "source_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_file_infos.sum(&:size)),
         | 
| 50 | 
            -
                      "untracked_file_count" => Makit::Git.get_untracked_file_infos.count,
         | 
| 51 | 
            -
                      "untracked_file_size" => Makit::Humanize.get_humanized_size(Makit::Git.get_untracked_file_infos.sum(&:size)),
         | 
| 44 | 
            +
                      "os" => ENV.fetch("OS", nil),
         | 
| 45 | 
            +
                      "duration" => Makit::Humanize.get_humanized_duration(duration),
         | 
| 46 | 
            +
                      "start_time" => Makit::Humanize.get_humanized_timestamp(start_time),
         | 
| 47 | 
            +
                      "source_file_count" => Makit::Git::Repository.get_file_infos.count,
         | 
| 48 | 
            +
                      "source_file_size" => Makit::Humanize.get_humanized_size(Makit::Git::Repository.get_file_infos.sum(&:size)),
         | 
| 49 | 
            +
                      "untracked_file_count" => Makit::Git::Repository.get_untracked_file_infos.count,
         | 
| 50 | 
            +
                      "untracked_file_size" => Makit::Humanize.get_humanized_size(Makit::Git::Repository.get_untracked_file_infos.sum(&:size)),
         | 
| 52 51 | 
             
                      # express the ratio of untracked file size to tracked file size as a percentage
         | 
| 53 | 
            -
                      "ratio_untracked_size_to_tracked_size" => ((Makit::Git.get_untracked_file_infos.sum(&:size) / Makit::Git.get_file_infos.sum(&:size)) * 100).to_i,
         | 
| 52 | 
            +
                      "ratio_untracked_size_to_tracked_size" => ((Makit::Git::Repository.get_untracked_file_infos.sum(&:size) / Makit::Git::Repository.get_file_infos.sum(&:size)) * 100).to_i,
         | 
| 54 53 | 
             
                    }
         | 
| 55 54 | 
             
                  end
         | 
| 56 55 |  | 
| 57 56 | 
             
                  def self.generate
         | 
| 58 | 
            -
             | 
| 59 57 | 
             
                    # if the top level tasks are of size 1, with the name "default",
         | 
| 60 58 | 
             
                    # then we will continue to generate the documentation.
         | 
| 61 59 | 
             
                    # otherwise, we will display a message and exit.
         | 
| 62 | 
            -
                    if  | 
| 60 | 
            +
                    if get_top_level_tasks.size != 1 || get_top_level_tasks.first != "default"
         | 
| 63 61 | 
             
                      puts "  no top level tasks specified, skipping rake documentation generation".colorize(:yellow)
         | 
| 64 62 | 
             
                      return
         | 
| 65 63 | 
             
                    end
         | 
| @@ -70,7 +68,7 @@ module Makit | |
| 70 68 |  | 
| 71 69 | 
             
                    # display a table of the properties
         | 
| 72 70 | 
             
                    content += "## Properties\n\n"
         | 
| 73 | 
            -
                     | 
| 71 | 
            +
                    properties.each do |key, value|
         | 
| 74 72 | 
             
                      content += "| #{key} | #{value} |\n"
         | 
| 75 73 | 
             
                    end
         | 
| 76 74 | 
             
                    content += "\n\n"
         | 
| @@ -87,9 +85,7 @@ module Makit | |
| 87 85 | 
             
                    content += "\n\n"
         | 
| 88 86 |  | 
| 89 87 | 
             
                    filename = "docs/Rake.md"
         | 
| 90 | 
            -
                     | 
| 91 | 
            -
                      Dir.mkdir("docs")
         | 
| 92 | 
            -
                    end
         | 
| 88 | 
            +
                    FileUtils.mkdir_p("docs")
         | 
| 93 89 | 
             
                    # overwrite the file if it exists
         | 
| 94 90 | 
             
                    if File.exist?(filename)
         | 
| 95 91 | 
             
                      existing_content = File.read(filename)
         | 
| @@ -0,0 +1,65 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Makit
         | 
| 4 | 
            +
              class DotNet
         | 
| 5 | 
            +
                class CLI
         | 
| 6 | 
            +
                  def self.new_solution(name)
         | 
| 7 | 
            +
                    if File.exist? "#{name}.sln"
         | 
| 8 | 
            +
                      # puts "Solution #{name}.sln already exists".colorize(:yellow)
         | 
| 9 | 
            +
                    else
         | 
| 10 | 
            +
                      "dotnet new sln --name #{name}".run
         | 
| 11 | 
            +
                    end
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def self.sln_add_projects(sln_name)
         | 
| 15 | 
            +
                    raise "Solution #{sln_name}.sln does not exist" unless File.exist? "#{sln_name}.sln"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                    sln_path = "#{sln_name}.sln"
         | 
| 18 | 
            +
                    sln_content = File.read(sln_path)
         | 
| 19 | 
            +
                    Dir.glob("**/*.csproj").each do |project_path|
         | 
| 20 | 
            +
                      project_name = File.basename(project_path, ".csproj")
         | 
| 21 | 
            +
                      if sln_content.include?("\"#{project_name}\"")
         | 
| 22 | 
            +
                        # puts "  #{project_name}".colorize(:green) + " is in ".colorize(:grey) + "#{sln_path}".colorize(:green)
         | 
| 23 | 
            +
                      else
         | 
| 24 | 
            +
                        "dotnet sln #{sln_path} add #{project_path}".run
         | 
| 25 | 
            +
                      end
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  #
         | 
| 30 | 
            +
                  # generate docs/DotNet.md
         | 
| 31 | 
            +
                  #
         | 
| 32 | 
            +
                  def self.generate_docs
         | 
| 33 | 
            +
                    content = "# DotNet\n\n"
         | 
| 34 | 
            +
                    content += "## Projects\n\n"
         | 
| 35 | 
            +
                    # scan for .csproj files in src directory
         | 
| 36 | 
            +
                    src_projects = Dir.glob("src/**/*.csproj")
         | 
| 37 | 
            +
                    src_projects.each do |project_path|
         | 
| 38 | 
            +
                      File.basename(project_path, ".csproj")
         | 
| 39 | 
            +
                      # "dotnet tool update --global dotnet-aspnet-codegenerator".run
         | 
| 40 | 
            +
                      # "dotnet aspnet-codegenerator controller --name #{project_name}Controller --output ~/Projects/makit/src/makit/Controllers --controllerName #{project_name}Controller --useAsyncActions --relativeFolderPath Controllers".run
         | 
| 41 | 
            +
                    end
         | 
| 42 | 
            +
                    content += "## Packages\n\n"
         | 
| 43 | 
            +
                    # scan for packages.config files in src directory
         | 
| 44 | 
            +
                    src_packages = Dir.glob("src/**/packages.config")
         | 
| 45 | 
            +
                    src_packages.each do |packages_path|
         | 
| 46 | 
            +
                      File.basename(packages_path, ".packages.config")
         | 
| 47 | 
            +
                    end
         | 
| 48 | 
            +
                    content += "## References\n\n"
         | 
| 49 | 
            +
                    # scan for project.json files in src directory
         | 
| 50 | 
            +
                    src_references = Dir.glob("src/**/project.json")
         | 
| 51 | 
            +
                    src_references.each do |references_path|
         | 
| 52 | 
            +
                      File.basename(references_path, ".project.json")
         | 
| 53 | 
            +
                    end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                    # write content to docs/DotNet.md file
         | 
| 56 | 
            +
                    if File.exist?("docs/DotNet.md")
         | 
| 57 | 
            +
                      existing_content = File.read("docs/DotNet.md")
         | 
| 58 | 
            +
                      File.write("docs/DotNet.md", content) if existing_content != content
         | 
| 59 | 
            +
                    else
         | 
| 60 | 
            +
                      File.write("docs/DotNet.md", content)
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         |