asset_sync 2.15.3 → 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: bd0deada18130ef42d80d6f05d5ff0611a7587dd33d177bbc38641e6b6cad3a9
4
- data.tar.gz: cd514b4901f6a3859a00b80282139d9d712db8414ed03ab115de2c7a3dfd3c78
3
+ metadata.gz: b1cd4cc5ab6aa00a60de8cad39bd290f99e10f9c3884798af6dec1a495b5b722
4
+ data.tar.gz: 06ca40f184d5d79ebe6aa54437a4e72f0a4e4841d944d58e77b742648d24e748
5
5
  SHA512:
6
- metadata.gz: eb9cabad00c3dfd61c1ca47c3ba9d6a768375d3dcd6a6798e97a55cc91ee1dd5a030ebd85eeab1f2018dbcc6e6ea18f43591f09bc02f2cd0558a361a13efafb9
7
- data.tar.gz: 0c13d03567e9773383179cdfda43699e70352a0ec20c7a7c980017f32b6164eb89e4a4957e6480f1ee1a6a5cc41e270f75bcc0d5fa0dd92363129e0f227c76c7
6
+ metadata.gz: 7740b76eee405aba383ab9c8efdf54491288cd172b6f0d02a996b03b94b8b73685d579402bc8aa2af02993f0048b5aa6680944c1c34a3d9dca80b333af5e4484
7
+ data.tar.gz: e73762db4dcd2b3b41acac66dcb12f731d578edc269a1ea0e0b8105a432fd9ea9ef487a4a8d755ff25927fd4eee6d056fb4a0693739eb94a9e07b0eb0f974a7c
data/CHANGELOG.md CHANGED
@@ -18,6 +18,14 @@ 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
+
21
29
  ## [2.15.3] - 2022-08-25
22
30
 
23
31
  ### Fixed
@@ -1054,7 +1062,8 @@ Changes:
1054
1062
  * Merge branch 'sinatra'
1055
1063
 
1056
1064
 
1057
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.15.3...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
1058
1067
  [2.15.3]: https://github.com/AssetSync/asset_sync/compare/v2.15.2...v2.15.3
1059
1068
  [2.15.2]: https://github.com/AssetSync/asset_sync/compare/v2.15.1...v2.15.2
1060
1069
  [2.15.1]: https://github.com/AssetSync/asset_sync/compare/v2.15.0...v2.15.1
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
  #
@@ -384,6 +387,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
384
387
  * **concurrent_uploads**: (`true, false`) when enabled, will upload the files in different Threads, this greatly improves the upload speed. **default:** `'false'`
385
388
  * **concurrent_uploads_max_threads**: when concurrent_uploads is enabled, this determines the number of threads that will be created. **default:** `10`
386
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`
387
391
  * **enabled**: (`true, false`) when false, will disable asset sync. **default:** `'true'` (enabled)
388
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**: `[]`
389
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**: `[]`
@@ -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?
@@ -254,6 +256,7 @@ module AssetSync
254
256
  self.concurrent_uploads = yml['concurrent_uploads'] if yml.has_key?('concurrent_uploads')
255
257
  self.concurrent_uploads_max_threads = yml['concurrent_uploads_max_threads'] if yml.has_key?('concurrent_uploads_max_threads')
256
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')
257
260
 
258
261
  self.azure_storage_account_name = yml['azure_storage_account_name'] if yml.has_key?("azure_storage_account_name")
259
262
  self.azure_storage_access_key = yml['azure_storage_access_key'] if yml.has_key?("azure_storage_access_key")
@@ -50,6 +50,7 @@ module AssetSync
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
  end
55
56
 
@@ -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.3"
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
  #
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.3
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Hamilton
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-08-25 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