class Pullable::Directory

Constants

SKIPPED_DIRECTORIES
VALID_METHODS

Attributes

method[R]
path[R]

Public Class Methods

new(path, method) click to toggle source
# File lib/pullable/directory.rb, line 11
def initialize(path, method)
  unless File.directory?(path)
    raise ArgumentError.new('Please pass a directory that exists!')
  end

  unless VALID_METHODS.include?(method)
    raise ArgumentError.new("#{method} cannot be used to update the repo!")
  end

  @path   = path
  @method = method
end
process!(path, method = 'merge') click to toggle source
# File lib/pullable/directory.rb, line 40
def self.process!(path, method = 'merge')
  new(path, method).process!
end

Public Instance Methods

process!() click to toggle source
# File lib/pullable/directory.rb, line 24
def process!
  Dir.foreach(path) do |directory|
    if File.directory?(directory)
      unless SKIPPED_DIRECTORIES.include?(directory)
        FileUtils.cd(directory)

        if Dir.exists?('.git')
          Pullable::Processor.update!(method, directory)
        end

        FileUtils.cd(path)
      end
    end
  end
end