Sha256: 974355a11720dccf5c89d8d4b55afd4914af4ab5669d402f6085de06ef8c3a6c

Contents?: true

Size: 1.22 KB

Versions: 84

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require 'eac_git/remote'
require 'eac_ruby_utils/core_ext'

module EacGit
  class Local
    # A git-subrepo (https://github.com/ingydotnet/git-subrepo) in a [EacGit::Local].
    class Subrepo
      require_sub __FILE__
      enable_simple_cache

      common_constructor :local, :subpath do
        self.subpath = subpath.to_pathname
        raise "Config file \"#{config_absolute_path}\" not found" unless config_absolute_path.file?
      end

      def command(subrepo_subcommand, *subrepo_subcommand_args)
        local.command('subrepo', subrepo_subcommand, subpath.to_path,
                      *subrepo_subcommand_args)
      end

      delegate(*::EacGit::Local::Subrepo::Config::MAPPING.keys, to: :config)

      def write_config
        config_absolute_path.write(config.to_content)
      end

      private

      def config_uncached
        ::EacGit::Local::Subrepo::Config.from_file(config_absolute_path)
      end

      def config_absolute_path_uncached
        config_relative_path.expand_path(local.root_path)
      end

      def config_relative_path_uncached
        subpath.join('.gitrepo')
      end

      def remote_uncached
        ::EacGit::Remote.new(remote_uri)
      end
    end
  end
end

Version data entries

84 entries across 84 versions & 2 rubygems

Version Path
avm-tools-0.102.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.5.0 lib/eac_git/local/subrepo.rb
avm-tools-0.101.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.100.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.99.1 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.99.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.98.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.97.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.96.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.4.2 lib/eac_git/local/subrepo.rb
avm-tools-0.95.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.4.1 lib/eac_git/local/subrepo.rb
avm-tools-0.94.3 vendor/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.4.0 lib/eac_git/local/subrepo.rb
avm-tools-0.94.2 vendor/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.3.3 lib/eac_git/local/subrepo.rb
avm-tools-0.94.1 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.94.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.93.0 vendor/eac_git/lib/eac_git/local/subrepo.rb
avm-tools-0.92.0 vendor/eac_git/lib/eac_git/local/subrepo.rb