class Drupid::DownloadStrategy::CVS
Public Class Methods
new(url, dest, name, download_specs = {})
click to toggle source
Calls superclass method
Drupid::DownloadStrategy::Base::new
# File lib/drupid/download_strategy.rb 408 def initialize url, dest, name, download_specs = {} 409 super 410 @co = @dest + @name 411 end
Public Instance Methods
fetch()
click to toggle source
# File lib/drupid/download_strategy.rb 413 def fetch 414 blah "Checking out #{@url}" 415 416 # URL of cvs cvs://:pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML:gccxml 417 # will become: 418 # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML login 419 # cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co gccxml 420 mod, url = split_url(@url) 421 422 unless @co.exist? 423 Dir.chdir @dest do 424 cvs '-d', url, 'login' 425 cvs '-d', url, 'checkout', '-d', @name, mod 426 end 427 else 428 blah "Updating #{@co}" 429 Dir.chdir(@co) { cvs 'up' } 430 end 431 end
stage(wd = @dest)
click to toggle source
# File lib/drupid/download_strategy.rb 433 def stage wd = @dest 434 fetch unless @co.exist? 435 dont_debug { wd.mkpath } 436 debug "Staging into #{wd}" 437 target = wd + @co.basename 438 dont_debug { FileUtils.cp_r Dir[(@co+"{.}").to_s], target } 439 440 require 'find' 441 Find.find(Dir.pwd) do |path| 442 if FileTest.directory?(path) && File.basename(path) == "CVS" 443 Find.prune 444 dont_debug { FileUtils.rm_r path, :force => true } 445 end 446 end 447 end
Private Instance Methods
split_url(in_url)
click to toggle source
# File lib/drupid/download_strategy.rb 450 def split_url(in_url) 451 parts=in_url.sub(%r[^cvs://], '').split(/:/) 452 mod=parts.pop 453 url=parts.join(':') 454 [ mod, url ] 455 end