class Roper::Repo
This class is concerned with the repository resource itself
Public Class Methods
new(repo, branch)
click to toggle source
@param [String] repo A GitHub reposiory in the form <user>/<name> @param [String] branch The name of a branch in the reposiory
# File lib/roper/repo.rb, line 12 def initialize(repo, branch) @branch = branch @repo = Octokit::Repository.new(repo) @mount_path = Roper::mount_path(repo, branch) end
Public Instance Methods
mount()
click to toggle source
Pulls in the initialized repository and checkout the initialized branch
# File lib/roper/repo.rb, line 19 def mount Git.clone(@repo.url, @mount_path) .checkout(@branch) rescue nil end
ref()
click to toggle source
Helper function to get HEAD commit sha for the initialized branch
# File lib/roper/repo.rb, line 36 def ref Git.open(@mount_path).object("HEAD").sha end
unmount()
click to toggle source
Deletes the local copy of the reposiory
# File lib/roper/repo.rb, line 31 def unmount FileUtils.rm_r(@mount_path) end
update()
click to toggle source
Pulls the latest commit to branch from origin
# File lib/roper/repo.rb, line 25 def update Git.open(@mount_path) .pull("origin", @branch) end