This repository has been archived by the owner on Jan 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Rakefile
72 lines (58 loc) · 1.77 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
70
71
72
##############
# Build #
##############
# Generate the site
# Minify, optimize, and compress
desc "build the site"
task :build do
system "JEKYLL_ENV=production bundle exec jekyll build --incremental"
end
##############
# Develop #
##############
# Useful for development
# It watches for chagnes and updates when it finds them
desc "Watch the site and regenerate when it changes"
task :watch do
system "JEKYLL_ENV=development bundle exec jekyll serve --config '_config.yml,_config_localhost.yml' --watch"
end
##############
# Deploy #
##############
# Deploy the site
# Ping / Notify after site is deployed
desc "deploy the site"
task :deploy do
system "bundle exec s3_website push"
system "bundle exec rake notify" #ping google/bing about our sitemap updates
end
##############
# Notify #
##############
# Ping Google and Yahoo to let them know you updated your site
site = "www.YOUR-URL.com"
desc 'Notify Google of the new sitemap'
task :sitemapgoogle do
begin
require 'net/http'
require 'uri'
puts '* Pinging Google about our sitemap'
Net::HTTP.get('www.google.com', '/webmasters/tools/ping?sitemap=' + URI.escape('#{site}/sitemap.xml'))
rescue LoadError
puts '! Could not ping Google about our sitemap, because Net::HTTP or URI could not be found.'
end
end
desc 'Notify Bing of the new sitemap'
task :sitemapbing do
begin
require 'net/http'
require 'uri'
puts '* Pinging Bing about our sitemap'
Net::HTTP.get('www.bing.com', '/webmaster/ping.aspx?siteMap=' + URI.escape('#{site}/sitemap.xml'))
rescue LoadError
puts '! Could not ping Bing about our sitemap, because Net::HTTP or URI could not be found.'
end
end
desc "Notify various services about new content"
task :notify => [:sitemapgoogle, :sitemapbing] do
end