-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
38 lines (31 loc) · 866 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
task default: %w[test]
task :test do
puts "\nBuilding project"
try "bundle exec middleman build"
end
task :deploy do
puts "\nCopying GitHub-specific files"
try "cp -rv ./github/* ./build/"
puts "\nDeploying to GitHub"
try "bundle exec 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:flexbox/codeless.git\""
Rake::Task["deploy"].invoke
end
end
def try(command)
system command
if $? != 0 then
raise "Command: `#{command}` exited with code #{$?.exitstatus}"
end
end