Class: Ronin::RunList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ronin/run_list.rb

Instance Method Summary collapse

Constructor Details

#initializeRunList

Returns a new instance of RunList.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ronin/run_list.rb', line 24

def initialize
  @run_list = {}

  if Ronin::Config[:run_list_type] == 'etcd'
    @artifacts_raw = Ronin::Etcd.get_run_list
  else
    @artifacts_raw = YAML.load_file(Ronin::Config['run_list_file'])['artifacts']
  end

  unless @artifacts_raw.nil?
    @artifacts_raw.each do |a|
      if a.include?(";")
        @repo   = a.split(";")[0].sub(/(\/)+$/, '')
        @branch = a.split(";")[1]
      else
        @repo   = a
        @branch = 'master'
      end

      @name = @repo.split("/").last

      @run_list[@name] = { :name => @name, :repo => @repo, :branch => @branch }
    end
  end

  @run_list
end

Instance Method Details

#artifactsObject



52
53
54
55
56
# File 'lib/ronin/run_list.rb', line 52

def artifacts
  @arts = []
  @run_list.each { |k, v| @arts << k }
  @arts
end

#itemsObject



58
59
60
61
62
63
64
# File 'lib/ronin/run_list.rb', line 58

def items
  @items = []
  @run_list.each do |k, v|
    @items << { :name => v[:name], :repo => v[:repo], :branch => v[:branch] }
  end
  @items
end