-
Notifications
You must be signed in to change notification settings - Fork 28
/
Rakefile
60 lines (49 loc) · 1.57 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
require 'rubygems'
task :default => :build
desc "Build and preview the site locally in development mode"
task :preview => :check do
system "bundle exec awestruct --dev"
#system "bundle exec awestruct -P development -g -s"
end
# provide a serve task for those used to Jekyll commands
task :serve => :preview
# provide a dev task for those used to legacy Awestruct commands
task :dev => :preview
desc "Build the site with the development profile"
task :build, [:profile] => :check do |t, args|
system "bundle exec awestruct -P #{args[:profile] || 'development'} --force"
end
desc "Build the site and publish to github"
task :github => :check do
system "bundle exec awestruct --deploy -g -P github --force"
end
desc "Build the site and publish to staging"
task :staging => :check do
system "bundle exec awestruct --deploy -g -P staging --force"
end
desc "Build the site and publish to production"
task :production => :check do
system "bundle exec awestruct --deploy -g -P production --force"
end
desc "Setup or update the environment to run Awestruct"
task :setup do
system "bundle update"
end
desc "Clean out generated site and temporary files"
task :clean do
require 'fileutils'
['.awestruct', '.sass-cache', '_site', '_tmp'].each do |dir|
FileUtils.remove_dir dir unless !File.directory? dir
end
end
task :check do
begin
require 'bundler'
Bundler.setup
rescue StandardError => e
puts "\e[31m#{e.message}\e[0m"
puts "\e[33mRun `rake setup` to install required gems.\e[0m"
exit e.status_code
end
Dir.mkdir('_tmp') unless Dir.exist?('_tmp')
end