-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRakefile
More file actions
45 lines (37 loc) · 822 Bytes
/
Copy pathRakefile
File metadata and controls
45 lines (37 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'nanoc3/tasks'
require 'rubygems'
require 'pathname'
require 'fileutils'
require 'nanoc3'
require "#{Dir.pwd}/lib/utils.rb"
include SiteUtils
task :tags do
site = Nanoc3::Site.new('.')
#site.load_data
dir = Pathname(Dir.pwd + '/content/tags')
dir.rmtree if dir.exist?
dir.mkpath
tags = {}
# Collect tag and page data
site.items.each do |p|
next unless p.attributes[:tags]
p.attributes[:tags].each do |t|
if tags[t]
tags[t] = tags[t]+1
else
tags[t] = 1
end
end
end
# Write pages
tags.each_pair do |k, v|
write_tag_page dir, k, v
#write_tag_feed_page dir, k, 'RSS'
#write_tag_feed_page dir, k, 'Atom'
end
end
task :test_deploy do
Rake::Task['tags'].execute
system("nanoc compile")
Rake::Task['deploy:rsync'].execute
end