middleman-cloudfront 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -45,5 +45,37 @@ Otherwise you should run it through commandline interface like so:
|
|
45
45
|
bundle exec middleman invalidate
|
46
46
|
```
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
## S3 + Cloudfront deploying
|
49
|
+
|
50
|
+
In real world this gem shouldn't be used alone, but as a part of your
|
51
|
+
deployment solution. As for me I use it with [cloudfront-sync](https://github.com/karlfreeman/middleman-sync) and my configuration file looks like this:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
configure :build do
|
55
|
+
# so there would be no need in invalidationg css-js files on cdn
|
56
|
+
activate :asset_hash
|
57
|
+
end
|
58
|
+
|
59
|
+
activate :sync do |sync|
|
60
|
+
sync.fog_provider = 'AWS'
|
61
|
+
sync.fog_directory = '...'
|
62
|
+
sync.fog_region = 'us-west-1'
|
63
|
+
sync.aws_access_key_id = ENV['AWS_ACCESS_KEY']
|
64
|
+
sync.aws_secret_access_key = ENV['AWS_SECRET']
|
65
|
+
sync.existing_remote_files = 'delete'
|
66
|
+
sync.gzip_compression = true
|
67
|
+
end
|
68
|
+
|
69
|
+
activate :cloudfront do |cf|
|
70
|
+
cf.access_key_id = ENV['AWS_ACCESS_KEY']
|
71
|
+
cf.secret_access_key = ENV['AWS_SECRET']
|
72
|
+
cf.distribution_id = '...'
|
73
|
+
cf.filter = /\.html$/i
|
74
|
+
end
|
75
|
+
```
|
76
|
+
|
77
|
+
And when I want to deploy my site I do:
|
78
|
+
```bash
|
79
|
+
AWS_ACCESS_KEY= AWS_SECRET= bundle exec middleman sync
|
80
|
+
AWS_ACCESS_KEY= AWS_SECRET= bundle exec middleman invalidate
|
81
|
+
```
|
@@ -38,7 +38,7 @@ module Middleman
|
|
38
38
|
protected
|
39
39
|
|
40
40
|
def options
|
41
|
-
::Middleman::Application.server.inst.
|
41
|
+
::Middleman::Application.server.inst.cloudfront_options
|
42
42
|
rescue
|
43
43
|
raise Error, <<-EOF.lines.map(&:strip).join("\n")
|
44
44
|
ERROR: You need to activate the cloudfront extension in config.rb.
|
@@ -69,6 +69,6 @@ module Middleman
|
|
69
69
|
|
70
70
|
end
|
71
71
|
|
72
|
-
Base.map({"inv" => "
|
72
|
+
Base.map({"inv" => "invalidate"})
|
73
73
|
end
|
74
74
|
end
|
@@ -6,7 +6,7 @@ module Middleman
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def options
|
9
|
-
@@
|
9
|
+
@@cloudfront_options
|
10
10
|
end
|
11
11
|
|
12
12
|
def registered(app, options_hash = {}, &block)
|
@@ -20,14 +20,14 @@ module Middleman
|
|
20
20
|
::Middleman::Cli::CloudFront.new.invalidate if options.after_build
|
21
21
|
end
|
22
22
|
|
23
|
-
@@
|
23
|
+
@@cloudfront_options = options
|
24
24
|
app.send :include, Helpers
|
25
25
|
end
|
26
26
|
alias :included :registered
|
27
27
|
end
|
28
28
|
|
29
29
|
module Helpers
|
30
|
-
def
|
30
|
+
def cloudfront_options
|
31
31
|
::Middleman::CloudFront.options
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-cloudfront
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|