Skip to content

Commit 8ab51df

Browse files
author
flip phillips
committed
Automated paclet updating, renaming Info
1 parent 2a6a002 commit 8ab51df

File tree

6 files changed

+48
-23
lines changed

6 files changed

+48
-23
lines changed

Development/Paclets.nb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:05bbeb32a68fbd95d624e9d962369541485671bb1f0f8346f4ce28e2f8efc7dd
3-
size 43274
2+
oid sha256:bd934c64f09918c58f51e9ad992b3eb47dbfe90a77fa00ac2c9a5ea6a4d80d3c
3+
size 58707

FPTools/PacletInfo.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Publisher -> "Skidmore Vision Lab",
66
Copyright -> "©2018- Flip Phillips & Misc Contributors",
77
License -> "MIT",
8-
Version -> "0.1.5",
9-
BuildNumber -> "21",
8+
Version -> "0.1.7",
9+
BuildNumber -> "35",
1010
MathematicaVersion -> "11.2+",
1111
URL -> "https://github.com/flipphillips/FPTools",
1212
Thumbnail -> "Documentation/icon.png",
@@ -27,8 +27,11 @@
2727

2828
"FPTools`ApplyIf",
2929

30-
"FPTools`FPVersionInfo","FPTools`FPVersionString","FPTools`FPWriteVersionInfo","FPTools`FPVersionBumpBuild"
30+
"FPTools`FPVersionInformation",
31+
"FPTools`FPVersionString","FPTools`FPBuildString",
32+
"FPTools`FPWriteVersionInformation","FPTools`FPVersionBumpBuild",
33+
"FPTools`UpdatePacletFile"
3134
},
3235
Context -> {"FPTools`"} }
3336
}
34-
]
37+
]

FPTools/Usage.wl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ ApplyIf::usage = "ApplyIf[f,g,x] applies g to x if f[x] is True.";
2424

2525

2626
(* Versioning *)
27-
FPVersionInfo::usage = "FPVersionInfo[path] gives an association with my primitive home grown versioning system.";
27+
FPVersionInformation::usage = "FPVersionInformation[path] gives an association with my primitive home grown versioning system.";
2828
FPVersionString::usage = "FPVersionString[path] returns the current build as a string. the option \"Build->True\" adds the build number to the end of the string.";
29-
FPWriteVersionInfo::usage = "FPWriteVersionInfo[path,vi] takes a version information structure and writes it out. At this point it doesn't validate its structure.";
29+
FPWriteVersionInformation::usage = "FPWriteVersionInformation[path,vi] takes a version information structure and writes it out. At this point it doesn't validate its structure.";
3030
FPVersionBumpBuild::usage = "FPVersionBumpBuild[path] updates the build number in the version json file.";
31+
FPBuildString::usage = "FPBuildString[path] returns the current build number as a string.";
32+
33+
UpdatePacletFile::usage = "UpdatePacletFile[ppath,vpath] writes a new PacletInfo file based on the current version and build in the FP version.json system."

FPTools/Versioning.wl

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
$versioningFile = "version.json";
44

5-
FPVersionInfo[path_] := Module[{vp},
5+
FPVersionInformation[path_] := Module[{vp},
66
vp = FileNameJoin[{path, $versioningFile}];
77
If[FileExistsQ[vp],
88
Association[Import[vp]],
9-
{}]]
9+
None]]
1010

1111
FPVersionString[path_, OptionsPattern[{"Build" -> False}]] :=
1212
Module[{vi, vs},
13-
vi = FPVersionInfo[path];
13+
vi = FPVersionInformation[path];
1414
If[vi === None, Return[""]];
1515

1616
vs = StringJoin[
@@ -22,14 +22,32 @@ FPVersionString[path_, OptionsPattern[{"Build" -> False}]] :=
2222
vs <> " build " <> ToString[vi["build_number"]],
2323
vs]]
2424

25-
FPWriteVersionInfo[path_, vi_] := Module[{vp, vvi = vi},
25+
FPBuildString[path_] :=
26+
Module[{vi},
27+
vi = FPVersionInformation[path];
28+
If[vi === None, "",ToString[vi["build_number"]]]
29+
]
30+
31+
FPWriteVersionInformation[path_, vi_] := Module[{vp, vvi = vi},
2632
vp = FileNameJoin[{path, $versioningFile}];
2733
If[FileExistsQ[vp], DeleteFile[vp]];
2834
vvi["date"] = DateString[];
2935
Export[vp, vvi]]
3036

3137
FPVersionBumpBuild[path_] := Module[{vi},
32-
vi = FPVersionInfo[path];
38+
vi = FPVersionInformation[path];
3339
If[vi === None, Return[{}]];
3440
vi["build_number"] += 1;
35-
FPWriteVersionInfo[path, vi]]
41+
FPWriteVersionInformation[path, vi]]
42+
43+
UpdatePacletFile[ppath_, vpath_] := Module[{peepee, fn},
44+
fn = FileNameJoin[{ppath, "PacletInfo.m"}];
45+
46+
peepee = Import[fn, "Text"];
47+
48+
Export[fn,
49+
StringReplace[peepee,
50+
{RegularExpression["(?m)^(\\s*)Version\\s*->\\s*\"(.*)\""] ->
51+
"$1Version -> \"" <> FPVersionString[vpath] <> "\"",
52+
RegularExpression["(?m)^(\\s*)BuildNumber\\s*->\\s*\"(.*)\""] ->
53+
"$1BuildNumber -> \"" <> FPBuildString[vpath] <> "\""}], "Text"]]

build.wls

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
#!/usr/bin/env wolframscript
22

3-
Print[];
43
(* directory = DirectoryName[$InputFileName]; *)
54
directory = Directory[];
5+
pacletDirectory = FileNameJoin[{directory, "FPTools"}];
6+
7+
Print["Building from: ", directory];
8+
69
FPVersionBumpBuild[directory];
710

8-
Print["Using directory: ", directory];
911
files = FileNames["*.paclet", directory];
1012
Print["Found paclets (to be deleted): ", files];
1113
DeleteFile /@ files;
14+
1215
Print["Building new paclet"];
13-
paclet = PackPaclet[FileNameJoin[{directory, "FPTools"}]];
16+
UpdatePacletFile[pacletDirectory,directory];
17+
paclet = PackPaclet[pacletDirectory];
1418
Print["New paclet: ", paclet];
1519

1620
Print[];
@@ -21,9 +25,6 @@ Print["Found the following old paclets (uninstalling): ", Map[ #["Location"]&, p
2125
Map[ PacletUninstall, paclets ];
2226

2327
(* install new version *)
24-
(* directory = DirectoryName[$InputFileName]; *)
25-
directory=Directory[];
26-
Print["Using directory: ", directory];
2728
files = FileNames["*.paclet", directory];
2829
Print["Paclet file(s) found: ", files];
2930
paclet = Last @ Sort @ files;

version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "FPTools",
33
"major_version": 0,
44
"minor_version": 1,
5-
"revision_number": 5,
6-
"build_number": 29,
7-
"date": "Thu Mar 15 19:43:10 EDT 2018"
5+
"revision_number": 7,
6+
"build_number": 36,
7+
"date": "Thu Mar 15 23:30:57 EDT 2018"
88
}

0 commit comments

Comments
 (0)