Class: NightcrawlerSwift::Sync
- Defined in:
- lib/nightcrawler_swift/commands/sync.rb
Instance Method Summary collapse
- #execute(dir_path) ⇒ Object
-
#initialize ⇒ Sync
constructor
A new instance of Sync.
Methods inherited from Command
Constructor Details
#initialize ⇒ Sync
Returns a new instance of Sync.
4 5 6 7 |
# File 'lib/nightcrawler_swift/commands/sync.rb', line 4 def initialize @upload = Upload.new @logger = NightcrawlerSwift.logger end |
Instance Method Details
#execute(dir_path) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# 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 |