Sha256: 6aaa756381551aec0adc1816ce27a0c3ccc97eb9fe01b312399444eb58e1e940

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'libgems/uninstaller'

module Spade::Packager
  class Local < Repository
    def uninstall(package)
      LibGems::Uninstaller.new(package).uninstall
      true
    rescue LibGems::InstallError
      false
    end

    def pack(path)
      package = Spade::Packager::Package.new(creds.email)
      package.json_path = path
      if package.valid?
        silence do
          LibGems::Builder.new(package.to_spec).build
        end
      end
      package
    end

    def unpack(path, target)
      package       = Spade::Packager::Package.new
      package.spade = path
      unpack_dir    = File.expand_path(File.join(Dir.pwd, target, package.to_full_name))
      LibGems::Installer.new(path, :unpack => true).unpack unpack_dir
      package
    end

    def installed(packages)
      specs = LibGems.source_index.search dependency_for(packages)

      specs.map do |spec|
        [spec.name, spec.version, spec.original_platform]
      end
    end

    private

    def silence
      original_verbose = LibGems.configuration.verbose
      LibGems.configuration.verbose = false
      yield
    ensure
      LibGems.configuration.verbose = original_verbose
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spade-packager-0.1.0.1 lib/spade/packager/local.rb
spade-packager-0.1.0 lib/spade/packager/local.rb