-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
43 lines (36 loc) · 1.32 KB
/
Rakefile
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
require "rubygems"
require 'rake'
desc "Switch between Jekyll-bootstrap themes."
task :switch_theme, :theme do |t, args|
theme_path = File.join(File.dirname(__FILE__), "_includes", "themes", args.theme)
layouts_path = File.join(File.dirname(__FILE__), "_layouts")
abort("rake aborted: './_includes/themes/#{args.theme}' directory not found.") unless Dir.exists?(theme_path)
abort("rake aborted: './_layouts' directory not found.") unless Dir.exists?(layouts_path)
Dir.glob("#{theme_path}/*") do |filename|
puts "Generating '#{args.theme}' layout: #{File.basename(filename)}"
open("#{layouts_path}/#{File.basename(filename)}", 'w') do |page|
if File.basename(filename, ".html").downcase == "default"
page.puts "---"
page.puts "---"
page.puts "{% assign theme_asset_path = \"/assets/themes/#{args.theme}\" %}"
else
page.puts "---"
page.puts "layout: default"
page.puts "---"
end
page.puts "{% include themes/#{args.theme}/#{File.basename(filename)} %}"
end
end
end # task :switch_theme
desc "Launch preview environment"
task :preview do
system "jekyll --auto --server"
end
desc "Build site"
task :build do
system "jekyll"
end
desc "Deploy Amazon s3 Using s3Sync"
task :deploy do
system('s3sync -rpv _site/ less-ja.studiomohawk.com:')
end