Class: Drupid::DownloadStrategy::Bazaar

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 = {}) ⇒ Bazaar

Returns a new instance of Bazaar.



501
502
503
504
# File 'lib/drupid/download_strategy.rb', line 501

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

Instance Method Details

#fetchObject



506
507
508
509
510
511
512
513
514
515
516
# File 'lib/drupid/download_strategy.rb', line 506

def fetch
  blah "Cloning #{@url}"
  unless @clone.exist?
    url=@url.sub(%r[^bzr://], '')
    # 'lightweight' means history-less
    bzr 'checkout', '--lightweight', url, @clone
  else
    blah "Updating #{@clone}"
    Dir.chdir(@clone) { bzr 'update' }
  end
end

#stageObject



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/drupid/download_strategy.rb', line 518

def stage
  # FIXME: The export command doesn't work on checkouts
  # See https://bugs.launchpad.net/bzr/+bug/897511
  FileUtils.cp_r Dir[(@clone+"{.}").to_s], Dir.pwd
  FileUtils.rm_r Dir[Dir.pwd+"/.bzr"]
    
  #dst=Dir.getwd
  #Dir.chdir @clone do
  #  if @spec and @ref
  #    ohai "Checking out #{@spec} #{@ref}"
  #    Dir.chdir @clone do
  #      safe_system 'bzr', 'export', '-r', @ref, dst
  #    end
  #  else
  #    safe_system 'bzr', 'export', dst
  #  end
  #end
end