Module: Ronin::Git

Defined in:
lib/ronin/git.rb

Class Method Summary collapse

Class Method Details

.branch(mod) ⇒ Object



21
22
23
24
25
26
# File 'lib/ronin/git.rb', line 21

def branch(mod)
  @cmd = Mixlib::ShellOut.new("git --git-dir=#{Ronin::Config[:module_path]}/#{mod}/.git --work-tree=#{Ronin::Config[:module_path]}/#{mod}/ branch")
  @cmd.run_command
  @branch = @cmd.stdout.chomp.split(' ')[1]
  @branch
end

.clone(mod_data) ⇒ Object



37
38
39
40
41
# File 'lib/ronin/git.rb', line 37

def clone(mod_data)
  @cmd = Mixlib::ShellOut.new("git clone #{mod_data[:repo]} #{Ronin::Config[:module_path]}/#{mod_data[:name]}/ -b #{mod_data[:branch]}")
  @cmd.run_command
  @cmd.stdout
end

.pull_and_report_updated(mod) ⇒ Object



29
30
31
32
33
34
# File 'lib/ronin/git.rb', line 29

def pull_and_report_updated(mod)
  @cmd = Mixlib::ShellOut.new("git --git-dir=#{Ronin::Config[:module_path]}/#{mod}/.git --work-tree=#{Ronin::Config[:module_path]}/#{mod}/ pull")
  @cmd.run_command
  @updated = @cmd.stdout.include?("Updating")
  @updated ? true : false
end