Sha256: 814aea6333c0a62de3113925c2b6fed10c1f3d235e79bcc4c04e69bd36d78358

Contents?: true

Size: 969 Bytes

Versions: 5

Compression:

Stored size: 969 Bytes

Contents

# frozen_string_literal: true

require 'avm/scms/base'
require 'eac_git/local'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    module Scms
      class GitSubrepo < ::Avm::Scms::Base
        delegate :changed_files, :commit_if_change, :current_milestone_base_commit, :interval,
                 :head_commit, :run_commit, to: :parent_scm

        def update
          git_subrepo.command('clean').execute!
          git_subrepo.command('pull').execute!
        end

        # @return [EacGit::Local]
        def git_repo
          @git_repo ||= ::EacGit::Local.find(path)
        end

        # @return [EacGit::Local::Subrepo]
        def git_subrepo
          @git_subrepo ||= git_repo.subrepo(subpath)
        end

        # @return [Pathname]
        def subpath
          path.expand_path.relative_path_from(git_repo.root_path.expand_path)
        end

        def valid?
          path.join('.gitrepo').file?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
eac_tools-0.53.0 sub/avm-git/lib/avm/git/scms/git_subrepo.rb
eac_tools-0.52.0 sub/avm-git/lib/avm/git/scms/git_subrepo.rb
eac_tools-0.51.0 sub/avm-git/lib/avm/git/scms/git_subrepo.rb
avm-git-0.11.0 lib/avm/git/scms/git_subrepo.rb
eac_tools-0.50.0 sub/avm-git/lib/avm/git/scms/git_subrepo.rb