asset_sync 2.15.1 → 2.16.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
  SHA256:
3
- metadata.gz: 3b257792e6446e212ee50bb6913aa3aee7ffad9dec336995580e4f88355386a7
4
- data.tar.gz: fbddb3142c4a27aa5f0f8f04f32d3addf1719e7df841a23e85f6765ea252146b
3
+ metadata.gz: b1cd4cc5ab6aa00a60de8cad39bd290f99e10f9c3884798af6dec1a495b5b722
4
+ data.tar.gz: 06ca40f184d5d79ebe6aa54437a4e72f0a4e4841d944d58e77b742648d24e748
5
5
  SHA512:
6
- metadata.gz: f4a78f501ad9a2e219f9992b97a8b4a4130b13bea18fb7068a5fb47018f51b7b74fa3cfea110ef76d2897df5e19716d19cc594edb540fd95ca6f32a30ba07384
7
- data.tar.gz: cac00fd92e51292ff02b1428ff81db52350d2cc2cf2101fc08bc1964661a163c7d3f89d240eb0fb6be298b7f8438a18e94f768024699d0146ea54d732c3f8da1
6
+ metadata.gz: 7740b76eee405aba383ab9c8efdf54491288cd172b6f0d02a996b03b94b8b73685d579402bc8aa2af02993f0048b5aa6680944c1c34a3d9dca80b333af5e4484
7
+ data.tar.gz: e73762db4dcd2b3b41acac66dcb12f731d578edc269a1ea0e0b8105a432fd9ea9ef487a4a8d755ff25927fd4eee6d056fb4a0693739eb94a9e07b0eb0f974a7c
@@ -26,30 +26,31 @@ jobs:
26
26
  os:
27
27
  - ubuntu
28
28
  ruby:
29
- - 2.5
30
- - 2.6
31
29
  - 2.7
32
30
  - 3.0
31
+ - 3.1
33
32
  - jruby
34
33
  gemfile:
35
- - gemfiles/rails_5_2.gemfile
36
34
  - gemfiles/rails_6_0.gemfile
37
35
  - gemfiles/rails_6_1.gemfile
36
+ - gemfiles/rails_7_0.gemfile
38
37
  allow_failures:
39
38
  - false
40
39
  include:
41
40
  - os: ubuntu
42
41
  ruby: ruby-head
43
- gemfile: gemfiles/rails_6_1.gemfile
42
+ gemfile: gemfiles/rails_7_0.gemfile
44
43
  allow_failures: true
45
44
  - os: ubuntu
46
45
  ruby: jruby-head
47
- gemfile: gemfiles/rails_6_1.gemfile
46
+ gemfile: gemfiles/rails_7_0.gemfile
48
47
  allow_failures: true
49
48
  exclude:
50
49
  - os: ubuntu
51
- ruby: 3.0
52
- gemfile: gemfiles/rails_5_2.gemfile
50
+ ruby: jruby
51
+ # Rails 7 requires Ruby 2.7
52
+ # `jruby-9.3.7.0` only supports 2.6.x
53
+ gemfile: gemfiles/rails_7_0.gemfile
53
54
  allow_failures: false
54
55
  env:
55
56
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
@@ -58,7 +59,7 @@ jobs:
58
59
  continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
59
60
  steps:
60
61
  - name: Checkout
61
- uses: actions/checkout@v2
62
+ uses: actions/checkout@v3
62
63
  - name: Setup Ruby
63
64
  uses: ruby/setup-ruby@v1
64
65
  with:
data/Appraisals CHANGED
@@ -1,8 +1,4 @@
1
1
 
2
- appraise "rails_5_2" do
3
- gem "rails", "~> 5.2.0"
4
- end
5
-
6
2
  appraise "rails_6_0" do
7
3
  gem "rails", "~> 6.0.0"
8
4
  end
@@ -10,3 +6,7 @@ end
10
6
  appraise "rails_6_1" do
11
7
  gem "rails", "~> 6.1.0"
12
8
  end
9
+
10
+ appraise "rails_7_0" do
11
+ gem "rails", "~> 7.0.0"
12
+ end
data/CHANGELOG.md CHANGED
@@ -18,6 +18,30 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [2.16.0] - 2022-08-26
22
+
23
+ ### Added
24
+
25
+ - Add option `remote_file_list_cache_file_path`
26
+ (https://github.com/AssetSync/asset_sync/pull/428)
27
+
28
+
29
+ ## [2.15.3] - 2022-08-25
30
+
31
+ ### Fixed
32
+
33
+ - Fix config `prefix` about env var & YAML support
34
+ (https://github.com/AssetSync/asset_sync/pull/427)
35
+
36
+
37
+ ## [2.15.2] - 2022-06-02
38
+
39
+ ### Fixed
40
+
41
+ - Fix incorrect commented code in asset_sync.yml
42
+ (https://github.com/AssetSync/asset_sync/pull/426)
43
+
44
+
21
45
  ## [2.15.1] - 2021-11-22
22
46
 
23
47
  ### Changed
@@ -1038,7 +1062,10 @@ Changes:
1038
1062
  * Merge branch 'sinatra'
1039
1063
 
1040
1064
 
1041
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.15.1...HEAD
1065
+ [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.16.0...HEAD
1066
+ [2.16.0]: https://github.com/AssetSync/asset_sync/compare/v2.15.3...v2.16.0
1067
+ [2.15.3]: https://github.com/AssetSync/asset_sync/compare/v2.15.2...v2.15.3
1068
+ [2.15.2]: https://github.com/AssetSync/asset_sync/compare/v2.15.1...v2.15.2
1042
1069
  [2.15.1]: https://github.com/AssetSync/asset_sync/compare/v2.15.0...v2.15.1
1043
1070
  [2.15.0]: https://github.com/AssetSync/asset_sync/compare/v2.14.2...v2.15.0
1044
1071
  [2.14.2]: https://github.com/AssetSync/asset_sync/compare/v2.14.1...v2.14.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  [![Gem Version](https://img.shields.io/gem/v/asset_sync.svg?style=flat-square)](http://badge.fury.io/rb/asset_sync)
3
- [![Build Status](https://img.shields.io/travis/AssetSync/asset_sync.svg?style=flat-square)](http://travis-ci.org/AssetSync/asset_sync)
3
+ [![Tests](https://github.com/AssetSync/asset_sync/actions/workflows/tests.yaml/badge.svg)](https://github.com/AssetSync/asset_sync/actions/workflows/tests.yaml)
4
4
  [![Coverage Status](http://img.shields.io/coveralls/AssetSync/asset_sync.svg?style=flat-square)](https://coveralls.io/r/AssetSync/asset_sync)
5
5
 
6
6
 
@@ -275,6 +275,9 @@ AssetSync.configure do |config|
275
275
  # Path to cache file to skip scanning remote
276
276
  # config.remote_file_list_cache_file_path = './.asset_sync_remote_file_list_cache.json'
277
277
  #
278
+ # Path on remote storage to persist remote file list file
279
+ # config.remote_file_list_remote_path = '/remote/asset_sync_remote_file.json'
280
+ #
278
281
  # Fail silently. Useful for environments such as Heroku
279
282
  # config.fail_silently = true
280
283
  #
@@ -343,6 +346,10 @@ defaults: &defaults
343
346
  # always_upload: ['application.js', 'application.css', !ruby/regexp '/application-/\d{32}\.css/']
344
347
  # Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy.
345
348
  # ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/']
349
+ # Public path. To change the public directory.
350
+ # public_path: 'public'
351
+ # Prefix. To change the directory to sync relative to public_path.
352
+ # prefix: 'assets'
346
353
  # Allow custom assets to be cacheable. Note: The base filename will be matched
347
354
  # If you have an asset with name "app.0b1a4cd3.js", only "app.0b1a4cd3" will need to be matched
348
355
  # cache_asset_regexps: ['cache_me.js', !ruby/regexp '/cache_some\.\d{8}\.css/']
@@ -380,6 +387,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
380
387
  * **concurrent_uploads**: (`true, false`) when enabled, will upload the files in different Threads, this greatly improves the upload speed. **default:** `'false'`
381
388
  * **concurrent_uploads_max_threads**: when concurrent_uploads is enabled, this determines the number of threads that will be created. **default:** `10`
382
389
  * **remote_file_list_cache_file_path**: if present, use this path to cache remote file list to skip scanning remote **default:** `nil`
390
+ * **remote_file_list_remote_path**: if present, use this path to download remote file list file to cache file list in local to skip scanning remote. useful in container environment where you cannot maintain the local file, remote_file_list_cache_file_path also needed to make use of this option **default:** `nil`
383
391
  * **enabled**: (`true, false`) when false, will disable asset sync. **default:** `'true'` (enabled)
384
392
  * **ignored\_files**: an array of files to ignore e.g. `['ignore_me.js', %r(ignore_some/\d{32}\.css)]` Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy **default**: `[]`
385
393
  * **cache\_asset\_regexps**: an array of files to add cache headers e.g. `['cache_me.js', %r(cache_some\.\d{8}\.css)]` Useful if there are some files that are added to sprockets assets list and need to be set as 'Cacheable' on uploaded server. Only rails compiled regexp is matched internally **default**: `[]`
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "rcov", platforms: :mri_18, group: [:development, :test]
6
6
  gem "simplecov", platforms: [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], group: [:development, :test], require: false
7
7
  gem "jruby-openssl", platform: :jruby
8
- gem "rails", "~> 5.2.0"
8
+ gem "rails", "~> 7.0.0"
9
9
 
10
10
  gemspec path: "../"
@@ -28,6 +28,7 @@ module AssetSync
28
28
  attr_accessor :concurrent_uploads
29
29
  attr_accessor :concurrent_uploads_max_threads
30
30
  attr_accessor :remote_file_list_cache_file_path
31
+ attr_accessor :remote_file_list_remote_path
31
32
 
32
33
  # FOG configuration
33
34
  attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
@@ -107,6 +108,7 @@ module AssetSync
107
108
  self.concurrent_uploads = false
108
109
  self.concurrent_uploads_max_threads = 10
109
110
  self.remote_file_list_cache_file_path = nil
111
+ self.remote_file_list_remote_path = nil
110
112
  @additional_local_file_paths_procs = []
111
113
 
112
114
  load_yml! if defined?(::Rails) && yml_exists?
@@ -244,6 +246,7 @@ module AssetSync
244
246
  self.log_silently = yml["log_silently"] if yml.has_key?("log_silently")
245
247
  self.always_upload = yml["always_upload"] if yml.has_key?("always_upload")
246
248
  self.ignored_files = yml["ignored_files"] if yml.has_key?("ignored_files")
249
+ self.prefix = yml["prefix"] if yml.has_key?("prefix")
247
250
  self.custom_headers = yml["custom_headers"] if yml.has_key?("custom_headers")
248
251
  self.run_on_precompile = yml["run_on_precompile"] if yml.has_key?("run_on_precompile")
249
252
  self.invalidate = yml["invalidate"] if yml.has_key?("invalidate")
@@ -253,6 +256,7 @@ module AssetSync
253
256
  self.concurrent_uploads = yml['concurrent_uploads'] if yml.has_key?('concurrent_uploads')
254
257
  self.concurrent_uploads_max_threads = yml['concurrent_uploads_max_threads'] if yml.has_key?('concurrent_uploads_max_threads')
255
258
  self.remote_file_list_cache_file_path = yml['remote_file_list_cache_file_path'] if yml.has_key?('remote_file_list_cache_file_path')
259
+ self.remote_file_list_remote_path = yml['remote_file_list_remote_path'] if yml.has_key?('remote_file_list_remote_path')
256
260
 
257
261
  self.azure_storage_account_name = yml['azure_storage_account_name'] if yml.has_key?("azure_storage_account_name")
258
262
  self.azure_storage_access_key = yml['azure_storage_access_key'] if yml.has_key?("azure_storage_access_key")
@@ -44,21 +44,14 @@ module AssetSync
44
44
  config.enabled = (ENV['ASSET_SYNC_ENABLED'] == 'true') if ENV.has_key?('ASSET_SYNC_ENABLED')
45
45
 
46
46
  config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
47
-
48
47
  config.gzip_compression = (ENV['ASSET_SYNC_GZIP_COMPRESSION'] == 'true') if ENV.has_key?('ASSET_SYNC_GZIP_COMPRESSION')
49
48
  config.manifest = (ENV['ASSET_SYNC_MANIFEST'] == 'true') if ENV.has_key?('ASSET_SYNC_MANIFEST')
49
+ config.prefix = ENV['ASSET_SYNC_PREFIX'] if ENV.has_key?('ASSET_SYNC_PREFIX')
50
50
  config.include_manifest = (ENV['ASSET_SYNC_INCLUDE_MANIFEST'] == 'true') if ENV.has_key?('ASSET_SYNC_INCLUDE_MANIFEST')
51
51
  config.concurrent_uploads = (ENV['ASSET_SYNC_CONCURRENT_UPLOADS'] == 'true') if ENV.has_key?('ASSET_SYNC_CONCURRENT_UPLOADS')
52
52
  config.remote_file_list_cache_file_path = ENV['ASSET_SYNC_REMOTE_FILE_LIST_CACHE_FILE_PATH'] if ENV.has_key?('ASSET_SYNC_REMOTE_FILE_LIST_CACHE_FILE_PATH')
53
+ config.remote_file_list_remote_path = ENV['ASSET_SYNC_REMOTE_FILE_LIST_REMOTE_PATH'] if ENV.has_key?('ASSET_SYNC_REMOTE_FILE_LIST_REMOTE_PATH')
53
54
  end
54
-
55
- config.prefix = ENV['ASSET_SYNC_PREFIX'] if ENV.has_key?('ASSET_SYNC_PREFIX')
56
-
57
- config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
58
-
59
- config.gzip_compression = (ENV['ASSET_SYNC_GZIP_COMPRESSION'] == 'true') if ENV.has_key?('ASSET_SYNC_GZIP_COMPRESSION')
60
- config.manifest = (ENV['ASSET_SYNC_MANIFEST'] == 'true') if ENV.has_key?('ASSET_SYNC_MANIFEST')
61
-
62
55
  end
63
56
 
64
57
  if File.exist?( app_yaml )
@@ -47,6 +47,10 @@ module AssetSync
47
47
  self.config.remote_file_list_cache_file_path
48
48
  end
49
49
 
50
+ def remote_file_list_remote_path
51
+ self.config.remote_file_list_remote_path
52
+ end
53
+
50
54
  def ignored_files
51
55
  expand_file_names(self.config.ignored_files)
52
56
  end
@@ -72,6 +76,16 @@ module AssetSync
72
76
  return [] if ignore_existing_remote_files?
73
77
  return @remote_files if @remote_files
74
78
 
79
+ if remote_file_list_remote_path && remote_file_list_cache_file_path
80
+ log "Downloading file list file from remote"
81
+ remote_cache_file = bucket.files.get(remote_file_list_remote_path)
82
+ if remote_cache_file
83
+ File.open(remote_file_list_cache_file_path, 'w') do |local_file|
84
+ local_file.write(remote_cache_file.body)
85
+ end
86
+ end
87
+ end
88
+
75
89
  if remote_file_list_cache_file_path && File.file?(remote_file_list_cache_file_path)
76
90
  begin
77
91
  content = File.read(remote_file_list_cache_file_path)
@@ -94,6 +108,18 @@ module AssetSync
94
108
  end
95
109
  end
96
110
 
111
+ def update_remote_file_list_in_remote
112
+ return if ignore_existing_remote_files?
113
+ return unless remote_file_list_remote_path
114
+ return unless remote_file_list_cache_file_path
115
+ log "Updating file list file in remote"
116
+ remote_file = bucket.files.new({
117
+ :key => remote_file_list_remote_path,
118
+ :body => File.open(remote_file_list_cache_file_path)
119
+ })
120
+ remote_file.save
121
+ end
122
+
97
123
  def always_upload_files
98
124
  expand_file_names(self.config.always_upload) + get_manifest_path
99
125
  end
@@ -317,6 +343,7 @@ module AssetSync
317
343
  end
318
344
 
319
345
  update_remote_file_list_cache(local_files_to_upload)
346
+ update_remote_file_list_in_remote
320
347
  end
321
348
 
322
349
  def sync
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssetSync
4
- VERSION = "2.15.1"
4
+ VERSION = "2.16.0"
5
5
  end
@@ -81,6 +81,9 @@ if defined?(AssetSync)
81
81
  # Path to cache file to skip scanning remote
82
82
  # config.remote_file_list_cache_file_path = './.asset_sync_remote_file_list_cache.json'
83
83
  #
84
+ # Path on remote storage to persist remote file list file
85
+ # config.remote_file_list_remote_path = '/remote/asset_sync_remote_file.json'
86
+ #
84
87
  # Fail silently. Useful for environments such as Heroku
85
88
  # config.fail_silently = true
86
89
  #
@@ -19,7 +19,7 @@ defaults: &defaults
19
19
  # fog_host: "s3.amazonaws.com"
20
20
  #
21
21
  # Change port option in fog (only if you need to)
22
- # config.fog_port = "9000"
22
+ # fog_port: "9000"
23
23
  #
24
24
  # Use http instead of https. Default should be "https" (at least for fog-aws)
25
25
  # fog_scheme: "http"
@@ -53,7 +53,7 @@ defaults: &defaults
53
53
  # Set `public` option when uploading file depending on value,
54
54
  # Setting to "default" makes asset sync skip setting the option
55
55
  # Possible values: true, false, "default" (default: true)
56
- # config.fog_public = true
56
+ # fog_public: "true"
57
57
 
58
58
  existing_remote_files: keep
59
59
  # To delete existing remote files.
@@ -94,6 +94,10 @@ describe AssetSync do
94
94
  it "should default asset_regexps to empty array" do
95
95
  expect(AssetSync.config.cache_asset_regexps).to eq([])
96
96
  end
97
+
98
+ it "should default remote_file_list_remote_path to nil" do
99
+ expect(AssetSync.config.remote_file_list_remote_path).to be_nil
100
+ end
97
101
  end
98
102
 
99
103
  describe 'from yml' do
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.1
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Hamilton
8
8
  - David Rice
9
9
  - Phil McClure
10
10
  - Toby Osbourn
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-11-22 00:00:00.000000000 Z
14
+ date: 2022-08-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -232,9 +232,9 @@ files:
232
232
  - UPGRADING.md
233
233
  - asset_sync.gemspec
234
234
  - docs/heroku.md
235
- - gemfiles/rails_5_2.gemfile
236
235
  - gemfiles/rails_6_0.gemfile
237
236
  - gemfiles/rails_6_1.gemfile
237
+ - gemfiles/rails_7_0.gemfile
238
238
  - lib/asset_sync.rb
239
239
  - lib/asset_sync/asset_sync.rb
240
240
  - lib/asset_sync/config.rb
@@ -272,7 +272,7 @@ homepage: https://github.com/rumblelabs/asset_sync
272
272
  licenses:
273
273
  - MIT
274
274
  metadata: {}
275
- post_install_message:
275
+ post_install_message:
276
276
  rdoc_options: []
277
277
  require_paths:
278
278
  - lib
@@ -287,8 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  - !ruby/object:Gem::Version
288
288
  version: '0'
289
289
  requirements: []
290
- rubygems_version: 3.2.31
291
- signing_key:
290
+ rubygems_version: 3.3.17
291
+ signing_key:
292
292
  specification_version: 4
293
293
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
294
294
  Rackspace Cloudfiles