Class: Drupid::DownloadStrategy::Mercurial
- Defined in:
- lib/drupid/download_strategy.rb
Instance Attribute Summary
Attributes inherited from Base
#dest, #name, #staged_path, #url
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(url, dest, name, download_specs = {}) ⇒ Mercurial
constructor
A new instance of Mercurial.
- #stage(wd = @dest) ⇒ Object
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 = {}) ⇒ Mercurial
Returns a new instance of Mercurial.
461 462 463 464 |
# File 'lib/drupid/download_strategy.rb', line 461 def initialize url, dest, name, download_specs = {} super @clone = @dest + @name end |
Instance Method Details
#fetch ⇒ Object
466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
# File 'lib/drupid/download_strategy.rb', line 466 def fetch blah "Cloning #{@url}" unless @clone.exist? url=@url.sub(%r[^hg://], '') hg 'clone', url, @clone else blah "Updating #{@clone}" Dir.chdir(@clone) do hg 'pull' hg 'update' end end end |
#stage(wd = @dest) ⇒ Object
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/drupid/download_strategy.rb', line 481 def stage wd = @dest fetch unless @co.exist? dont_debug { wd.mkpath } debug "Staging into #{wd}" dst = wd + @co.basename Dir.chdir @clone do #if @spec and @ref # blah "Checking out #{@spec} #{@ref}" # Dir.chdir @clone do # safe_system 'hg', 'archive', '-y', '-r', @ref, '-t', 'files', dst # end #else hg 'archive', '-y', '-t', 'files', dst #end end end |