Sha256: 9334e2e6ccfef83ca25db1b7033c68dd340d82b0e22d019f6b016b6144ffae7e
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require 'fileutils' module Repomen module Repo module Handler # Handler for git repositories # # @todo Uses git's CLI, since Rugged is not playing nice GitHub # Why is that? class Git < Base # Removes the repo from the filesystem # @return [void] def discard FileUtils.rm_rf(path) if repo_exists? end # Retrieves the repo from +@url+ # @return [void] def retrieve if repo_exists? update_repo else clone_repo end end private def git(*args) `git #{args.join(' ')}` end def clone_repo FileUtils.mkdir_p path git :clone, url, path, '--depth=1 --quiet' end def git_options options = %w(--quiet) if config.only_last_revision options << '--depth=1' end options.join(' ') end def update_repo pull end def pull old_dir = Dir.pwd Dir.chdir path git :pull, '--quiet' Dir.chdir old_dir end def repo_exists? File.exists?(path) && File.directory?(path) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
repomen-0.1.0 | lib/repomen/repo/handler/git.rb |