-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
63 lines (51 loc) · 1.31 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require "bundler/setup"
def git_initialize(repository)
unless File.exist?(".git")
system "git init"
system "git remote add origin [email protected]:menglifang/#{repository}.git"
end
end
def git_update
system "git fetch origin"
system "git reset --hard origin/master"
end
desc "Build the website"
task :build do
system "middleman build"
end
=begin
namespace :examples do
desc "Update the included examples from the separate examples repository"
task :update do
mkdir_p "source/examples"
Dir.chdir "source/examples" do
git_initialize("examples")
git_update
`ls .git`
FileUtils.rm_rf(".git")
end
end
end
=end
desc "Deploy the website to github pages"
task :deploy do |t, args|
require "highline/import"
message = ask("Provide a deployment message: ") do |q|
q.validate = /\w/
q.responses[:not_valid] = "Can't be empty."
end
mkdir_p "build"
Dir.chdir "build" do
git_initialize("menglifang.github.com")
git_update
Rake::Task["build"].invoke
# This screws up the build and isn't necessary
# rm_r "source/examples"
File.open("CNAME", 'w') do |f|
f.write "www.menglifang.org"
end
system "git add -A"
system "git commit -m '#{message.gsub("'", "\\'")}'"
system "git push origin master" unless ENV['NODEPLOY']
end
end