lib/coresys.rb
def upgrade(name)
      formula = Formula.find(name).new
      error!("#{formula.name} is already at latest") if formula.exact_version_installed?

      section_start "Upgrading #{formula.name} from #{linked.basename} to #{formula.version}"

      # Unlink current version before installing
      linked = (Coresys.linked + formula.name).realpath
      Linker.new(formula.name, linked.basename, linked).unlink

      begin
        install(formula.name)
        Linker.new(formula.name, formula.version, formula.prefix).link
        cleanup(formula.name)
        section_end
      rescue Exception => e
        # Make sure to put links back on error
        puts e.message, e.backtrace if ARGV.include?("--debug")
        Linker.new(formula.name, linked.basename, linked).link
        section_end "Failed to install #{formula.name}@#{formula.version}"
      end
    end
# Given a different version of a formula exists from the one installed
# it will unlink the currently installed version, install the new version
# and then remove the old versions of the formula
Given a different version of a formula exists from the one installed
it will unlink the currently installed version, install the new version
and then remove the old versions of the formula
Given a different version of a formula exists from the one installed it will unlink the currently installed version install the new version and then remove the old versions of the formula
def upgrade(name)
      formula = Formula.find(name).new
      error!("#{formula.name} is already at latest") if formula.exact_version_installed?
      section_start "Upgrading #{formula.name} from #{linked.basename} to #{formula.version}"
      linked = (Coresys.linked + formula.name).realpath
      Linker.new(formula.name, linked.basename, linked).unlink
      begin
        install(formula.name)
        Linker.new(formula.name, formula.version, formula.prefix).link
        cleanup(formula.name)
        section_end
      rescue Exception => e
        puts e.message, e.backtrace if ARGV.include?("--debug")
        Linker.new(formula.name, linked.basename, linked).link
        section_end "Failed to install #{formula.name}@#{formula.version}"
      end
    end
def upgrade ( name ) formula = Formula . find ( name ) . new error! ( "#{formula.name} is already at latest" ) if formula . exact_version_installed? section_start "Upgrading #{formula.name} from #{linked.basename} to #{formula.version}" linked = ( Coresys . linked + formula . name ) . realpath Linker . new ( formula . name , linked . basename , linked ) . unlink begin install ( formula . name ) Linker . new ( formula . name , formula . version , formula . prefix ) . link cleanup ( formula . name ) section_end rescue Exception => e puts e . message , e . backtrace if ARGV . include? ( "--debug" ) Linker . new ( formula . name , linked . basename , linked ) . link section_end "Failed to install #{formula.name}@#{formula.version}" end end
Given a different version of a formula exists from the one installed
it will unlink the currently installed version, install the new version
and then remove the old versions of the formula
Given a different version of a formula exists from the one installed it will unlink the currently installed version install the new version and then remove the old versions of the formula
# Unlink current version before installing # Make sure to put links back on error
name