Class: Borrower::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/borrower/manifest.rb,
lib/borrower/manifest/config_file.rb

Defined Under Namespace

Classes: ConfigFile

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManifest

Returns a new instance of Manifest.



9
10
11
12
13
14
15
16
17
18
# File 'lib/borrower/manifest.rb', line 9

def initialize
  @files = {}
  @directories = []

  if Manifest::ConfigFile.present?
    @manifest_file = Manifest::ConfigFile.new
    @files = @files.merge( @manifest_file.files )
    @directories = @directories.push( *@manifest_file.directories )
  end
end

Instance Attribute Details

#directoriesObject (readonly)

Returns the value of attribute directories.



7
8
9
# File 'lib/borrower/manifest.rb', line 7

def directories
  @directories
end

#filesObject (readonly)

Returns the value of attribute files.



6
7
8
# File 'lib/borrower/manifest.rb', line 6

def files
  @files
end

Instance Method Details

#dir(dir) ⇒ Object



24
25
26
# File 'lib/borrower/manifest.rb', line 24

def dir dir
  @directories.push dir
end

#file(name, path) ⇒ Object



20
21
22
# File 'lib/borrower/manifest.rb', line 20

def file name, path
  @files[name] = path
end

#find(file) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/borrower/manifest.rb', line 28

def find file
  obj = Content::Item.new(file)
  return file if obj.remote? || obj.exists?

  path = check_for_file_in_manifest_files(file) || false
  return path if path

  path = check_for_file_in_manifest_directories(file) || false
  return path if path

  path = check_for_file_with_expanded_path(file) || false
  return path if path

  raise "Could not file #{file}"
end