Class: ARPM::Libfile

Inherits:
Object
  • Object
show all
Defined in:
lib/arpm/libfile.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Libfile

Returns a new instance of Libfile.



6
7
8
# File 'lib/arpm/libfile.rb', line 6

def initialize(content)
  @content = content
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



4
5
6
# File 'lib/arpm/libfile.rb', line 4

def content
  @content
end

Class Method Details

.locationObject



10
11
12
# File 'lib/arpm/libfile.rb', line 10

def self.location
  Dir.pwd + "/Libfile"
end

Instance Method Details

#dependenciesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/arpm/libfile.rb', line 14

def dependencies

  packages = []

  content.gsub!(/\r\n?/, "\n")
  content.each_line do |line|

    if line.start_with?('lib')
        elements = line.scan(/"([^"]*)"/) + line.scan(/'([^']*)'/)
        packages << {elements[0][0] => elements[1][0]}
    end

  end

  packages

end