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{|url|
        self << SourceImport.new(url,'src','**/*.cs','dep','')
    }
end

Class Method Details

.load(filename) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/raykit/sourceImports.rb', line 36

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

Instance Method Details

#copyObject



17
18
19
20
21
# File 'lib/raykit/sourceImports.rb', line 17

def copy
    self.each{|si|
        si.copy
    }
end

#save(filename) ⇒ Object



30
31
32
33
34
# File 'lib/raykit/sourceImports.rb', line 30

def save(filename)
    File.open(filename,'w'){|f|
        f.write(JSON.pretty_generate(self))
    }
end

#targets_exist?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'lib/raykit/sourceImports.rb', line 23

def targets_exist?
    self.each{|si|
        return false if(!Dir.exist?(si.target))
    }
    true
end

#updateObject



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

def update
    self.each{|si|
        si.update
    }
end