class Drupid::Updater::UpdateProjectAction

Public Class Methods

new(p, proj, opts = { :label => 'Update' }) click to toggle source
Calls superclass method Drupid::Updater::AbstractAction::new
    # File lib/drupid/updater.rb
591 def initialize p, proj, opts = { :label => 'Update' }
592   raise "#{proj.extended_name} does not exist locally" unless proj.exist?
593   raise "Unknown type for #{proj.extended_name}" unless proj.proj_type
594   @label = opts[:label]
595   super(p, proj)
596 end

Public Instance Methods

msg() click to toggle source
    # File lib/drupid/updater.rb
598 def msg
599   spc = ' ' * [0, 8 - @label.length].max
600   if old_project = platform.get_project(component.name)
601     "#{Tty.blue}[#{@label}]#{Tty.white}#{spc}#{component.name}: #{old_project.version.long} => #{component.version.long}#{Tty.reset} (#{platform.dest_path(component)})"
602   else
603     "#{Tty.blue}[#{@label}]#{Tty.white}#{spc}#{component.name}: => #{component.version.long}#{Tty.reset} (#{platform.dest_path(component)})"
604   end
605 end

Protected Instance Methods

_install() click to toggle source

Deploys a project into the specified location. Note that the content of the project is copied into new_path, not inside a subdirectory of new_path (for example, to copy mymodule inside /some/location, new_path should be set to ‘/some/location/mymodule’). Returns a new Drupid::Project object for the new location, while this project remains unchanged.

    # File lib/drupid/updater.rb
616 def _install
617   args = Array.new
618   # If the project contains a makefile, it is a candidate for a derivative build.
619   # In such case, protect 'libraries', 'modules' and 'themes' subdirectories
620   # from deletion.
621   if component.makefile
622     args << '-f' << 'P /libraries/***' # this syntax requires rsync >=2.6.7.
623     args << '-f' << 'P /modules/***'
624     args << '-f' << 'P /profiles/***'
625     args << '-f' << 'P /themes/***'
626   end
627   if component.drupal?
628     args = Array.new
629     args << '-f' << 'R /profiles/default/***'  # D6
630     args << '-f' << 'R /profiles/minimal/***'  # D7
631     args << '-f' << 'R /profiles/standard/***' # D7
632     args << '-f' << 'R /profiles/testing/***'  # D7
633     args << '-f' << 'P /profiles/***'
634     args << '-f' << 'R /sites/all/README.txt'
635     args << '-f' << 'R /sites/default/default.settings.php'
636     args << '-f' << 'P /sites/***'
637   end
638   args << '-a'
639   args << '--delete'
640   component.ignore_paths.each { |p| args << "--exclude=#{p}" }
641   dst_path = platform.local_path + platform.dest_path(component)
642   dont_debug { dst_path.mkpath }
643   args << component.local_path.to_s + '/'
644   args << dst_path.to_s + '/'
645   begin
646     runBabyRun 'rsync', args
647   rescue => ex
648     odie "Installing or updating #{component.name} failed: #{ex}"
649   end
650 end