vite_ruby 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b78a801ecceb4a2206fc1429bb297344b8cfa473eb8e54dd2f1e3646444df30
4
- data.tar.gz: 1630116f09c64c025bedbc3d1623c67c30c8ab5dbe0020d5ebe94b7f0c6be162
3
+ metadata.gz: 92002c0637f3091425c9ee24948c46105bf8ac61d2350dec3479f09e3e94d4ec
4
+ data.tar.gz: 3e7f52fcb96735c8ec3a68618e7e7273a2abcdf81c1ba84be6b1d2f55cb41f0e
5
5
  SHA512:
6
- metadata.gz: 358fb53657d931fea67da39cd2faca5914b7c0787f75125621a7fc92190a8e02e83c71cfbc41e653380c4dd4ace434b45f85b8cbd1d80a8cd9698007585573c7
7
- data.tar.gz: e767487d9d16afb62d5dc3bcaac4409972b44dea3933b0e75d4fe1344c31d9995dd12b1539fa3d60082053254f63ae943320d02e72304877da15d731ffd24ad4
6
+ metadata.gz: ab1d9e7b5270d3de5d887da7a8d13659c742ea4df871c2e36c02d5de722b9847a5bc14cd20d72ad969a0f79cae053b92dd7015353086c68721dcdd643af61997
7
+ data.tar.gz: ad906908aabe2d5fba3f0677ffc847fa59008ff186e62135f86b8ad0982727e55cd9a83ef4c7fa075a169c51411efdff8c7a03c78d1cceb52b91316924d47c2d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.1.2](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.1.1...vite_ruby@1.1.2) (2021-03-19)
2
+
3
+
4
+ ### Features
5
+
6
+ * Automatically retry failed builds after a certain time ([cbb3058](https://github.com/ElMassimo/vite_ruby/commit/cbb305863a49c46e7a0d95c773f56f7d822d01d9))
7
+
8
+
9
+
1
10
  ## [1.1.1](https://github.com/ElMassimo/vite_ruby/compare/vite_ruby@1.1.0...vite_ruby@1.1.1) (2021-03-19)
2
11
 
3
12
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'time'
4
+
3
5
  # Internal: Value object with information about the last build.
4
6
  ViteRuby::Build = Struct.new(:success, :timestamp, :digest, :current_digest) do
5
7
  # Internal: Combines information from a previous build with the current digest.
@@ -7,16 +9,26 @@ ViteRuby::Build = Struct.new(:success, :timestamp, :digest, :current_digest) do
7
9
  new(attrs['success'], attrs['timestamp'] || 'never', attrs['digest'] || 'none', current_digest)
8
10
  end
9
11
 
10
- # Internal: Returns true if watched files have changed since the last build.
12
+ # Internal: A build is considered stale when watched files have changed since
13
+ # the last build, or when a certain time has ellapsed in case of failure.
11
14
  def stale?
12
- digest != current_digest
15
+ digest != current_digest || retry_failed?
13
16
  end
14
17
 
15
- # Internal: Returns true if watched files have not changed since the last build.
18
+ # Internal: A build is considered fresh if watched files have not changed, or
19
+ # the last failed build happened recently.
16
20
  def fresh?
17
21
  !stale?
18
22
  end
19
23
 
24
+ # Internal: To avoid cascading build failures, if the last build failed and it
25
+ # happened within a short time window, a new build should not be triggered.
26
+ def retry_failed?
27
+ !success && Time.parse(timestamp) + 3 < Time.now # 3 seconds
28
+ rescue ArgumentError
29
+ true
30
+ end
31
+
20
32
  # Internal: Returns a new build with the specified result.
21
33
  def with_result(success)
22
34
  self.class.new(success, Time.now.strftime('%F %T'), current_digest)
@@ -157,14 +157,14 @@ private
157
157
  end
158
158
 
159
159
  def possible_causes(last_build)
160
- return FAILED_BUILD_CAUSES if last_build.success == false
160
+ return FAILED_BUILD_CAUSES.sub(':mode', ViteRuby.mode) if last_build.success == false
161
161
  return DEFAULT_CAUSES if config.auto_build
162
162
 
163
163
  DEFAULT_CAUSES + NO_AUTO_BUILD_CAUSES
164
164
  end
165
165
 
166
166
  FAILED_BUILD_CAUSES = <<-MSG
167
- - The last build failed. Try running `bin/vite build --force` manually and check for errors.
167
+ - The last build failed. Try running `RACK_ENV=:mode bin/vite build --force` manually and check for errors.
168
168
  MSG
169
169
 
170
170
  DEFAULT_CAUSES = <<-MSG
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViteRuby
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vite_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Máximo Mussini
@@ -233,8 +233,8 @@ homepage: https://github.com/ElMassimo/vite_ruby
233
233
  licenses:
234
234
  - MIT
235
235
  metadata:
236
- source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.1.1/vite_ruby
237
- changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.1.1/vite_ruby/CHANGELOG.md
236
+ source_code_uri: https://github.com/ElMassimo/vite_ruby/tree/vite_ruby@1.1.2/vite_ruby
237
+ changelog_uri: https://github.com/ElMassimo/vite_ruby/blob/vite_ruby@1.1.2/vite_ruby/CHANGELOG.md
238
238
  post_install_message:
239
239
  rdoc_options: []
240
240
  require_paths: