Sha256: a3542c8892521bfb920084db87bad0f281b039895a6fc28ab7f9fbdbf2d317d6

Contents?: true

Size: 1.28 KB

Versions: 6

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'avm/git/issue/complete'
require 'avm/git/scms/git_subrepo'
require 'avm/scms/base'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    module Scms
      class Git < ::Avm::Scms::Base
        require_sub __FILE__, include_modules: true
        include ::Comparable

        COMMIT_DIRTY_DEFAULT_MESSAGE = 'Dirty files.'

        def <=>(other)
          git_repo <=> other.git_repo
        end

        # @param options [Hash<Symbol, Object>]
        # @return [Avm::Git::Issues::Complete]
        def completer(options = {})
          ::Avm::Git::Issue::Complete.new(self, options)
        end

        def git_repo
          @git_repo ||= ::EacGit::Local.new(path)
        end

        # @param from [Avm::Git::Scms::Git::Commit]
        # @param to [Avm::Git::Scms::Git::Commit]
        # @return [Avm::Git::Scms::Git::Interval]
        def interval(from, to)
          ::Avm::Git::Scms::Git::Interval.new(self, from, to)
        end

        # @return [Enumerable<Avm::Git::Scms::GitSubrepo>]
        def subs
          git_repo.subrepos.map do |subrepo|
            ::Avm::Git::Scms::GitSubrepo.new(subrepo.subpath.expand_path(path))
          end
        end

        def valid?
          path.join('.git').exist?
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
avm-git-0.18.0 lib/avm/git/scms/git.rb
eac_tools-0.94.0 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.17.0 lib/avm/git/scms/git.rb
eac_tools-0.86.5 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.16.0 lib/avm/git/scms/git.rb
eac_tools-0.86.4 sub/avm-git/lib/avm/git/scms/git.rb