Class: Rip::RipfilePackage

Inherits:
Package
  • Object
show all
Defined in:
lib/rip/packages/ripfile_package.rb

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, #to_s, #ui, #unpack

Methods included from PackageAPI

#files!, #version

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

Returns:

  • (Boolean)


22
23
24
# File 'lib/rip/packages/ripfile_package.rb', line 22

def cached?
  false
end

#dependencies!Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/rip/packages/ripfile_package.rb', line 35

def dependencies!
  if File.exists? deps = File.join(cache_path, name)
    File.readlines(deps).map do |line|
      source, version, *extra = line.split(' ')
      Package.for(source, version)
    end
  else
    []
  end
end

#exists?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rip/packages/ripfile_package.rb', line 10

def exists?
  File.exists? source
end

#fetch!Object



26
27
# File 'lib/rip/packages/ripfile_package.rb', line 26

def fetch!
end

#meta_package?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/rip/packages/ripfile_package.rb', line 18

def meta_package?
  true
end

#nameObject



14
15
16
# File 'lib/rip/packages/ripfile_package.rb', line 14

def name
  source.split('/').last
end

#unpack!Object



29
30
31
32
33
# File 'lib/rip/packages/ripfile_package.rb', line 29

def unpack!
  FileUtils.rm_rf cache_path
  FileUtils.mkdir_p cache_path
  FileUtils.cp source, cache_path
end