class EacLauncher::Stereotypes::GitSubrepo::Warp

Attributes

instance[R]

Public Class Methods

new(instance) click to toggle source
Calls superclass method EacLauncher::Paths::Real::new
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 18
def initialize(instance)
  @instance = instance
  check_parent
  init_aux
  push_to_aux
  reset
  assert_target_remote
  super(warped_git)
end

Private Instance Methods

assert_target_remote() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 72
def assert_target_remote
  warped_git.assert_remote_url(::EacLauncher::Git::WarpBase::TARGET_REMOTE,
                               target_remote_url)
end
aux_path() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 54
def aux_path
  instance.cache_path('subrepo_aux_git_repository')
end
check_parent() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 30
def check_parent
  return if parent_git_warped.rev_parse(subrepo_parent_hash) &&
            parent_git_warped.descendant?('HEAD', subrepo_parent_hash)

  raise EacLauncher::Instances::Error, "Subrepo parent hash \"#{subrepo_parent_hash}\""\
    " not found in \"#{parent_git_warped}\""
end
init_aux() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 46
def init_aux
  ::EacLauncher::Git::Base.new(aux_path).init_bare
end
parent_git_warped_uncached() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 50
def parent_git_warped_uncached
  ::EacLauncher::Git::Base.new(parent_instance.warped)
end
push_to_aux() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 62
def push_to_aux
  parent_git_warped.execute!('subrepo', 'branch', to_parent_git_path, '-fF')
  h = parent_git_warped.rev_parse("subrepo/#{to_parent_git_path}", true)
  parent_git_warped.execute!('push', aux_path, "#{h}:refs/heads/master", '--force')
end
reset() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 68
def reset
  ::EacLauncher::Git::MirrorUpdate.new(warped_git, aux_path, 'master')
end
subrepo_parent_hash() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 38
def subrepo_parent_hash
  data = parent_git_warped.subrepo_status(to_parent_git_path)
  h = data['Pull Parent']
  return h if h.present?

  raise EacLauncher::Instances::Error, "Subrepo parent hash is blank: #{data}"
end
target_remote_url() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 77
def target_remote_url
  ::EacLauncher::Vendor::Github.to_ssh_url(
    parent_git_warped.subrepo_remote_url(to_parent_git_path)
  )
end
warped_git_uncached() click to toggle source
# File lib/eac_launcher/stereotypes/git_subrepo/warp.rb, line 58
def warped_git_uncached
  ::EacLauncher::Git::Base.new(instance.cache_path('git_repository'))
end