Skip to content

Commit

Permalink
version upgrade works now with internal version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaschn committed Jun 16, 2016
1 parent 2a21179 commit 5d02dcc
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/Algernon.package/ALGInstallation.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
An ALGInstallation is a singleton storing the current version of Algernon allowing to upgrade to new versions.

Instance Variables
versionNumber: aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
instance
^ Instance ifNil: [ Instance := ALGInstallation new ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
accessing
cleanup
| isActive |
isActive := Algernon activateAlgernon.
ALGCache allInstancesDo: [ :cache | cache clear].
ALGItemProvider initializeItems.
Algernon allInstancesDo: [ :algernon | algernon delete].
ALGCore allInstancesDo: [ :algernon | algernon delete].
Smalltalk garbageCollect.
Algernon activateAlgernon: isActive
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
accessing
exportAsSarArchive

| package |
package := 'Algernon'.
(UserDialogBoxMorph
confirm: 'Do you have incremented the versionNumber of ', package,
' before you release a new version?')
ifTrue: [ self sarFromPackage: package ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
initialize
self versionNumber: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
latestVersion
^ 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
accessing
sarFromPackage: package
| mczStream version workingCopy zip |

zip := ZipArchive new.
mczStream := RWBinaryOrTextStream on: (String new: 10000).
workingCopy := MCWorkingCopy forPackage: (MCPackage new name: package).
version := workingCopy newVersion.
version fileOutOn: mczStream.
(zip addString: mczStream contents as: package , '.mcz') desiredCompressionLevel: 0.
zip addString: 'self fileInMonticelloZipVersionNamed:
''' , package , '.mcz''.' as: 'install/preamble'.
zip addString: 'ALGInstallation instance upgrade.' as: 'install/postscript'.
zip writeToFileNamed: package , '.sar'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
upgrade
self latestVersion > self versionNumber
ifTrue: [ self cleanup.
self versionNumber: self latestVersion ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
versionNumber: aNumber
versionNumber := aNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
versionNumber
^ versionNumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"class" : {
"instance" : "JS 6/16/2016 18:53" },
"instance" : {
"cleanup" : "JS 6/16/2016 18:57",
"exportAsSarArchive" : "JS 6/16/2016 20:00",
"initialize" : "JS 6/16/2016 18:45",
"latestVersion" : "JS 6/16/2016 19:28",
"sarFromPackage:" : "JS 6/16/2016 19:58",
"upgrade" : "JS 6/16/2016 19:16",
"versionNumber" : "JS 6/16/2016 18:17",
"versionNumber:" : "JS 6/16/2016 18:17" } }
14 changes: 14 additions & 0 deletions packages/Algernon.package/ALGInstallation.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Algernon",
"classinstvars" : [
],
"classvars" : [
"Instance" ],
"commentStamp" : "JS 6/16/2016 18:19",
"instvars" : [
"versionNumber" ],
"name" : "ALGInstallation",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
2 changes: 1 addition & 1 deletion packages/Algernon.package/monticello.meta/version

Large diffs are not rendered by default.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
testing
testUpgrade

| installation |
installation := ALGInstallation new.
installation versionNumber: installation latestVersion - 1.
installation upgrade.
self assert: installation versionNumber equals: installation latestVersion
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"testUpgrade" : "JS 6/16/2016 19:37" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "AlgernonTests",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "ALGTestInstallation",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
2 changes: 1 addition & 1 deletion packages/AlgernonTests.package/monticello.meta/version

Large diffs are not rendered by default.

0 comments on commit 5d02dcc

Please sign in to comment.