28
29
30
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
|
# File 'lib/ronin/module_runner.rb', line 28
def download_and_report_changes
@run_list.items.each do |item|
@actual_branch = Ronin::Git.branch(item[:name])
if File.exist?("#{Ronin::Config[:module_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[:module_path]}/#{item[:name]}/")
Ronin::Git.clone(item[:name], item[:branch])
@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[:module_path]}.")
Ronin::Git.clone(item[:name], item[:branch])
@changes = true if Ronin::Config[:update_on_change]
end
end
@changes
end
|