Sha256: e3bf00737ddf1bbf0a88f904f56af10d1701dbb65e0f376a7f588123eda95ddb

Contents?: true

Size: 1.24 KB

Versions: 167

Compression:

Stored size: 1.24 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
        local.raise_error "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

167 entries across 167 versions & 3 rubygems

Version Path
eac_tools-0.86.5 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.86.4 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.86.3 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.16.0 lib/eac_git/local/subrepo.rb
eac_tools-0.86.2 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_git-0.15.0 lib/eac_git/local/subrepo.rb
eac_tools-0.84.2 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.84.1 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.84.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.83.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.82.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.81.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.80.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.79.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.78.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.77.1 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.77.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.76.1 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.76.0 sub/eac_git/lib/eac_git/local/subrepo.rb
eac_tools-0.75.2 sub/eac_git/lib/eac_git/local/subrepo.rb