-
Notifications
You must be signed in to change notification settings - Fork 21
/
Rakefile
executable file
·39 lines (34 loc) · 1.04 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
require "bundler/gem_tasks"
namespace :web do
# Yields to a block after chdir'ing to the specified
# path (relative to the app root), then chdir's back
def run_from_directory(path)
old_dir = Dir::pwd
Dir::chdir("#{File::dirname(__FILE__)}/#{path}")
yield
Dir::chdir(old_dir)
end
desc 'Build the website from source'
task :build do
raise 'Middleman not found. Try "gem install middleman".' if `which middleman` == ''
run_from_directory('web') do
system("middleman build --clean")
end
end
desc "Preview the website at https://0.0.0.0:4567"
task :preview do
raise 'Middleman not found. Try "gem install middleman".' if `which middleman` == ''
run_from_directory('web') do
system("middleman server --bind-address=0.0.0.0")
end
end
desc "Deploy the website to github pages"
task :deploy do
run_from_directory('.') do
system("git subtree push --prefix web/build origin gh-pages")
end
end
desc "Build and deploy the website"
task :build_dep => [:build, :deploy] do
end
end