Class: Rip::RipfilePackage
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, #installed?, #packages_path, #run_hook, #to_s, #ui, #unpack
Methods included from PackageAPI
#files!
Methods included from Memoize
included, #memoize, #method_added
Constructor Details
#initialize(source, *args) ⇒ RipfilePackage
Returns a new instance of RipfilePackage.
5
6
7
8
|
# File 'lib/rip/packages/ripfile_package.rb', line 5
def initialize(source, *args)
super
@source = File.expand_path(source)
end
|
Instance Method Details
#cached? ⇒ Boolean
26
27
28
|
# File 'lib/rip/packages/ripfile_package.rb', line 26
def cached?
false
end
|
#dependencies! ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/rip/packages/ripfile_package.rb', line 46
def dependencies!
if File.exists? deps = File.join(cache_path, name)
File.readlines(deps).map do |line|
package_source, version, * = line.split(' ')
if package = Package.for(package_source, version)
package
else
path = File.join(File.dirname(@source), package_source)
Package.for(path, version)
end
end
else
[]
end
end
|
#dependency_installed(dependency, success = true) ⇒ Object
30
31
32
33
34
|
# File 'lib/rip/packages/ripfile_package.rb', line 30
def dependency_installed(dependency, success = true)
if !success
ui.puts "rip: already installed #{dependency}"
end
end
|
#exists? ⇒ Boolean
10
11
12
|
# File 'lib/rip/packages/ripfile_package.rb', line 10
def exists?
File.exists? source
end
|
#fetch! ⇒ Object
36
37
38
39
40
|
# File 'lib/rip/packages/ripfile_package.rb', line 36
def fetch!
FileUtils.rm_rf cache_path
FileUtils.mkdir_p cache_path
FileUtils.cp source, File.join(cache_path, name)
end
|
22
23
24
|
# File 'lib/rip/packages/ripfile_package.rb', line 22
def meta_package?
true
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/rip/packages/ripfile_package.rb', line 14
def name
source.split('/').last
end
|
#unpack! ⇒ Object
42
43
44
|
# File 'lib/rip/packages/ripfile_package.rb', line 42
def unpack!
fetch
end
|
#version ⇒ Object
18
19
20
|
# File 'lib/rip/packages/ripfile_package.rb', line 18
def version
nil
end
|