lib/coresys.rb
# First verify the given forumla has been built and exists
# in the cellar before removing all versions that are not linked.
First verify the given forumla has been built and exists
in the cellar before removing all versions that are not linked.
First verify the given forumla has been built and exists in the cellar before removing all versions that are not linked .
def cleanup(name)
      formula = Formula.find_or_stub(name).new
      error!("#{name} is not installed") unless formula.installed?
      linked = Coresys.linked + formula.name
      linked = linked.exist? && linked.realpath || formula.prefix
      versions = formula.root.children
      if versions.size > 1
        versions.reject! { |version| version == linked}
        section_start "Cleaning #{formula.name}" if versions.size > 0
        versions.each do |version|
          info "Removing #{formula.name}@#{version.basename}"
          version.rmtree
        end
        section_end if versions.size > 0
      end
    end
def cleanup ( name ) formula = Formula . find_or_stub ( name ) . new error! ( "#{name} is not installed" ) unless formula . installed? linked = Coresys . linked + formula . name linked = linked . exist? && linked . realpath || formula . prefix versions = formula . root . children if versions . size > 1 versions . reject! { | version | version == linked } section_start "Cleaning #{formula.name}" if versions . size > 0 versions . each do | version | info "Removing #{formula.name}@#{version.basename}" version . rmtree end section_end if versions . size > 0 end end
First verify the given forumla has been built and exists
in the cellar before removing all versions that are not linked.
First verify the given forumla has been built and exists in the cellar before removing all versions that are not linked .
# If the formula is not linked, pretend like the latest version # has been linked to prevent it from being cleaned up
name