Module: Ronin::Git

Defined in:
lib/ronin/git.rb

Class Method Summary collapse

Class Method Details

.branch(artifact) ⇒ Object



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

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

.clone(artifact_data) ⇒ Object



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

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

.pull_and_report_updated(artifact) ⇒ Object



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

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