Class: Houston::Adapters::VersionControl::GitAdapter::RemoteRepo

Inherits:
Repo
  • Object
show all
Defined in:
app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb

Direct Known Subclasses

GithubRepo

Constant Summary collapse

RETRY_COOLDOWN =

seconds

4

Instance Attribute Summary

Attributes inherited from Repo

#location

Instance Method Summary collapse

Methods inherited from Repo

#all_commit_times, #all_commits, #ancestors, #ancestors_until, #branch, #branches, #branches_at, #changes, #commits_between, #exists?, #find_file, #native_commit, #read_file, #ref, #to_s

Constructor Details

#initialize(git_path, location) ⇒ RemoteRepo

Returns a new instance of RemoteRepo.



10
11
12
13
14
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 10

def initialize(git_path, location)
  super location
  @git_path = git_path.to_s
  @branch_location = :remote
end

Instance Method Details

#before_update(project) ⇒ Object



30
31
32
33
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 30

def before_update(project)
  return true unless project.slug_changed?
  rename *project.changes[:slug]
end

#clone!(async: false) ⇒ Object



39
40
41
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 39

def clone!(async: false)
  async ? Houston.async { _clone!(true) } : _clone!(false)
end

#git_pathObject



35
36
37
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 35

def git_path
  @git_path
end

#originObject



47
48
49
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 47

def origin
  @origin ||= connection.remotes["origin"]
end

#pull!(async: false) ⇒ Object



43
44
45
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 43

def pull!(async: false)
  async ? Houston.async { _pull!(true) } : _pull!(false)
end

#refresh!(async: false) ⇒ Object

Public API for a VersionControl::Adapter Repo ————————————————————————- #



21
22
23
24
# File 'app/adapters/houston/adapters/version_control/git_adapter/remote_repo.rb', line 21

def refresh!(async: false)
  return clone!(async: async) unless exists?
  pull!(async: async)
end