makit 0.0.143 → 0.0.145
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/lib/makit/cli/base.rb +17 -0
 - data/lib/makit/cli/generators/templates/ruby/gemspec.rb +1 -0
 - data/lib/makit/cli/main.rb +9 -0
 - data/lib/makit/cli/pipeline_commands.rb +311 -0
 - data/lib/makit/cli/strategy_commands.rb +2 -7
 - data/lib/makit/commands/result.rb +1 -1
 - data/lib/makit/configuration/dotnet_project.rb +9 -0
 - data/lib/makit/configuration/gitlab_helper.rb +4 -1
 - data/lib/makit/configuration/project.rb +362 -84
 - data/lib/makit/configuration/timeout.rb +1 -1
 - data/lib/makit/configuration.rb +5 -0
 - data/lib/makit/fileinfo.rb +8 -0
 - data/lib/makit/git/repository.rb +207 -31
 - data/lib/makit/git.rb +6 -0
 - data/lib/makit/gitlab/pipeline.rb +857 -0
 - data/lib/makit/gitlab/pipeline_service_impl.rb +1536 -0
 - data/lib/makit/humanize.rb +81 -0
 - data/lib/makit/io/filesystem.rb +111 -0
 - data/lib/makit/io/filesystem_service_impl.rb +337 -0
 - data/lib/makit/mp/string_mp.rb +15 -9
 - data/lib/makit/podman/podman.rb +458 -0
 - data/lib/makit/podman/podman_service_impl.rb +1081 -0
 - data/lib/makit/process.rb +214 -0
 - data/lib/makit/protoc.rb +6 -1
 - data/lib/makit/services/repository_manager.rb +268 -132
 - data/lib/makit/symbols.rb +5 -0
 - data/lib/makit/v1/configuration/project_service_impl.rb +371 -0
 - data/lib/makit/v1/git/git_repository_service_impl.rb +295 -0
 - data/lib/makit/v1/makit.v1_pb.rb +1 -1
 - data/lib/makit/v1/makit.v1_services_pb.rb +1 -1
 - data/lib/makit/v1/services/repository_manager_service_impl.rb +572 -0
 - data/lib/makit/version.rb +1 -1
 - data/lib/makit.rb +68 -0
 - metadata +61 -36
 
    
        data/lib/makit/git/repository.rb
    CHANGED
    
    | 
         @@ -1,89 +1,265 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            # Only load gRPC service implementation if generated files exist
         
     | 
| 
      
 4 
     | 
    
         
            +
            if File.exist?(File.join(__dir__, "..", "generated", "makit", "v1", "git", "git_repository_service_services_pb.rb"))
         
     | 
| 
      
 5 
     | 
    
         
            +
              require_relative "../v1/git/git_repository_service_impl"
         
     | 
| 
      
 6 
     | 
    
         
            +
            end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       3 
8 
     | 
    
         
             
            # This module provides classes for the Makit gem.
         
     | 
| 
       4 
9 
     | 
    
         
             
            module Makit
         
     | 
| 
       5 
10 
     | 
    
         
             
              class Git
         
     | 
| 
       6 
11 
     | 
    
         
             
                # This class provides methods for querying git repository state and metadata.
         
     | 
| 
      
 12 
     | 
    
         
            +
                # Now delegates to gRPC service implementation for better scalability and consistency.
         
     | 
| 
       7 
13 
     | 
    
         
             
                class Repository
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # Check if gRPC service is available
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @grpc_available = defined?(Makit::V1::Git::GitRepositoryServiceImpl)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  
         
     | 
| 
      
 17 
     | 
    
         
            +
                  # Get current repository state via gRPC service
         
     | 
| 
      
 18 
     | 
    
         
            +
                  def self.get_repository_state
         
     | 
| 
      
 19 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 20 
     | 
    
         
            +
                      service = Makit::V1::Git::GitRepositoryServiceImpl.new
         
     | 
| 
      
 21 
     | 
    
         
            +
                      request = Makit::V1::Git::GetRepositoryStateRequest.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                      service.get_repository_state(request, nil)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    else
         
     | 
| 
      
 24 
     | 
    
         
            +
                      # Fallback implementation
         
     | 
| 
      
 25 
     | 
    
         
            +
                      create_fallback_repository_state
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  # Delegate all static methods to gRPC service
         
     | 
| 
       8 
30 
     | 
    
         
             
                  def self.git_repo?
         
     | 
| 
       9 
     | 
    
         
            -
                     
     | 
| 
      
 31 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 32 
     | 
    
         
            +
                      get_repository_state.is_git_repo
         
     | 
| 
      
 33 
     | 
    
         
            +
                    else
         
     | 
| 
      
 34 
     | 
    
         
            +
                      Dir.exist?(".git")
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
       10 
36 
     | 
    
         
             
                  end
         
     | 
| 
       11 
37 
     | 
    
         | 
| 
       12 
38 
     | 
    
         
             
                  def self.ci?
         
     | 
| 
       13 
     | 
    
         
            -
                     
     | 
| 
      
 39 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 40 
     | 
    
         
            +
                      get_repository_state.is_ci
         
     | 
| 
      
 41 
     | 
    
         
            +
                    else
         
     | 
| 
      
 42 
     | 
    
         
            +
                      ENV["CI"] == "true"
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
       14 
44 
     | 
    
         
             
                  end
         
     | 
| 
       15 
45 
     | 
    
         | 
| 
       16 
46 
     | 
    
         
             
                  def self.detached
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
      
 47 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 48 
     | 
    
         
            +
                      get_repository_state.is_detached
         
     | 
| 
      
 49 
     | 
    
         
            +
                    else
         
     | 
| 
      
 50 
     | 
    
         
            +
                      `git status`.include?("detached") rescue false
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
       18 
52 
     | 
    
         
             
                  end
         
     | 
| 
       19 
53 
     | 
    
         | 
| 
       20 
54 
     | 
    
         
             
                  def self.read_only?
         
     | 
| 
       21 
     | 
    
         
            -
                     
     | 
| 
      
 55 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 56 
     | 
    
         
            +
                      get_repository_state.is_read_only
         
     | 
| 
      
 57 
     | 
    
         
            +
                    else
         
     | 
| 
      
 58 
     | 
    
         
            +
                      !git_repo? || detached
         
     | 
| 
      
 59 
     | 
    
         
            +
                    end
         
     | 
| 
       22 
60 
     | 
    
         
             
                  end
         
     | 
| 
       23 
61 
     | 
    
         | 
| 
       24 
62 
     | 
    
         
             
                  def self.clean?
         
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
      
 63 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 64 
     | 
    
         
            +
                      get_repository_state.is_clean
         
     | 
| 
      
 65 
     | 
    
         
            +
                    else
         
     | 
| 
      
 66 
     | 
    
         
            +
                      `git status --porcelain`.empty? rescue true
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
       26 
68 
     | 
    
         
             
                  end
         
     | 
| 
       27 
69 
     | 
    
         | 
| 
       28 
70 
     | 
    
         
             
                  def self.unstaged_files
         
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
      
 71 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 72 
     | 
    
         
            +
                      get_repository_state.unstaged_files.to_a
         
     | 
| 
      
 73 
     | 
    
         
            +
                    else
         
     | 
| 
      
 74 
     | 
    
         
            +
                      `git status --porcelain`.split("\n") rescue []
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
       30 
76 
     | 
    
         
             
                  end
         
     | 
| 
       31 
77 
     | 
    
         | 
| 
       32 
78 
     | 
    
         
             
                  def self.untracked_files
         
     | 
| 
       33 
     | 
    
         
            -
                     
     | 
| 
      
 79 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 80 
     | 
    
         
            +
                      get_repository_state.untracked_files.to_a
         
     | 
| 
      
 81 
     | 
    
         
            +
                    else
         
     | 
| 
      
 82 
     | 
    
         
            +
                      `git ls-files --others --exclude-standard`.split("\n") rescue []
         
     | 
| 
      
 83 
     | 
    
         
            +
                    end
         
     | 
| 
       34 
84 
     | 
    
         
             
                  end
         
     | 
| 
       35 
85 
     | 
    
         | 
| 
       36 
86 
     | 
    
         
             
                  def self.get_file_infos
         
     | 
| 
       37 
     | 
    
         
            -
                     
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                     
     | 
| 
       41 
     | 
    
         
            -
                       
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                       
     | 
| 
      
 87 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 88 
     | 
    
         
            +
                      proto_file_infos = get_repository_state.tracked_file_infos
         
     | 
| 
      
 89 
     | 
    
         
            +
                      convert_file_infos_from_proto(proto_file_infos)
         
     | 
| 
      
 90 
     | 
    
         
            +
                    else
         
     | 
| 
      
 91 
     | 
    
         
            +
                      # Fallback implementation
         
     | 
| 
      
 92 
     | 
    
         
            +
                      file_list = `git ls-files`.split("\n") rescue []
         
     | 
| 
      
 93 
     | 
    
         
            +
                      file_list.map do |file|
         
     | 
| 
      
 94 
     | 
    
         
            +
                        Makit::FileInfo.new(
         
     | 
| 
      
 95 
     | 
    
         
            +
                          name: file,
         
     | 
| 
      
 96 
     | 
    
         
            +
                          mtime: File.mtime(file),
         
     | 
| 
      
 97 
     | 
    
         
            +
                          size: File.size(file)
         
     | 
| 
      
 98 
     | 
    
         
            +
                        )
         
     | 
| 
      
 99 
     | 
    
         
            +
                      rescue StandardError
         
     | 
| 
      
 100 
     | 
    
         
            +
                        nil
         
     | 
| 
      
 101 
     | 
    
         
            +
                      end.compact.sort_by(&:mtime).reverse
         
     | 
| 
       44 
102 
     | 
    
         
             
                    end
         
     | 
| 
       45 
     | 
    
         
            -
                    file_infos.sort_by!(&:mtime).reverse!
         
     | 
| 
       46 
     | 
    
         
            -
                    file_infos
         
     | 
| 
       47 
103 
     | 
    
         
             
                  end
         
     | 
| 
       48 
104 
     | 
    
         | 
| 
       49 
105 
     | 
    
         
             
                  def self.get_untracked_file_infos
         
     | 
| 
       50 
     | 
    
         
            -
                     
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                       
     | 
| 
      
 106 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 107 
     | 
    
         
            +
                      proto_file_infos = get_repository_state.untracked_file_infos
         
     | 
| 
      
 108 
     | 
    
         
            +
                      convert_file_infos_from_proto(proto_file_infos)
         
     | 
| 
      
 109 
     | 
    
         
            +
                    else
         
     | 
| 
      
 110 
     | 
    
         
            +
                      # Fallback implementation
         
     | 
| 
      
 111 
     | 
    
         
            +
                      file_list = `git ls-files --others --exclude-standard`.split("\n") rescue []
         
     | 
| 
      
 112 
     | 
    
         
            +
                      file_list.map do |file|
         
     | 
| 
      
 113 
     | 
    
         
            +
                        Makit::FileInfo.new(
         
     | 
| 
      
 114 
     | 
    
         
            +
                          name: file,
         
     | 
| 
      
 115 
     | 
    
         
            +
                          mtime: File.mtime(file),
         
     | 
| 
      
 116 
     | 
    
         
            +
                          size: File.size(file)
         
     | 
| 
      
 117 
     | 
    
         
            +
                        )
         
     | 
| 
      
 118 
     | 
    
         
            +
                      rescue StandardError
         
     | 
| 
      
 119 
     | 
    
         
            +
                        nil
         
     | 
| 
      
 120 
     | 
    
         
            +
                      end.compact.sort_by(&:mtime).reverse
         
     | 
| 
       56 
121 
     | 
    
         
             
                    end
         
     | 
| 
       57 
     | 
    
         
            -
                    file_infos.sort_by!(&:mtime).reverse!
         
     | 
| 
       58 
     | 
    
         
            -
                    file_infos
         
     | 
| 
       59 
122 
     | 
    
         
             
                  end
         
     | 
| 
       60 
123 
     | 
    
         | 
| 
       61 
124 
     | 
    
         
             
                  def self.branch
         
     | 
| 
       62 
     | 
    
         
            -
                     
     | 
| 
      
 125 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 126 
     | 
    
         
            +
                      get_repository_state.branch
         
     | 
| 
      
 127 
     | 
    
         
            +
                    else
         
     | 
| 
      
 128 
     | 
    
         
            +
                      `git branch --show-current`.strip rescue ""
         
     | 
| 
      
 129 
     | 
    
         
            +
                    end
         
     | 
| 
       63 
130 
     | 
    
         
             
                  end
         
     | 
| 
       64 
131 
     | 
    
         | 
| 
       65 
132 
     | 
    
         
             
                  def self.commitsha
         
     | 
| 
       66 
     | 
    
         
            -
                     
     | 
| 
      
 133 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 134 
     | 
    
         
            +
                      get_repository_state.commit_sha
         
     | 
| 
      
 135 
     | 
    
         
            +
                    else
         
     | 
| 
      
 136 
     | 
    
         
            +
                      `git rev-parse HEAD`.strip rescue ""
         
     | 
| 
      
 137 
     | 
    
         
            +
                    end
         
     | 
| 
       67 
138 
     | 
    
         
             
                  end
         
     | 
| 
       68 
139 
     | 
    
         | 
| 
       69 
140 
     | 
    
         
             
                  def self.commitmsg
         
     | 
| 
       70 
     | 
    
         
            -
                     
     | 
| 
      
 141 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 142 
     | 
    
         
            +
                      get_repository_state.commit_message
         
     | 
| 
      
 143 
     | 
    
         
            +
                    else
         
     | 
| 
      
 144 
     | 
    
         
            +
                      `git log -1 --pretty=%B`.strip rescue ""
         
     | 
| 
      
 145 
     | 
    
         
            +
                    end
         
     | 
| 
       71 
146 
     | 
    
         
             
                  end
         
     | 
| 
       72 
147 
     | 
    
         | 
| 
       73 
148 
     | 
    
         
             
                  def self.commitdate
         
     | 
| 
       74 
     | 
    
         
            -
                     
     | 
| 
      
 149 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 150 
     | 
    
         
            +
                      get_repository_state.commit_date
         
     | 
| 
      
 151 
     | 
    
         
            +
                    else
         
     | 
| 
      
 152 
     | 
    
         
            +
                      `git log -1 --pretty=%cd`.strip rescue ""
         
     | 
| 
      
 153 
     | 
    
         
            +
                    end
         
     | 
| 
       75 
154 
     | 
    
         
             
                  end
         
     | 
| 
       76 
155 
     | 
    
         | 
| 
       77 
156 
     | 
    
         
             
                  def self.commitauthor
         
     | 
| 
       78 
     | 
    
         
            -
                     
     | 
| 
      
 157 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 158 
     | 
    
         
            +
                      get_repository_state.commit_author
         
     | 
| 
      
 159 
     | 
    
         
            +
                    else
         
     | 
| 
      
 160 
     | 
    
         
            +
                      `git log -1 --pretty=%an`.strip rescue ""
         
     | 
| 
      
 161 
     | 
    
         
            +
                    end
         
     | 
| 
       79 
162 
     | 
    
         
             
                  end
         
     | 
| 
       80 
163 
     | 
    
         | 
| 
       81 
164 
     | 
    
         
             
                  def self.commitemail
         
     | 
| 
       82 
     | 
    
         
            -
                     
     | 
| 
      
 165 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 166 
     | 
    
         
            +
                      get_repository_state.commit_email
         
     | 
| 
      
 167 
     | 
    
         
            +
                    else
         
     | 
| 
      
 168 
     | 
    
         
            +
                      `git log -1 --pretty=%ae`.strip rescue ""
         
     | 
| 
      
 169 
     | 
    
         
            +
                    end
         
     | 
| 
       83 
170 
     | 
    
         
             
                  end
         
     | 
| 
       84 
171 
     | 
    
         | 
| 
       85 
172 
     | 
    
         
             
                  def self.get_remote_url
         
     | 
| 
       86 
     | 
    
         
            -
                     
     | 
| 
      
 173 
     | 
    
         
            +
                    if @grpc_available
         
     | 
| 
      
 174 
     | 
    
         
            +
                      get_repository_state.remote_url
         
     | 
| 
      
 175 
     | 
    
         
            +
                    else
         
     | 
| 
      
 176 
     | 
    
         
            +
                      `git remote get-url origin`.strip rescue ""
         
     | 
| 
      
 177 
     | 
    
         
            +
                    end
         
     | 
| 
      
 178 
     | 
    
         
            +
                  end
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
                  private
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
                  # Create a fallback repository state object
         
     | 
| 
      
 183 
     | 
    
         
            +
                  def self.create_fallback_repository_state
         
     | 
| 
      
 184 
     | 
    
         
            +
                    # Create a simple object that mimics the protobuf model interface
         
     | 
| 
      
 185 
     | 
    
         
            +
                    state = Object.new
         
     | 
| 
      
 186 
     | 
    
         
            +
                    
         
     | 
| 
      
 187 
     | 
    
         
            +
                    def state.is_git_repo
         
     | 
| 
      
 188 
     | 
    
         
            +
                      @is_git_repo ||= Dir.exist?(".git")
         
     | 
| 
      
 189 
     | 
    
         
            +
                    end
         
     | 
| 
      
 190 
     | 
    
         
            +
                    
         
     | 
| 
      
 191 
     | 
    
         
            +
                    def state.is_ci
         
     | 
| 
      
 192 
     | 
    
         
            +
                      @is_ci ||= ENV["CI"] == "true"
         
     | 
| 
      
 193 
     | 
    
         
            +
                    end
         
     | 
| 
      
 194 
     | 
    
         
            +
                    
         
     | 
| 
      
 195 
     | 
    
         
            +
                    def state.is_detached
         
     | 
| 
      
 196 
     | 
    
         
            +
                      @is_detached ||= `git status`.include?("detached") rescue false
         
     | 
| 
      
 197 
     | 
    
         
            +
                    end
         
     | 
| 
      
 198 
     | 
    
         
            +
                    
         
     | 
| 
      
 199 
     | 
    
         
            +
                    def state.is_read_only
         
     | 
| 
      
 200 
     | 
    
         
            +
                      @is_read_only ||= !is_git_repo || is_detached
         
     | 
| 
      
 201 
     | 
    
         
            +
                    end
         
     | 
| 
      
 202 
     | 
    
         
            +
                    
         
     | 
| 
      
 203 
     | 
    
         
            +
                    def state.is_clean
         
     | 
| 
      
 204 
     | 
    
         
            +
                      @is_clean ||= `git status --porcelain`.empty? rescue true
         
     | 
| 
      
 205 
     | 
    
         
            +
                    end
         
     | 
| 
      
 206 
     | 
    
         
            +
                    
         
     | 
| 
      
 207 
     | 
    
         
            +
                    def state.unstaged_files
         
     | 
| 
      
 208 
     | 
    
         
            +
                      @unstaged_files ||= `git status --porcelain`.split("\n") rescue []
         
     | 
| 
      
 209 
     | 
    
         
            +
                    end
         
     | 
| 
      
 210 
     | 
    
         
            +
                    
         
     | 
| 
      
 211 
     | 
    
         
            +
                    def state.untracked_files
         
     | 
| 
      
 212 
     | 
    
         
            +
                      @untracked_files ||= `git ls-files --others --exclude-standard`.split("\n") rescue []
         
     | 
| 
      
 213 
     | 
    
         
            +
                    end
         
     | 
| 
      
 214 
     | 
    
         
            +
                    
         
     | 
| 
      
 215 
     | 
    
         
            +
                    def state.tracked_file_infos
         
     | 
| 
      
 216 
     | 
    
         
            +
                      @tracked_file_infos ||= []
         
     | 
| 
      
 217 
     | 
    
         
            +
                    end
         
     | 
| 
      
 218 
     | 
    
         
            +
                    
         
     | 
| 
      
 219 
     | 
    
         
            +
                    def state.untracked_file_infos
         
     | 
| 
      
 220 
     | 
    
         
            +
                      @untracked_file_infos ||= []
         
     | 
| 
      
 221 
     | 
    
         
            +
                    end
         
     | 
| 
      
 222 
     | 
    
         
            +
                    
         
     | 
| 
      
 223 
     | 
    
         
            +
                    def state.branch
         
     | 
| 
      
 224 
     | 
    
         
            +
                      @branch ||= `git branch --show-current`.strip rescue ""
         
     | 
| 
      
 225 
     | 
    
         
            +
                    end
         
     | 
| 
      
 226 
     | 
    
         
            +
                    
         
     | 
| 
      
 227 
     | 
    
         
            +
                    def state.commit_sha
         
     | 
| 
      
 228 
     | 
    
         
            +
                      @commit_sha ||= `git rev-parse HEAD`.strip rescue ""
         
     | 
| 
      
 229 
     | 
    
         
            +
                    end
         
     | 
| 
      
 230 
     | 
    
         
            +
                    
         
     | 
| 
      
 231 
     | 
    
         
            +
                    def state.commit_message
         
     | 
| 
      
 232 
     | 
    
         
            +
                      @commit_message ||= `git log -1 --pretty=%B`.strip rescue ""
         
     | 
| 
      
 233 
     | 
    
         
            +
                    end
         
     | 
| 
      
 234 
     | 
    
         
            +
                    
         
     | 
| 
      
 235 
     | 
    
         
            +
                    def state.commit_date
         
     | 
| 
      
 236 
     | 
    
         
            +
                      @commit_date ||= `git log -1 --pretty=%cd`.strip rescue ""
         
     | 
| 
      
 237 
     | 
    
         
            +
                    end
         
     | 
| 
      
 238 
     | 
    
         
            +
                    
         
     | 
| 
      
 239 
     | 
    
         
            +
                    def state.commit_author
         
     | 
| 
      
 240 
     | 
    
         
            +
                      @commit_author ||= `git log -1 --pretty=%an`.strip rescue ""
         
     | 
| 
      
 241 
     | 
    
         
            +
                    end
         
     | 
| 
      
 242 
     | 
    
         
            +
                    
         
     | 
| 
      
 243 
     | 
    
         
            +
                    def state.commit_email
         
     | 
| 
      
 244 
     | 
    
         
            +
                      @commit_email ||= `git log -1 --pretty=%ae`.strip rescue ""
         
     | 
| 
      
 245 
     | 
    
         
            +
                    end
         
     | 
| 
      
 246 
     | 
    
         
            +
                    
         
     | 
| 
      
 247 
     | 
    
         
            +
                    def state.remote_url
         
     | 
| 
      
 248 
     | 
    
         
            +
                      @remote_url ||= `git remote get-url origin`.strip rescue ""
         
     | 
| 
      
 249 
     | 
    
         
            +
                    end
         
     | 
| 
      
 250 
     | 
    
         
            +
                    
         
     | 
| 
      
 251 
     | 
    
         
            +
                    state
         
     | 
| 
      
 252 
     | 
    
         
            +
                  end
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
                  # Convert protobuf FileInfo objects to Ruby FileInfo objects
         
     | 
| 
      
 255 
     | 
    
         
            +
                  def self.convert_file_infos_from_proto(proto_file_infos)
         
     | 
| 
      
 256 
     | 
    
         
            +
                    proto_file_infos.map do |proto_file_info|
         
     | 
| 
      
 257 
     | 
    
         
            +
                      Makit::FileInfo.new(
         
     | 
| 
      
 258 
     | 
    
         
            +
                        name: proto_file_info.name,
         
     | 
| 
      
 259 
     | 
    
         
            +
                        mtime: Time.at(proto_file_info.mtime.seconds, proto_file_info.mtime.nanos, :nsec),
         
     | 
| 
      
 260 
     | 
    
         
            +
                        size: proto_file_info.size
         
     | 
| 
      
 261 
     | 
    
         
            +
                      )
         
     | 
| 
      
 262 
     | 
    
         
            +
                    end
         
     | 
| 
       87 
263 
     | 
    
         
             
                  end
         
     | 
| 
       88 
264 
     | 
    
         
             
                end
         
     | 
| 
       89 
265 
     | 
    
         
             
              end
         
     | 
    
        data/lib/makit/git.rb
    CHANGED
    
    | 
         @@ -2,6 +2,12 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require_relative "git/repository"
         
     | 
| 
       4 
4 
     | 
    
         
             
            require_relative "git/cli"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative "fileinfo"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            # Only load gRPC service implementation if generated files exist
         
     | 
| 
      
 8 
     | 
    
         
            +
            if File.exist?(File.join(__dir__, "generated", "makit", "v1", "git", "git_repository_service_services_pb.rb"))
         
     | 
| 
      
 9 
     | 
    
         
            +
              require_relative "v1/git/git_repository_service_impl"
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
       5 
11 
     | 
    
         | 
| 
       6 
12 
     | 
    
         
             
            # This module provides classes for the Makit gem.
         
     | 
| 
       7 
13 
     | 
    
         
             
            module Makit
         
     |