forked from railsfactory-subbareddy/wistia-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
92 lines (70 loc) · 2.12 KB
/
Rakefile
File metadata and controls
92 lines (70 loc) · 2.12 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# HT: http://mikeferrier.com/2011/04/29/blogging-with-jekyll-haml-sass-and-jammit/
desc "Pre Jekyll rendering stuff"
task :pre_jekyll do
puts "Doing pre-Jekyll schtuffs ..."
puts " Compiling the compass ... "
system "compass compile"
puts " done."
print " Getting the Official Wistia Header/Footer ... "
system %{
wget -q -O _includes/header.html http://wistia.com/common/header;
wget -q -O _includes/footer.html http://wistia.com/common/footer
}
puts "done."
print " Rendering Haml includes ... "
system(%{
cd _includes/haml &&
for f in *.haml; do [ -e $f ] && haml $f ../${f%.haml}.html; done
})
puts "done."
print " Rendering Haml layouts ... "
system(%{
cd _layouts/haml &&
for f in *.haml; do [ -e $f ] && haml $f ../${f%.haml}.html; done
})
puts "done."
print " Rendering Haml static pages ... "
system(%{
cd _static_pages &&
for f in *.haml; do [ -e $f ] && haml $f ../${f%.haml}.html; done
})
puts "done."
puts " All done."
end
desc "Launch preview environment"
task :preview => :pre_jekyll do
system "foreman start"
end
desc "Build the site"
task :build => :pre_jekyll do
system "bundle exec jekyll"
end
# note: this is only for production, be careful it will erase your shit
desc "Auto-update the doc. DONT DO THIS LOCALLY!!!!!!"
task :nuclear_update => [:update_from_git, :build]
desc "Updates from origin/master. DONT DO THIS LOCALLY!!!!!"
task :update_from_git do
`git fetch && git reset --hard origin/master`
end
# add a title to a post like np title="Blah this is my title"
desc "Create a new post"
task :np do
require 'date'
title = ENV["title"] || "new-post"
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
puts "creating a new post, entitled #{title}"
path = "_posts/#{ slug }.md"
if File.exist?(path)
puts "[WARN] File exists - skipping create"
else
File.open(path, "w") do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{ title.gsub(/-/, ' ')}\""
post.puts "description: "
post.puts "category: "
post.puts "---"
end
end
exit 1
end