Class: Rip::RemoteGemPackage
- Inherits:
-
Package
- Object
- Package
- Rip::RemoteGemPackage
show all
- Defined in:
- lib/rip/packages/remote_gem_package.rb
Constant Summary
collapse
- @@remotes =
%w( gems.github.com gemcutter.org gems.rubyforge.org )
- @@exists_cache =
{}
Instance Attribute Summary
Attributes inherited from Package
#files, #source
Instance Method Summary
collapse
Methods inherited from Package
#cache_name, #cache_path, #dependencies, #fetch, #files!, for, handles, #initialize, #installed?, #packages_path, #run_hook, #to_s, #ui, #unpack
Methods included from PackageAPI
#cached?, #files!, #name
Methods included from Memoize
included, #memoize, #method_added
Constructor Details
This class inherits a constructor from Rip::Package
Instance Method Details
#actual_package ⇒ Object
61
62
63
|
# File 'lib/rip/packages/remote_gem_package.rb', line 61
def actual_package
Package.for(Dir[cache_path + '/*'].first)
end
|
#dependencies! ⇒ Object
52
53
54
|
# File 'lib/rip/packages/remote_gem_package.rb', line 52
def dependencies!
actual_package.dependencies
end
|
#exists? ⇒ Boolean
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/rip/packages/remote_gem_package.rb', line 12
def exists?
return false unless source =~ /^[\w-]+$/
return true if @@exists_cache[source] || File.exists?(cache_path)
FileUtils.mkdir_p cache_path
Dir.chdir cache_path do
@@remotes.each do |remote|
next if remote =~ /github/ && !source.include?('-')
ui.vputs "Searching %s for %s..." % [ remote, source ]
source_flag = "--source=http://#{remote}/"
if Sh::Gem.rgem("fetch #{source} #{source_flag}") =~ /Downloaded (.+)/
ui.vputs "Found #{source} at #{remote}"
@@exists_cache[source] = $1
return true
end
end
end
FileUtils.rm_rf cache_path
false
end
|
#fetch! ⇒ Object
42
43
|
# File 'lib/rip/packages/remote_gem_package.rb', line 42
def fetch!
end
|
38
39
40
|
# File 'lib/rip/packages/remote_gem_package.rb', line 38
def meta_package?
true
end
|
#unpack! ⇒ Object
45
46
47
48
49
50
|
# File 'lib/rip/packages/remote_gem_package.rb', line 45
def unpack!
installer = Installer.new
installer.install actual_package, self
installer.manager.sources[actual_package.name] = source
installer.manager.save
end
|
#version ⇒ Object
56
57
58
|
# File 'lib/rip/packages/remote_gem_package.rb', line 56
def version
actual_package ? actual_package.version : super
end
|