Skip to content

Commit 6ae400d

Browse files
committed
sorry David, I like my CDN invalidations
1 parent f753ede commit 6ae400d

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ gem 'dotenv'
2121
# For deploy
2222
gem "aws-sdk"
2323
gem "middleman-cdn"
24+
gem 'middleman-s3_sync'

Gemfile.lock

+15
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ GEM
180180
listen (3.0.3)
181181
rb-fsevent (>= 0.9.3)
182182
rb-inotify (>= 0.9)
183+
map (6.5.5)
183184
maxcdn (0.2.1)
184185
curb-fu (~> 0.6.2)
185186
signet (~> 0.5.1)
@@ -220,6 +221,14 @@ GEM
220221
middleman-core (>= 3.0.2)
221222
multi_json (~> 1.0)
222223
rack-livereload
224+
middleman-s3_sync (3.0.47)
225+
ansi (~> 1.5.0)
226+
fog-aws (>= 0.1.1)
227+
map
228+
middleman-core (>= 3.0.0)
229+
pmap
230+
ruby-progressbar
231+
unf
223232
middleman-sprockets (3.4.2)
224233
middleman-core (>= 3.3)
225234
sprockets (~> 2.12.1)
@@ -242,6 +251,7 @@ GEM
242251
tilt (~> 1.4.1)
243252
padrino-support (0.12.5)
244253
activesupport (>= 3.1)
254+
pmap (1.0.2)
245255
rack (1.6.4)
246256
rack-livereload (0.3.16)
247257
rack
@@ -251,6 +261,7 @@ GEM
251261
rb-inotify (0.9.5)
252262
ffi (>= 0.5.0)
253263
redcarpet (3.2.2)
264+
ruby-progressbar (1.7.5)
254265
sass (3.4.18)
255266
signet (0.5.1)
256267
addressable (>= 2.2.3)
@@ -276,6 +287,9 @@ GEM
276287
uglifier (2.7.2)
277288
execjs (>= 0.3.0)
278289
json (>= 1.8.0)
290+
unf (0.1.4)
291+
unf_ext
292+
unf_ext (0.0.7.1)
279293
xpath (2.0.0)
280294
nokogiri (~> 1.3)
281295

@@ -288,6 +302,7 @@ DEPENDENCIES
288302
middleman (~> 3.4.0)
289303
middleman-cdn
290304
middleman-livereload (~> 3.1.0)
305+
middleman-s3_sync
291306
redcarpet
292307
tzinfo-data
293308
wdm (~> 0.1.0)

config.rb

+29-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
require 'dotenv'
22
Dotenv.load
33

4-
require "lib/deploy"
5-
64
activate :directory_indexes
75

86
set :haml, { ugly: true, format: :html5 }
@@ -24,22 +22,42 @@
2422

2523
set :images_dir, 'images'
2624

25+
activate :s3_sync do |s3_sync|
26+
s3_sync.bucket = 'www.sicpdistilled.com'
27+
s3_sync.region = 'eu-west-1'
28+
s3_sync.delete = false
29+
s3_sync.after_build = true
30+
s3_sync.prefer_gzip = true
31+
s3_sync.path_style = true
32+
s3_sync.reduced_redundancy_storage = false
33+
s3_sync.acl = 'public-read'
34+
s3_sync.encryption = false
35+
s3_sync.prefix = ''
36+
s3_sync.version_bucket = false
37+
end
38+
2739
configure :build do
2840
activate :minify_css
2941
activate :minify_javascript
30-
activate :s3_deploy
3142
activate :asset_hash
3243

33-
activate :cdn do |cdn|
34-
cdn.cloudflare = {
35-
zone: 'sicpdistilled.com',
36-
base_urls: [
37-
'https://www.sicpdistilled.com'
38-
]
39-
}
40-
end
4144
end
4245

46+
activate :cdn do |cdn|
47+
cdn.cloudflare = {
48+
49+
zone: 'sicpdistilled.com',
50+
base_urls: [
51+
'http://www.sicpdistilled.com'
52+
]
53+
}
54+
end
55+
56+
after_s3_sync do |files_by_status|
57+
cdn_invalidate(files_by_status[:updated])
58+
end
59+
60+
4361
# ready do
4462
# # proxy "/section/welcome", "/index.html"
4563
# %w[0.1 1.1 1.2 2.1 2.2.4].each do |id|

lib/deploy.rb

-39
This file was deleted.

0 commit comments

Comments
 (0)