31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/ronin/artifact_runner.rb', line 31
def download_and_report_changes
@items = @run_list.items
Parallel.each(@items, :in_threads => Ronin::Util.num_cores) do |item|
@actual_branch = Ronin::Git.branch(item[:name])
if File.exist?("#{Ronin::Config[:artifact_path]}/#{item[:name]}")
if item[:branch] != 'master'
Ronin::Log.info("Module #{item[:name]} is being pulled from the #{item[:branch]} branch and not master.")
end
if @actual_branch == item[:branch]
Ronin::Log.info("Module #{item[:name]} already cached, pulling updates to #{item[:branch]} from #{item[:repo]}.")
@updated = Ronin::Git.pull_and_report_updated(item[:name])
if @updated
Ronin::Log.info("Module #{item[:name]} has updates.")
@changes = true if Ronin::Config[:update_on_change]
end
else
Ronin::Log.info("Module #{item[:name]} already cached, but is the wrong branch. Deleting cached copy of branch #{@actual_branch}")
FileUtils.rm_rf("#{Ronin::Config[:artifact_path]}/#{item[:name]}/")
Ronin::Git.clone(item)
@changes = true if Ronin::Config[:update_on_change]
end
else
Ronin::Log.info("Module #{item[:name]} not cached, cloning branch #{item[:branch]} of #{item[:repo]} to #{Ronin::Config[:artifact_path]}.")
Ronin::Git.clone(item)
@changes = true if Ronin::Config[:update_on_change]
end
end
@changes
end
|