lib/locomotive/mounter/reader/file_system/pages_reader.rb
# Record pages found in file system
Record pages found in file system
Record pages found in file system
def fetch
            position, last_dirname = nil, nil
            Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|
              next unless File.directory?(filepath) || filepath =~ /\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/
              if last_dirname != File.dirname(filepath)
                position, last_dirname = 100, File.dirname(filepath)
              end
              page = self.add(filepath, position: position)
              next if File.directory?(filepath) || page.nil?
              if locale = self.filepath_locale(filepath)
                Locomotive::Mounter.with_locale(locale) do
                  self.set_attributes_from_header(page, filepath)
                end
              else
                Locomotive::Mounter.logger.warn "Unknown locale in the '#{File.basename(filepath)}' file."
              end
              position += 1
            end
          end
def fetch position , last_dirname = nil , nil Dir . glob ( File . join ( self . root_dir , '**/*' ) ) . sort . each do | filepath | next unless File . directory? ( filepath ) || filepath =~ / \. ( #{ Locomotive :: Mounter :: TEMPLATE_EXTENSIONS . join ( '|' ) } )$ / if last_dirname != File . dirname ( filepath ) position , last_dirname = 100 , File . dirname ( filepath ) end page = self . add ( filepath , position : position ) next if File . directory? ( filepath ) || page . nil? if locale = self . filepath_locale ( filepath ) Locomotive :: Mounter . with_locale ( locale ) do self . set_attributes_from_header ( page , filepath ) end else Locomotive :: Mounter . logger . warn "Unknown locale in the '#{File.basename(filepath)}' file." end position += 1 end end
Record pages found in file system
Record pages found in file system