Module: Jekyll
- Defined in:
- lib/jekyll-multisite.rb
Defined Under Namespace
Classes: Cleaner, EntryFilter, Reader
Class Method Summary collapse
- .sanitized_path(base_directory, questionable_path) ⇒ Object
-
.sync_dir(cur, base, dest) ⇒ Object
Move the _shared directories to the correct location (very hacky - we move all the files to the correct location with a hook after the site is written/rendered).
Class Method Details
.sanitized_path(base_directory, questionable_path) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jekyll-multisite.rb', line 31 def sanitized_path(base_directory, questionable_path) if base_directory.eql?(questionable_path) base_directory elsif questionable_path.start_with?(base_directory) questionable_path elsif File.exists?(questionable_path) and questionable_path != '/' File.(questionable_path) else File.join(base_directory, questionable_path) end end |
.sync_dir(cur, base, dest) ⇒ Object
Move the _shared directories to the correct location
(very hacky - we move all the files to the correct
location with a hook after the site is written/rendered)
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/jekyll-multisite.rb', line 83 def self.sync_dir(cur, base, dest) Dir.glob( File.join(cur, '*'), File::FNM_DOTMATCH).each do |f| rel = Pathname.new(f).relative_path_from(base) dest_dir = File.join(dest, rel) if File.basename(f) == '.' or File.basename(f) == '..' next elsif File.directory?(f) if not File.exists?(dest_dir) Dir.mkdir(dest_dir) end sync_dir(f, base, dest) Dir.rmdir(f) else FileUtils.mv(f, dest_dir) end end end |