module Ronin::Git

Public Class Methods

branch(artifact) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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

Private Instance Methods

branch(artifact) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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