middleman-cdn 0.1.16 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60f2541eb1776a574ad18d1ce8874c1a9c9c3d2b
4
- data.tar.gz: 9907f3298da6d149a4434ccf92678dba9cca26d1
3
+ metadata.gz: 5860904ab2debb540a10ca58350b9056f6c0965b
4
+ data.tar.gz: f9ebbf66b7dee0110c6e5237173ae3e7cb3505dc
5
5
  SHA512:
6
- metadata.gz: e4aefc1cc4929f72e5dc5b7ddd6898c575f36d8c930cfa9645e02031c97031afbe2dcb78bbfaa1b2eab35cf5280061e54d105432fc57c6741b6d750ffcf42049
7
- data.tar.gz: e9e1082251b096c0054f1132ef9c5161ac5569b73d3ed0d70ff827f3a8a13049116b4727a4f10c2374ed2eef9c4827c2dceedceab378abecd5453b0d6a7ec0b9
6
+ metadata.gz: 283c474a8208767535c5e84bf8077fd816b59c6a763e68fa1d69570d92973a2dc181d96b701e6ba0fe221bf56af7e541f24741c0a93da11308c6f8265fed5770
7
+ data.tar.gz: '09ab79b11af6b85e6b3e17bca97e8df72995342d5be81622193fd161b031637c34a77c09f9dc834f2ce8e726c58b29b88bc97dd6a28ba597368ed464fc1f0b35'
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ coverage
4
4
  *.sublime-*
5
5
  *.gem
6
6
  pkg
7
+ gemfiles/*.gemfile.lock
@@ -1,8 +1,21 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 2.0
4
- - 2.1
5
- - 2.2
6
- - 2.3.0
4
+ - 2.2.6
5
+ - 2.3.3
6
+ - 2.4.0
7
7
  before_install:
8
+ - gem update --system
8
9
  - gem install bundler
10
+ gemfile:
11
+ - gemfiles/middleman_3.3.gemfile
12
+ - gemfiles/middleman_3.4.gemfile
13
+ - gemfiles/middleman_3_stable.gemfile
14
+ - gemfiles/middleman_4.0.gemfile
15
+ - gemfiles/middleman_4.1.gemfile
16
+ - gemfiles/middleman_4.2.gemfile
17
+ - gemfiles/middleman_master.gemfile
18
+ matrix:
19
+ allow_failures:
20
+ - rvm: 2.4.0
21
+ gemfile: gemfiles/middleman_4.1.gemfile
@@ -0,0 +1,27 @@
1
+ appraise 'middleman_3.3' do
2
+ gem 'middleman', '~> 3.3.0'
3
+ end
4
+
5
+ appraise 'middleman_3.4' do
6
+ gem 'middleman', '~> 3.4.0'
7
+ end
8
+
9
+ appraise 'middleman_3_stable' do
10
+ gem 'middleman', github: 'middleman/middleman', branch: 'v3-stable'
11
+ end
12
+
13
+ appraise 'middleman_4.0' do
14
+ gem 'middleman', '~> 4.0.0'
15
+ end
16
+
17
+ appraise 'middleman_4.1' do
18
+ gem 'middleman', '~> 4.1.0'
19
+ end
20
+
21
+ appraise 'middleman_4.2' do
22
+ gem 'middleman', '~> 4.2.0'
23
+ end
24
+
25
+ appraise 'middleman_master' do
26
+ gem 'middleman', github: 'middleman/middleman'
27
+ end
data/README.md CHANGED
@@ -232,6 +232,8 @@ I'm using middleman-cdn on my personal website [leighmcculloch.com](http://leigh
232
232
 
233
233
  Middleman CDN is a fork off [Middleman CloudFront](https://github.com/andrusha/middleman-cloudfront) and I used it as the base for building this extension. The code was well structured and easy to understand. It was easy to break out the CloudFront specific logic and to add support for CloudFlare and the other CDNs. My gratitude goes to @andrusha and @manuelmeurer for their work on Middleman CloudFront.
234
234
 
235
+ Thanks to @manuelmeurer for helping port this gem for Middleman v4 and [numerous other valuable contributions](https://github.com/leighmcculloch/middleman-cdn/commits?author=manuelmeurer).
236
+
235
237
  Thanks to @b4k3r for the [Cloudflare gem](https://github.com/b4k3r/cloudflare) that made invalidating CloudFlare files a breeze.
236
238
 
237
239
  Thanks to @geemus and the many contributors to the [fog gem](https://github.com/fog/fog) that made invalidating CloudFront easy.
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", "~> 3.3.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", "~> 3.4.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", :github => "middleman/middleman", :branch => "v3-stable"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", "~> 4.0.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", "~> 4.1.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", "~> 4.2.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "middleman", :github => "middleman/middleman"
6
+
7
+ gemspec :path => "../"
@@ -2,4 +2,4 @@ require 'middleman-core'
2
2
  require 'middleman-cdn/commands'
3
3
  require "middleman-cdn/extension"
4
4
 
5
- ::Middleman::Extensions.register(:cdn, ::Middleman::CDN::CDNExtension)
5
+ ::Middleman::Extensions.register(:cdn, ::Middleman::CDN::Extension)
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require "cloudflare"
3
2
  require "active_support/core_ext/string"
4
3
 
@@ -1,4 +1,4 @@
1
- require "fog"
1
+ require "fog/aws"
2
2
  require "active_support/core_ext/string"
3
3
 
4
4
  module Middleman
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require "fastly"
3
2
  require "active_support/core_ext/string"
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require "maxcdn"
3
2
  require "active_support/core_ext/string"
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require "httparty"
3
2
  require "active_support/core_ext/string"
4
3
  require "middleman-cdn/clients/rackspace.rb"
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require "httparty"
3
2
  require "active_support/core_ext/string"
4
3
 
@@ -11,7 +11,7 @@ require "ansi/code"
11
11
  module Middleman
12
12
  module Cli
13
13
 
14
- class CDN < Thor
14
+ class CDN < Thor::Group
15
15
  include Thor::Actions
16
16
 
17
17
  check_unknown_options!
@@ -22,23 +22,17 @@ module Middleman
22
22
  true
23
23
  end
24
24
 
25
- desc "cdn:cdn_invalidate", "Invalidate your CloudFlare or CloudFront cache"
26
25
  def cdn_invalidate(*args)
27
26
  begin
28
- if args.first && args.first.respond_to?(:filter)
29
- options = args.first
30
- files = args.drop(1)
27
+ options, files = if args.first && args.first.respond_to?(:filter)
28
+ [args.first, args.drop(1)]
31
29
  else
32
- files = args
30
+ [Middleman::CDN::Extension.options, args]
33
31
  end
34
32
 
35
33
  if options.nil?
36
- app_instance = ::Middleman::Application.server.inst
37
- unless app_instance.respond_to?(:cdn_options)
38
- self.class.say_status(nil, ANSI.red{ "Error: You need to activate the cdn extension in config.rb.\n#{example_configuration}" })
39
- raise
40
- end
41
- options = app_instance.cdn_options
34
+ self.class.say_status(nil, ANSI.red{ "Error: You need to activate the cdn extension in config.rb.\n#{example_configuration}" })
35
+ return
42
36
  end
43
37
  options.filter ||= /.*/
44
38
 
@@ -135,8 +129,10 @@ end
135
129
  # Add leading slash
136
130
  files.map! { |f| f.start_with?('/') ? f : "/#{f}" }
137
131
  end
138
- end
139
132
 
140
- Base.map({"cdn" => "cdn_invalidate"})
133
+ Base.register(self, 'cdn_invalidate', 'cdn_invalidate [options]', 'Invalidate CDN')
134
+
135
+ Base.map('cdn' => 'cdn_invalidate')
136
+ end
141
137
  end
142
138
  end
@@ -2,47 +2,40 @@ require 'middleman-core'
2
2
 
3
3
  module Middleman
4
4
  module CDN
5
- module Helpers
6
- def cdn_invalidate(files = nil)
7
- ::Middleman::Cli::CDN.new.cdn_invalidate(cdn_options, *files)
8
- end
9
-
10
- def cdn_options
11
- ::Middleman::CDN::CDNExtension.options
12
- end
13
- end
14
-
15
- class CDNExtension < Middleman::Extension
5
+ class Extension < Middleman::Extension
16
6
  option :cloudflare, nil, 'CloudFlare options'
17
7
  option :cloudfront, nil, 'CloudFront options'
18
8
  option :fastly, nil, 'Fastly options'
19
9
  option :maxcdn, nil, 'MaxCDN options'
20
10
  option :rackspace, nil, 'Rackspace options'
21
- option :filter, nil, 'Cloudflare options'
22
- option :after_build, false, 'Cloudflare options'
11
+ option :filter, nil, 'Filter files to invalidate'
12
+ option :after_build, false, 'Invalidate automatically after build'
13
+
14
+ @@cdn_options = nil
23
15
 
24
16
  def initialize(app, options_hash = {}, &block)
25
17
  super
26
18
 
27
19
  @@cdn_options = options
28
-
29
- app.after_configuration do
30
- app.after_build do
31
- cdn_invalidate if cdn_options.after_build
32
- end
33
- end
34
-
35
- app.send :include, Helpers
36
- end
37
-
38
- def registered
39
- included
40
20
  end
41
21
 
42
22
  def self.options
43
23
  @@cdn_options
44
24
  end
45
25
 
26
+ def after_build(builder)
27
+ ::Middleman::Cli::CDN.new.cdn_invalidate(options) if options.after_build
28
+ end
29
+
30
+ helpers do
31
+ def cdn_invalidate(files = nil)
32
+ ::Middleman::Cli::CDN.new.cdn_invalidate(cdn_options, *files)
33
+ end
34
+
35
+ def cdn_options
36
+ ::Middleman::CDN::Extension.options
37
+ end
38
+ end
46
39
  end
47
40
  end
48
41
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module CDN
3
- VERSION = '0.1.16'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -1,5 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  lib = File.expand_path('../lib', __FILE__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
 
@@ -12,13 +10,13 @@ Gem::Specification.new do |s|
12
10
  s.authors = ["Leigh McCulloch"]
13
11
  s.licenses = ["MIT"]
14
12
  s.homepage = "https://github.com/leighmcculloch/middleman-cdn"
15
- s.summary = %q{Invalidate CloudFlare or CloudFront cache after deployment}
16
- s.description = %q{Invalidate a specific set of files in your CloudFlare or CloudFront cache}
13
+ s.summary = %q{Invalidate CloudFlare, AWS CloudFront, Rackspace, Fastly, or MaxCDN cache after deployment}
14
+ s.description = %q{Invalidate a specific set of files in your CloudFlare, AWS CloudFront, Rackspace, Fastly, or MaxCDN cache}
17
15
 
18
16
  s.files = `git ls-files -z`.split("\0")
19
17
  s.require_paths = ["lib"]
20
18
 
21
- s.add_dependency 'fog', '~> 1.9'
19
+ s.add_dependency 'fog-aws', '~> 1.4'
22
20
  s.add_dependency 'cloudflare', '~> 2.0'
23
21
  s.add_dependency 'fastly', '~> 1.1'
24
22
  s.add_dependency 'maxcdn', '~> 0.1'
@@ -29,6 +27,7 @@ Gem::Specification.new do |s|
29
27
  s.add_development_dependency 'rake', '~> 0.9'
30
28
  s.add_development_dependency 'rspec', '~> 3.0'
31
29
  s.add_development_dependency 'coveralls', '~> 0.7'
30
+ s.add_development_dependency 'appraisal', '~> 2.1'
32
31
 
33
- s.add_dependency 'middleman-core', '~> 3.3'
32
+ s.add_dependency 'middleman', '>= 3.3'
34
33
  end
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require 'spec_helper'
3
2
  require 'lib/middleman-cdn/cdns/base_protocol'
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require 'spec_helper'
3
2
  require 'lib/middleman-cdn/cdns/base_protocol'
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require 'spec_helper'
3
2
  require 'lib/middleman-cdn/cdns/base_protocol'
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require 'spec_helper'
3
2
  require 'lib/middleman-cdn/cdns/base_protocol'
4
3
 
@@ -1,4 +1,3 @@
1
- #Encoding: UTF-8
2
1
  require 'spec_helper'
3
2
  require 'lib/middleman-cdn/clients/rackspace_response_doubles.rb'
4
3
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-cdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leigh McCulloch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-02 00:00:00.000000000 Z
11
+ date: 2017-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: fog
14
+ name: fog-aws
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
19
+ version: '1.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.9'
26
+ version: '1.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cloudflare
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -151,20 +151,35 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.7'
153
153
  - !ruby/object:Gem::Dependency
154
- name: middleman-core
154
+ name: appraisal
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2.1'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '2.1'
167
+ - !ruby/object:Gem::Dependency
168
+ name: middleman
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
173
  version: '3.3'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - "~>"
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '3.3'
167
- description: Invalidate a specific set of files in your CloudFlare or CloudFront cache
181
+ description: Invalidate a specific set of files in your CloudFlare, AWS CloudFront,
182
+ Rackspace, Fastly, or MaxCDN cache
168
183
  email:
169
184
  executables: []
170
185
  extensions: []
@@ -172,11 +187,19 @@ extra_rdoc_files: []
172
187
  files:
173
188
  - ".gitignore"
174
189
  - ".travis.yml"
190
+ - Appraisals
175
191
  - Gemfile
176
192
  - LICENSE
177
193
  - README-cloudflare-pagerule-example.png
178
194
  - README.md
179
195
  - Rakefile
196
+ - gemfiles/middleman_3.3.gemfile
197
+ - gemfiles/middleman_3.4.gemfile
198
+ - gemfiles/middleman_3_stable.gemfile
199
+ - gemfiles/middleman_4.0.gemfile
200
+ - gemfiles/middleman_4.1.gemfile
201
+ - gemfiles/middleman_4.2.gemfile
202
+ - gemfiles/middleman_master.gemfile
180
203
  - lib/middleman-cdn.rb
181
204
  - lib/middleman-cdn/cdns/base.rb
182
205
  - lib/middleman-cdn/cdns/cloudflare.rb
@@ -220,8 +243,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
243
  version: '0'
221
244
  requirements: []
222
245
  rubyforge_project:
223
- rubygems_version: 2.4.8
246
+ rubygems_version: 2.6.11
224
247
  signing_key:
225
248
  specification_version: 4
226
- summary: Invalidate CloudFlare or CloudFront cache after deployment
249
+ summary: Invalidate CloudFlare, AWS CloudFront, Rackspace, Fastly, or MaxCDN cache
250
+ after deployment
227
251
  test_files: []