class Patches::Pending

Attributes

path[RW]

Public Class Methods

new(path=nil) click to toggle source
# File lib/patches/pending.rb, line 6
def initialize(path=nil)
  @path = path || Patches.default_path
end

Public Instance Methods

each() { |file| ... } click to toggle source
# File lib/patches/pending.rb, line 10
def each
  return nil unless files
  new_files = files.reject { |file| already_run?(file) }
  Patches.logger.info("Patches found: #{new_files.join(',')}")

  new_files.each do |file|
    unless already_run?(file)
      yield file
    end
  end
end

Private Instance Methods

already_run?(path) click to toggle source
# File lib/patches/pending.rb, line 28
def already_run?(path)
  patches[File.basename(path)]
end
files() click to toggle source
# File lib/patches/pending.rb, line 24
def files
  @files ||= Dir[File.join(path, "*.rb")].to_a.sort
end
patches() click to toggle source
# File lib/patches/pending.rb, line 32
def patches
  @patches ||= Patches::Patch.path_lookup
end