Sha256: 6e96781924f6edbab328c732df2acbfc0b0b602a13410b1367c37ae98a508eb8

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module Rip
  module Commands
    x 'Checks that your rip installation is valid.'
    def check(*args)
      Setup.check_installation
      ui.puts "All systems go."
    rescue Setup::StaleEnvironmentError, Setup::InstallationError => e
      ui.puts e.message
    rescue => e
      ui.puts "Installation failed: #{e.message}"
    end

    o 'rip install SOURCE [options]'
    x 'Installs a package from SOURCE.'
    x '-f forces installation (overwrites existing)'
    def install(options = {}, source = nil, version = nil, *args)
      if source.to_s.empty?
        ui.abort "Please tell me what to install."
      end

      package = Rip::Package.for(source, version)

      if !package
        ui.abort "I don't know how to install #{source}"
      end

      installed_package = manager.package(package.name)

      if options[:f] && installed_package
        Installer.new.uninstall(installed_package) if installed_package.installed?
        Installer.new.install(package)
      elsif package.installed?
        ui.puts "#{package} already installed"
      else
        installer = Installer.new
        installer.install(package)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rip-0.0.4 lib/rip/commands/install.rb
rip-0.0.5 lib/rip/commands/install.rb