Class: Spade::Local
Instance Attribute Summary
Attributes inherited from Repository
#creds, #env
Instance Method Summary
collapse
Methods inherited from Repository
#dependency_for, #initialize, #logged_in?
Instance Method Details
#installed(packages) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/spade/local.rb', line 29
def installed(packages)
specs = Gem.source_index.search dependency_for(packages)
specs.map do |spec|
[spec.name, spec.version, spec.original_platform]
end
end
|
#pack(path) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/spade/local.rb', line 10
def pack(path)
package = Spade::Package.new(creds.email)
package.json_path = path
if package.valid?
silence do
Gem::Builder.new(package.to_spec).build
end
end
package
end
|
#uninstall(package) ⇒ Object
3
4
5
6
7
8
|
# File 'lib/spade/local.rb', line 3
def uninstall(package)
Gem::Uninstaller.new(package).uninstall
true
rescue Gem::InstallError
false
end
|
#unpack(path, target) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/spade/local.rb', line 21
def unpack(path, target)
package = Spade::Package.new
package.spade = path
unpack_dir = File.expand_path(File.join(Dir.pwd, target, package.to_full_name))
Gem::Installer.new(path, :unpack => true).unpack unpack_dir
package
end
|