class Plotline::Import::Runner
Constants
- HANDLERS
- IGNORED_FILES
So far this includes only the annoying Iconr file on OSX, which is hidden, but it's not a dotfile, so Dir lookup doesn't ignore it…
This file appears when a directory has a custom icon (e.g shared dropbox folder).
Attributes
public_dir[R]
source_dir[R]
target_dir[R]
uploads_dir[R]
Public Class Methods
new(source_dir, target_dir)
click to toggle source
# File lib/plotline/import/runner.rb, line 23 def initialize(source_dir, target_dir) @source_dir = source_dir @target_dir = target_dir @public_dir = target_dir + '/public' @uploads_dir = target_dir + '/public/uploads' @handlers = HANDLERS.map { |klass| klass.new(self) } end
Public Instance Methods
import_all!()
click to toggle source
# File lib/plotline/import/runner.rb, line 32 def import_all! process_files(Dir[@source_dir + '/**/*']) end
process_files(files)
click to toggle source
# File lib/plotline/import/runner.rb, line 36 def process_files(files) files.each do |filename| next if FileTest.directory?(filename) next if IGNORED_FILES.include?(File.basename(filename)) handler_found = false @handlers.each do |handler| if handler.supported_file?(filename) handler.import(filename) handler_found = true end end raise UnsupportedFileType.new(filename) unless handler_found end end