js_from_routes 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/js_from_routes/generator.rb +7 -2
- data/lib/js_from_routes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db1718354ae9ce8148221f6cb5331398809cb684450cf1d88d43636f5b2f0c40
|
4
|
+
data.tar.gz: d883f5e22c950ed87481ac9d8d1fca08ef669c5fe56b7fd51cc48124d9640077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 319b235a6fcc6bf8564517486de5fb9790fc5076fa0b3030b711eb49ea058c5ba877fc7b8a217976f9556cd330c8f78114e5a2361a11367536d25fad233ef013
|
7
|
+
data.tar.gz: 8ec656121b7a10bb0123ede54409a5327d215124d6fdd11f38f5aad34d1f56e0e982dc5139cada10a978037d6fe0767ed94ef1abdcdded1d61d104438a12ff9f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [2.0.3](https://github.com/ElMassimo/js_from_routes/compare/js_from_routes@2.0.2...js_from_routes@2.0.3) (2021-03-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* Ensure changing the client library triggers code generation ([6cf2bdf](https://github.com/ElMassimo/js_from_routes/commit/6cf2bdf4896dafe0d1e80668551665c46bfcadc6))
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* Allow passing JS_FROM_ROUTES_FORCE=true to ignore cache keys ([8a6d2a8](https://github.com/ElMassimo/js_from_routes/commit/8a6d2a807e0a9926c6b24e1fc9127f917ec0ed5d))
|
12
|
+
|
13
|
+
|
14
|
+
|
1
15
|
## [2.0.2](https://github.com/ElMassimo/js_from_routes/compare/js_from_routes@2.0.1...js_from_routes@2.0.2) (2021-03-14)
|
2
16
|
|
3
17
|
### Improvements
|
@@ -44,7 +44,7 @@ module JsFromRoutes
|
|
44
44
|
# Public: Used to check whether the file should be generated again, changes
|
45
45
|
# based on the configuration, and route definition.
|
46
46
|
def cache_key
|
47
|
-
routes.map(&:inspect).join + [File.read(@config.template_path), @config.helper_mappings.inspect].join
|
47
|
+
routes.map(&:inspect).join + [File.read(@config.template_path), @config.helper_mappings.inspect, @config.client_library].join
|
48
48
|
end
|
49
49
|
|
50
50
|
# Public: Exposes the preferred import library to the generator.
|
@@ -126,6 +126,11 @@ module JsFromRoutes
|
|
126
126
|
object.instance_eval(@compiled_template)
|
127
127
|
end
|
128
128
|
|
129
|
+
# Internal: Returns true if the cache key has changed since the last codegen.
|
130
|
+
def stale?(file, cache_key_comment)
|
131
|
+
ENV["JS_FROM_ROUTES_FORCE"] || file.gets != cache_key_comment
|
132
|
+
end
|
133
|
+
|
129
134
|
# Internal: Writes if the file does not exist or the cache key has changed.
|
130
135
|
# The cache strategy consists of a comment on the first line of the file.
|
131
136
|
#
|
@@ -134,7 +139,7 @@ module JsFromRoutes
|
|
134
139
|
FileUtils.mkdir_p(name.dirname)
|
135
140
|
cache_key_comment = "// JsFromRoutes CacheKey #{Digest::MD5.hexdigest(cache_key)}\n"
|
136
141
|
File.open(name, "a+") { |file|
|
137
|
-
if file
|
142
|
+
if stale?(file, cache_key_comment)
|
138
143
|
file.truncate(0)
|
139
144
|
file.write(cache_key_comment)
|
140
145
|
file.write(yield)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_from_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Máximo Mussini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|