class NightcrawlerSwift::Sync

Public Class Methods

new() click to toggle source
# File lib/nightcrawler_swift/commands/sync.rb, line 4
def initialize
  @upload = Upload.new
  @logger = NightcrawlerSwift.logger
end

Public Instance Methods

execute(dir_path) click to toggle source
# File lib/nightcrawler_swift/commands/sync.rb, line 9
def execute dir_path
  @logger.info "[NightcrawlerSwift] dir_path: #{dir_path}"
  Dir["#{dir_path}/**/**"].each do |fullpath|
    path = fullpath.gsub("#{dir_path}/", "")

    unless File.directory?(fullpath)
      @logger.info "[NightcrawlerSwift] #{path}"
      @upload.execute path, File.open(fullpath, "r")
    end
  end
end