-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
69 lines (54 loc) · 1.43 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
68
69
require 'cgi'
task default: :build
desc 'Install all the dependencies -- rubygems, node packages, and bower components.'
task :deps do
bundle :install
npm :install
bower :install
end
desc 'Build the site and stick the output in build/.'
task :build do
middleman :build
end
desc 'Deploy the site to S3. Assumes you have AWS credentials in your environment. It assumes you have already run :build.'
task :deploy do
middleman :sync
middleman :invalidate
Rake::Task['ping'].invoke
end
task :ping do
domain = File.basename File.dirname(__FILE__)
sitemap = "https://#{domain}/sitemap.xml"
[
'http://www.google.com/webmasters/tools/ping?sitemap=',
'http://www.bing.com/ping?sitemap='
].each do |base_url|
url = base_url + CGI.escape(sitemap)
sh "curl '#{url}'"
end
end
desc 'Clobber all the bits that are built with the :build task.'
task :clean do
gulp :clean
sh 'rm -rf build'
end
desc 'Clobber everything, including locally installed node packages and bower components.'
task distclean: :clean do
gulp :distclean
end
def bundle(command, args = '')
sh "bundle #{command} #{args}"
end
def middleman(command)
middleman_args = (verbose == true) ? '--verbose' : ''
bundle :exec, "middleman #{command} #{middleman_args}"
end
def gulp(task)
sh "node_modules/gulp/bin/gulp.js #{task}"
end
def bower(command)
sh "node_modules/bower/bin/bower #{command}"
end
def npm(command)
sh "npm #{command}"
end