class Specs

Attributes

path[R]
specs_root[R]
whitelist[R]

Public Class Methods

new(path, whitelist = [], specs_root = '') click to toggle source
# File lib/updater/specs.rb, line 6
def initialize(path, whitelist = [], specs_root = '')
  @path = path
  @whitelist = whitelist
  @specs_root = File.join(@path, specs_root)
end

Public Instance Methods

git() click to toggle source
# File lib/updater/specs.rb, line 26
def git
  @git ||= Git.new(@path)
end
merge_pods(other_pods) click to toggle source
# File lib/updater/specs.rb, line 19
def merge_pods(other_pods)
  other_pods.each do |pod|
    FileUtils.cp_r(pod.path, @path)
  end
  @pods = nil
end
pods() click to toggle source
# File lib/updater/specs.rb, line 12
def pods
  @pods ||= traverse(@specs_root).flatten.map do |pod_path|
    pod = Pod.new(pod_path)
    @whitelist.any? && !@whitelist.include?(pod.name) ? nil : pod
  end.compact
end

Private Instance Methods

traverse(working_dir) click to toggle source
# File lib/updater/specs.rb, line 32
def traverse(working_dir)
  whitelist = %w{0 1 2 3 4 5 6 7 8 9 a b c d e f}
  pods = []
  Dir.glob(File.join(working_dir, '*')).map do |dir|
    dir_name = dir.split(File::SEPARATOR).last
    if whitelist.include? dir_name
      pods << traverse(dir)
    else
      pods << dir
    end
  end
  pods
end