@repokit/core 3.0.5 → 3.0.7
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.
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
package/installation/install.sh
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
CURRENT_VERSION="3.0.
|
|
1
|
+
CURRENT_VERSION="3.0.7"
|
|
2
2
|
CWD=$(pwd)
|
|
3
3
|
|
|
4
4
|
REPLACEMENT="/node_modules"
|
|
@@ -31,36 +31,47 @@ ROOT_COMMIT=$(git rev-list --parents HEAD | tail -1) || ROOT_COMMIT=""
|
|
|
31
31
|
|
|
32
32
|
cd
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
NEW_SETTINGS_FILE=".
|
|
37
|
-
|
|
34
|
+
CACHE_FILE=".repokit";
|
|
35
|
+
CACHE_DIRECTORY=".repokit_cache";
|
|
36
|
+
NEW_SETTINGS_FILE=".settings"
|
|
37
|
+
NEW_VERSION_FILE=".version"
|
|
38
|
+
REPO_CACHE_DIRECTORY="$CACHE_DIRECTORY/$ROOT_COMMIT"
|
|
39
|
+
LAST_THEME_USED=""
|
|
40
|
+
NEW_CACHE_PATH_VERSION="$CURRENT_VERSION"
|
|
41
|
+
BACK_PORTING=0
|
|
42
|
+
|
|
43
|
+
if [ -n "$ROOT_COMMIT" ] && [ -f "$REPO_CACHE_DIRECTORY/$NEW_SETTINGS_FILE" ]; then
|
|
44
|
+
BACK_PORTING=1
|
|
45
|
+
cd "$REPO_CACHE_DIRECTORY"
|
|
46
|
+
read -r LAST_THEME_USED < "$NEW_SETTINGS_FILE"
|
|
47
|
+
rm "$NEW_SETTINGS_FILE"
|
|
48
|
+
cd
|
|
49
|
+
fi
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
if [ -f "$CACHE_DIRECTORY/$NEW_VERSION_FILE" ]; then
|
|
52
|
+
read -r NEW_CACHE_PATH_VERSION < "$CACHE_DIRECTORY/$NEW_VERSION_FILE"
|
|
53
|
+
fi
|
|
40
54
|
|
|
41
|
-
if [ -
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
rm -rf "$CACHE_FILE_OR_DIRECTORY"
|
|
48
|
-
elif [ -f "$CACHE_FILE_OR_DIRECTORY" ]; then
|
|
49
|
-
read -r PREVIOUS_VERSION < "$CACHE_FILE_OR_DIRECTORY"
|
|
50
|
-
if [ "$PREVIOUS_VERSION" == "$CURRENT_VERSION" ]; then
|
|
51
|
-
exit 0;
|
|
55
|
+
if [ ! -f "$CACHE_FILE" ]; then
|
|
56
|
+
touch "$CACHE_FILE"
|
|
57
|
+
elif [ "$BACK_PORTING" == 0 ]; then
|
|
58
|
+
read -r LAST_VERSION_USED < "$CACHE_FILE"
|
|
59
|
+
if [ "$LAST_VERSION_USED" == "$CURRENT_VERSION" ] && [ "$LAST_VERSION_USED" == "$NEW_CACHE_PATH_VERSION" ]; then
|
|
60
|
+
exit 0
|
|
52
61
|
fi
|
|
53
62
|
fi
|
|
54
63
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
printf "$CURRENT_VERSION\n$CACHED_THEME\n" > "$CACHE_FILE_OR_DIRECTORY"
|
|
59
|
-
else
|
|
64
|
+
if [ -n "$LAST_THEME_USED" ]; then
|
|
65
|
+
echo "$CURRENT_VERSION\n$LAST_THEME_USED\n" > "$CACHE_FILE"
|
|
66
|
+
else
|
|
60
67
|
TEMP_FILE=".repokit_tmp";
|
|
61
68
|
printf "$CURRENT_VERSION\n" > "$TEMP_FILE"
|
|
62
|
-
tail +2 "$
|
|
63
|
-
mv "$TEMP_FILE" "$
|
|
69
|
+
tail +2 "$CACHE_FILE" >> "$TEMP_FILE"
|
|
70
|
+
mv "$TEMP_FILE" "$CACHE_FILE"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [ -f "$CACHE_DIRECTORY/$NEW_VERSION_FILE" ]; then
|
|
74
|
+
echo "$CURRENT_VERSION\n" > "$CACHE_DIRECTORY/$NEW_VERSION_FILE"
|
|
64
75
|
fi
|
|
65
76
|
|
|
66
77
|
|
|
@@ -292,17 +292,30 @@ impl InternalFileSystem {
|
|
|
292
292
|
|
|
293
293
|
pub fn runtime_repokit_version() -> Option<String> {
|
|
294
294
|
if let Some(home) = InternalFileSystem::home() {
|
|
295
|
-
let
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
295
|
+
let path = home.join(".repokit");
|
|
296
|
+
return InternalFileSystem::get_version_at_path(&path);
|
|
297
|
+
}
|
|
298
|
+
None
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
pub fn new_cache_path_version() -> Option<String> {
|
|
302
|
+
if let Some(home) = InternalFileSystem::home() {
|
|
303
|
+
let path = home.join(".repokit_cache/.version");
|
|
304
|
+
if (&*path).exists() && path.is_file() {
|
|
305
|
+
return InternalFileSystem::get_version_at_path(&path);
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
308
|
None
|
|
307
309
|
}
|
|
310
|
+
|
|
311
|
+
fn get_version_at_path(path: &PathBuf) -> Option<String> {
|
|
312
|
+
let version = Executor::exec(
|
|
313
|
+
format!("head -n 1 {}", path.normalize().to_str().unwrap()),
|
|
314
|
+
|cmd| cmd,
|
|
315
|
+
);
|
|
316
|
+
if VERSION_REGEX.is_match(&version) {
|
|
317
|
+
return Some(version);
|
|
318
|
+
}
|
|
319
|
+
None
|
|
320
|
+
}
|
|
308
321
|
}
|
|
@@ -34,12 +34,15 @@ impl RuntimeCompiler {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
fn with_version_mismatch(root: &str, func: impl Fn(&str, InternalFileSystem)) {
|
|
37
|
-
let scoped_fs = InternalFileSystem::new(root);
|
|
38
|
-
if let Some(installed_version) = scoped_fs.installed_repokit_version()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
let scoped_fs: InternalFileSystem = InternalFileSystem::new(root);
|
|
38
|
+
if let Some(installed_version) = scoped_fs.installed_repokit_version() {
|
|
39
|
+
let runtime_version = InternalFileSystem::runtime_repokit_version();
|
|
40
|
+
let new_cache_path_version = InternalFileSystem::new_cache_path_version();
|
|
41
|
+
if runtime_version.is_some_and(|value| value != installed_version)
|
|
42
|
+
|| new_cache_path_version.is_some_and(|value| value != installed_version)
|
|
43
|
+
{
|
|
44
|
+
func(&installed_version, scoped_fs);
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
48
|
|