download_head!
download_tag
download_commit
download_branch
tarball_url_for
tmp_path
download_only?
download_and_extract_tarball
download_head! #=> undefined
239 def download_head!
240 download_only? ? download_and_extract_tarball('master') : super
241 end
download_tag #=> undefined
243 def download_tag
244 download_only? ? download_and_extract_tarball(options[:tag]) : super
245 end
download_commit #=> undefined
247 def download_commit
248 download_only? ? download_and_extract_tarball(options[:commit]) : super
249 end
download_branch #=> undefined
251 def download_branch
252 download_only? ? download_and_extract_tarball(options[:branch]) : super
253 end
tarball_url_for(id) #=> undefined
255 def tarball_url_for(id)
256 original_url, username, reponame = *(url.match(/[:\/]([\w\-]+)\/([\w\-]+)\.git/))
257 "https://github.com/#{username}/#{reponame}/tarball/#{id}"
258 end
tmp_path #=> undefined
260 def tmp_path
261 target_path + "tarball.tar.gz"
262 end
download_only? #=> Boolean
Boolean
266 def download_only?
267 @options[:download_only]
268 end
download_and_extract_tarball(id) #=> undefined
270 def download_and_extract_tarball(id)
271 File.open(tmp_path, "w+") do |tmpfile|
272 open tarball_url_for(id) do |archive|
273 tmpfile.write Zlib::GzipReader.new(archive).read
274 end
275
276 system "tar xf #{tmpfile.path} -C #{target_path} --strip-components 1"
277 end
278 end