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
36
37
38
39
40
41
42
|
# File 'lib/spade/local.rb', line 36
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
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/spade/local.rb', line 17
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
9
10
11
12
13
14
15
|
# File 'lib/spade/local.rb', line 3
def uninstall(package)
index = Gem::SourceIndex.from_gems_in(env.spade_dir("specifications"))
index.refresh!
specs = index.find_name package
if specs.first
uninstaller = Gem::Uninstaller.new(package, :ignore => true)
uninstaller.uninstall_gem(specs.first, specs)
true
else
false
end
end
|
#unpack(path, target) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/spade/local.rb', line 28
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
|