Class: Spade::Packager::Local

Inherits:
Repository show all
Defined in:
lib/spade/packager/local.rb

Instance Attribute Summary

Attributes inherited from Repository

#creds

Instance Method Summary collapse

Methods inherited from Repository

#dependency_for, #initialize, #logged_in?

Constructor Details

This class inherits a constructor from Spade::Packager::Repository

Instance Method Details

#installed(packages) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/spade/packager/local.rb', line 31

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

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

#pack(path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/spade/packager/local.rb', line 12

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

#uninstall(package) ⇒ Object



5
6
7
8
9
10
# File 'lib/spade/packager/local.rb', line 5

def uninstall(package)
  LibGems::Uninstaller.new(package).uninstall
  true
rescue LibGems::InstallError
  false
end

#unpack(path, target) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/spade/packager/local.rb', line 23

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