Class: Drupid::DownloadStrategy::CVS

Inherits:
Base
  • Object
show all
Defined in:
lib/drupid/download_strategy.rb

Instance Attribute Summary

Attributes inherited from Base

#dest, #name, #staged_path, #url

Instance Method Summary collapse

Methods included from Utils

#blah, #bzr, #compare_paths, #curl, #cvs, #debug, #dont_debug, #git, #hg, #ignore_interrupts, #interactive_shell, #odie, #ofail, #ohai, #owarn, #runBabyRun, #svn, #tempdir, #uncompress, #which, #writeFile

Constructor Details

#initialize(url, dest, name, download_specs = {}) ⇒ CVS

Returns a new instance of CVS.



409
410
411
412
# File 'lib/drupid/download_strategy.rb', line 409

def initialize  url, dest, name, download_specs = {}
  super
  @co = @dest + @name
end

Instance Method Details

#fetchObject



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/drupid/download_strategy.rb', line 414

def fetch
  blah "Checking out #{@url}"

  # URL of cvs cvs://:pserver:[email protected]:/cvsroot/GCC_XML:gccxml
  # will become:
  # cvs -d :pserver:[email protected]:/cvsroot/GCC_XML login
  # cvs -d :pserver:[email protected]:/cvsroot/GCC_XML co gccxml
  mod, url = split_url(@url)

  unless @co.exist?
    Dir.chdir @dest do
      cvs '-d', url, 'login'
      cvs '-d', url, 'checkout', '-d', @name, mod
    end
  else
    blah "Updating #{@co}"
    Dir.chdir(@co) { cvs 'up' }
  end
end

#stage(wd = @dest) ⇒ Object



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/drupid/download_strategy.rb', line 434

def stage wd = @dest
  fetch unless @co.exist?
  dont_debug { wd.mkpath }
  debug "Staging into #{wd}"
  target = wd + @co.basename
  dont_debug { FileUtils.cp_r Dir[(@co+"{.}").to_s], target }

  require 'find'
  Find.find(Dir.pwd) do |path|
    if FileTest.directory?(path) && File.basename(path) == "CVS"
      Find.prune
      dont_debug { FileUtils.rm_r path, :force => true }
    end
  end
end