smart_assets 0.1.0 → 0.5.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
- SHA1:
3
- metadata.gz: 656f34484d37622c89d8f3984db7ed7393cf9a9c
4
- data.tar.gz: 879cd2a6564f14c8e13bfb308c274aaa8c5f6380
2
+ SHA256:
3
+ metadata.gz: e136bc4b3048f09450f8b8c82273f9f3bc007912e304357fe857f79d7e84fbcc
4
+ data.tar.gz: 6331834972800d5e830c88b82727d5549b3772505594896080e6d39cb02ba03e
5
5
  SHA512:
6
- metadata.gz: 95e5704965557c10387f43fb330b262b0b9de18c0c863e68663b507168715c3c7eb95d0b3b0c7ed2fcb5c2a63b91236fa42a97885a94f657faf0316c5a233e28
7
- data.tar.gz: ffcc30de0d97fb950110ee80bd755012c2b8aa7cc29a3201efe1c719cda8971ff8ec4641ae96c60ae0b0a435b6a52268e882df80f75104606ac8d1b146974af3
6
+ metadata.gz: 57c34fe81eceaad9d1f41f6009f19eaf7a48a39b7021f47a4e0f22937d2c8f3e690bbca0da8ee34a355858cb6159da0303c2174b94a0b39b2f134778e57ecf27
7
+ data.tar.gz: 74bdf8ed5cc1f80d1616ac21c6a39f4556722a4984b23b63db5d4f8df90607d36374d1ec71aa0e4145067edf165646fd958257c3d48542508e9bf156e7728bc4
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 thomas morgan
1
+ Copyright (c) 2014-2021 thomas morgan
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -14,7 +14,7 @@ This middleware works by reading the sprockets manifest file and internally chan
14
14
 
15
15
  In order to minimize the risks of long caching while using this gem, requests where the requested filename is mutated will set `Cache-Control: public,max-age=60`.
16
16
 
17
- This can configured in your environment files (or an initializer). `max-age` is in seconds. If you've configured apache or nginx to set Cache-Control, you may need to ensure that configuration doesn't override this.
17
+ This can be configured in your environment files (or an initializer). `max-age` is in seconds. If you've configured apache or nginx to set Cache-Control, you may need to ensure that configuration doesn't override this.
18
18
 
19
19
  config.smart_assets.cache_control = 'public,max-age=60'
20
20
 
@@ -26,11 +26,9 @@ This middleware may also be diabled on a per-environment basis with:
26
26
 
27
27
  config.smart_assets.serve_non_digest_assets = false
28
28
 
29
- It is disabled by default for `development` environments, but may be enabled there using the above setting.
29
+ The default is disabled for `development` and enabled for all other environments.
30
30
 
31
- `serve_static_assets` or `assets.compile` must be changed to true or the middleware will disable itself:
32
-
33
- config.serve_static_assets = true
31
+ When this middleware is enabled for a given environment, it automatically enables serving of static files.
34
32
 
35
33
 
36
34
  ## Installation
data/Rakefile CHANGED
@@ -1 +1,13 @@
1
+ require "bundler/setup"
2
+
1
3
  require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ `pushd test/dummy ; rails assets:clobber assets:precompile`
8
+ t.libs << "test"
9
+ t.pattern = "test/**/*_test.rb"
10
+ t.verbose = false
11
+ end
12
+
13
+ task default: :test
@@ -13,7 +13,7 @@ module SmartAssets
13
13
  end
14
14
 
15
15
  digest_path = File.join(manifest.dir, digest_asset)
16
- if File.exists?(digest_path)
16
+ if File.exist?(digest_path)
17
17
  env['PATH_INFO'] = "#{@prefix}/#{digest_asset}"
18
18
  end
19
19
  status, headers, body = @app.call(env)
@@ -11,11 +11,15 @@ module SmartAssets
11
11
  prefix = app.config.smart_assets.prefix || app.config.assets.prefix || '/assets'
12
12
  cc = app.config.smart_assets.cache_control
13
13
 
14
- if app.config.serve_static_assets || app.config.assets.compile
15
- # app.middleware.insert_before(ActionDispatch::Static, SmartAssets::Rack, prefix, cc)
16
- # elsif app.config.assets.compile
17
- app.middleware.insert_after(::Rack::Sendfile, SmartAssets::Rack, prefix, cc)
14
+ if app.config.respond_to?(:public_file_server)
15
+ app.config.public_file_server.enabled = true # >= 5.0
16
+ elsif app.config.respond_to?(:serve_static_files)
17
+ app.config.serve_static_files = true # = 4.2
18
+ else
19
+ app.config.serve_static_assets = true # <= 4.1
18
20
  end
21
+
22
+ app.middleware.insert_after(::Rack::Sendfile, SmartAssets::Rack, prefix, cc)
19
23
  end
20
24
  end
21
25
 
@@ -1,3 +1,3 @@
1
1
  module SmartAssets
2
- VERSION = '0.1.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,80 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '4.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7.1'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: sprockets-rails
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ~>
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '2'
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '2.0'
42
+ version: '4'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - ~>
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '2.0'
49
+ version: '2'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: bundler
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - ~>
57
+ - - ">="
46
58
  - !ruby/object:Gem::Version
47
- version: '1.5'
59
+ version: '0'
48
60
  type: :development
49
61
  prerelease: false
50
62
  version_requirements: !ruby/object:Gem::Requirement
51
63
  requirements:
52
- - - ~>
64
+ - - ">="
53
65
  - !ruby/object:Gem::Version
54
- version: '1.5'
66
+ version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: minitest-reporters
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
55
81
  - !ruby/object:Gem::Dependency
56
82
  name: rake
57
83
  requirement: !ruby/object:Gem::Requirement
58
84
  requirements:
59
- - - '>='
85
+ - - ">="
60
86
  - !ruby/object:Gem::Version
61
87
  version: '0'
62
88
  type: :development
63
89
  prerelease: false
64
90
  version_requirements: !ruby/object:Gem::Requirement
65
91
  requirements:
66
- - - '>='
92
+ - - ">="
67
93
  - !ruby/object:Gem::Version
68
94
  version: '0'
69
- description: Rails/Rack middleware to enable delivery of non-digest assets.
95
+ description: Rails/Rack middleware to enable delivery of non-digest assets with appropriate
96
+ cache headers.
70
97
  email:
71
98
  - tm@iprog.com
72
99
  executables: []
73
100
  extensions: []
74
101
  extra_rdoc_files: []
75
102
  files:
76
- - .gitignore
77
- - Gemfile
78
103
  - LICENSE.txt
79
104
  - README.md
80
105
  - Rakefile
@@ -82,29 +107,28 @@ files:
82
107
  - lib/smart_assets/rack.rb
83
108
  - lib/smart_assets/railtie.rb
84
109
  - lib/smart_assets/version.rb
85
- - smart_assets.gemspec
86
110
  homepage: https://github.com/zarqman/smart_assets
87
111
  licenses:
88
112
  - MIT
89
- metadata: {}
90
- post_install_message:
113
+ metadata:
114
+ changelog_uri: https://github.com/zarqman/smart_assets/blob/master/CHANGELOG.md
115
+ post_install_message:
91
116
  rdoc_options: []
92
117
  require_paths:
93
118
  - lib
94
119
  required_ruby_version: !ruby/object:Gem::Requirement
95
120
  requirements:
96
- - - '>='
121
+ - - ">="
97
122
  - !ruby/object:Gem::Version
98
123
  version: '0'
99
124
  required_rubygems_version: !ruby/object:Gem::Requirement
100
125
  requirements:
101
- - - '>='
126
+ - - ">="
102
127
  - !ruby/object:Gem::Version
103
128
  version: '0'
104
129
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 2.0.6
107
- signing_key:
130
+ rubygems_version: 3.2.22
131
+ signing_key:
108
132
  specification_version: 4
109
133
  summary: Rails/Rack middleware to enable delivery of non-digest assets
110
134
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in smart_assets.gemspec
4
- gemspec
data/smart_assets.gemspec DELETED
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'smart_assets/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "smart_assets"
8
- spec.version = SmartAssets::VERSION
9
- spec.authors = ["thomas morgan"]
10
- spec.email = ["tm@iprog.com"]
11
- spec.summary = %q{Rails/Rack middleware to enable delivery of non-digest assets}
12
- spec.description = %q{Rails/Rack middleware to enable delivery of non-digest assets.}
13
- spec.homepage = "https://github.com/zarqman/smart_assets"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_dependency 'rails', '~> 4.0'
22
- spec.add_dependency 'sprockets-rails', '~> 2.0'
23
-
24
- spec.add_development_dependency "bundler", "~> 1.5"
25
- spec.add_development_dependency "rake"
26
- end