forked from chriseppstein/sass-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
30 lines (29 loc) · 938 Bytes
/
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
task :default do
sh "compass compile"
FileList.new('**/*.haml').each do |file|
puts "Compiling #{file} to html"
sh "haml #{file} #{file.sub(/haml/,'html')}"
end
end
task :pages do
require 'git'
require 'fileutils'
repo = Git.open('.')
FileUtils.rm_rf "tmp"
FileUtils.mkdir("tmp")
(FileList.new('**/*.html')+FileList.new('**/*.css')).each do |file|
FileUtils.mkdir_p(File.dirname("tmp/#{file}"))
FileUtils.cp(file, "tmp/#{file}")
end
repo.branch("gh-pages").checkout
FileUtils.rm_rf "recipes/*"
(FileList.new('tmp/**/*.html')+FileList.new('tmp/**/*.css')).each do |file|
FileUtils.mkdir_p(File.dirname("recipes/#{file[4..-1]}"))
FileUtils.cp(file, "recipes/#{file[4..-1]}")
end
FileUtils.rm_rf("tmp")
Dir["recipes/**/*"].each {|f| repo.add(f) }
repo.status.deleted.each {|f, s| repo.remove(f)}
message = ENV["MESSAGE"] || "Updated at #{Time.now.utc}"
repo.commit(message)
end