Class: Raykit::SourceImports

Inherits:
Array
  • Object
show all
Defined in:
lib/raykit/sourceImports.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(urls) ⇒ SourceImports

Returns a new instance of SourceImports.



5
6
7
8
9
# File 'lib/raykit/sourceImports.rb', line 5

def initialize(urls)
  urls.each do |url|
    self << SourceImport.new(url, "src", "**/*.cs", "dep", "")
  end
end

Class Method Details

.load(filename) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/raykit/sourceImports.rb', line 32

def self.load(filename)
  sourceImports = SourceImports.new([])
  array = JSON.parse(IO.read(filename))
  array.each do |hash|
    sourceImport = SourceImport.new(hash["remote"], hash["source"], hash["glob"], hash["target"],
                                    hash["commit"])
    sourceImports << sourceImport
  end
  sourceImports
end

Instance Method Details

#copyObject



15
16
17
# File 'lib/raykit/sourceImports.rb', line 15

def copy
  each(&:copy)
end

#save(filename) ⇒ Object



26
27
28
29
30
# File 'lib/raykit/sourceImports.rb', line 26

def save(filename)
  File.open(filename, "w") do |f|
    f.write(JSON.pretty_generate(self))
  end
end

#targets_exist?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
# File 'lib/raykit/sourceImports.rb', line 19

def targets_exist?
  each do |si|
    return false unless Dir.exist?(si.target)
  end
  true
end

#updateObject



11
12
13
# File 'lib/raykit/sourceImports.rb', line 11

def update
  each(&:update)
end