-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
executable file
·42 lines (34 loc) · 931 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
31
32
33
34
35
36
37
38
39
40
41
42
# publisher
#require 'middleman-gh-pages'
task default: %w[test]
task :test do
puts "\nBuilding project"
try "middleman build"
end
task :deploy do
# puts "\nCopying GitHub-specific files"
# try "cp -rv ./github/* ./build/"
puts "\nDeploying to GitHub"
try "middleman deploy"
end
namespace :travis do
task :script do
Rake::Task["test"].invoke
end
task :after_success do
puts "\nRunning Travis Deployment"
puts "\nSetting up Git access"
try "echo ${GH_TOKEN} > ./.git/credentials"
try "git config --global user.name ${GH_USER}"
try "git config --global user.email ${GH_EMAIL}"
try "git remote set-url origin \"https://${GH_TOKEN}@github.com/${GH_REF}.git\""
Rake::Task["deploy"].invoke
end
end
## Helper so we fail as soon as a command fails.
def try(command)
system command
if $? != 0 then
raise "Command: `#{command}` exited with code #{$?.exitstatus}"
end
end