22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/awestruct/page_loader.rb', line 22
def load_all(prepare=:inline)
raise "No such dir #{root_dir}" unless File.directory?(root_dir)
pages = []
root_dir.find do |path|
if ( path == root_dir )
$LOG.debug "skip #{path}" if site.config.verbose && site.config.debug
next
end
basename = File.basename( path )
if ( basename == '.htaccess' )
elsif ( basename =~ /^[_.]/ )
$LOG.debug "skip #{path} and prune" if (site.config.verbose && site.config.debug)
Find.prune
next
end
relative_path = path.relative_path_from( root_dir ).to_s
if ignore?(relative_path)
$LOG.debug "skip ignored #{path} and prune" if site.config.verbose && site.config.debug
Find.prune
next
end
unless path.directory?
$LOG.debug "loading #{relative_path}" if site.config.verbose && site.config.debug
page = load_page( path, prepare )
if ( page )
next if (page.draft && !(@site.show_drafts || @site.profile == 'development'))
$LOG.debug "loaded! #{path} and added to site" if site.config.debug
site.send( @target ) << page
pages << page
end
end
end
if ( prepare == :post )
pages.each{|p| p.prepare!}
end
end
|