-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
67 lines (55 loc) · 1.59 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
64
65
66
67
require 'complex_config/rude'
require 'fileutils'
namespace :deploy do
def log(msg, env = '?')
puts "[#{env}] #{msg}"
end
def deploy(env)
clean_build env
rsync_files env
end
def rsync_files(env)
puts "Rsyncing local files from #{cc(:site).build_dir_path} to remote: #{cc(:site).remote_path}", env
sh "rsync -avhze ssh --delete --progress #{cc(:site).build_dir_path}/ #{cc(:site).rsync_host}:#{cc(:site).remote_path}"
end
def clean_build(env)
log "Removing all files from current build: #{cc(:site).build_dir_path}", env
sh "rm -rf #{cc(:site).build_dir_path}/*"
log "Generating latest build: #{cc(:site).build_dir_path}", env
sh 'bundle exec middleman build'
end
def build
puts `bundle exec middleman build`
end
desc 'Deploy slides to staging: virual machine'
task :stg do
# TODO: complex config does primarily respect the RAILS_ENV
ENV['RAILS_ENV'] = 'development'
deploy :staging
end
desc 'Deploy slides to production'
task :prd do
# TODO: complex config does primarily respect the RAILS_ENV
ENV['RAILS_ENV'] = 'production'
deploy :production
end
end
namespace :setup do
task default: [:symlink_githooks, :npm_install]
desc 'Symlink githooks'
task :symlink_githooks do
puts "Creating git-hook symlinks"
FileUtils.cd('.git/hooks') do
FileUtils.ln_sf Dir['../../config/git-hooks/*'], '.', verbose: true
end
end
desc 'Install node modules'
task :npm_install do
sh 'npm install'
end
end
desc 'Setup for development'
task setup: ['setup:default']
task :default do
system "rake -sT"
end