Created
April 19, 2015 03:59
-
-
Save scztt/dda6df4046a5311f48f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Quarks.directory.keysValuesDo { | |
|quarkName, path| | |
var quark, tags, deps, expectedMatches, depData; | |
Quarks.clear(); | |
quark = Quark(quarkName); | |
quark.checkout(); | |
tags = quark.tags ++ ["HEAD"]; | |
tags.do { | |
|tag| | |
quark = Quark(quarkName, tag); | |
quark.checkout(); | |
"Checked out: %@% (tag: %)".format(quarkName, quark.version, tag).postln; | |
if (quark.name != quarkName) { | |
"WARNING: directory name (%) != quark.name (%)".format(quarkName, quark.data["name"]).postln; | |
}; | |
if ((tag != "HEAD") && (tag.asString != quark.version.asString)) { | |
"WARNING: tag % doesn't match reported version %".format(tag, quark.version); | |
}; | |
deps = quark.dependencies; | |
if (deps.size != quark.data["dependencies"].size) { | |
"WARNING: Failed to handle some dependencies! needed: %, got:%".format( | |
quark.data["dependencies"], | |
deps | |
).postln; | |
}; | |
expectedMatches = List(); | |
deps.do { | |
|dep| | |
try { | |
depData = dep.data; | |
} {|e| e.postln }; | |
if (depData.isNil) { | |
"WARNING: No data found for dependency: %".format(dep).postln; | |
} { | |
expectedMatches.add(dep); | |
" % ---> %@%".format("?", dep.name, dep.version).postln; | |
} | |
}; | |
Quarks.clear(); | |
try { | |
quark.install(); | |
if (quark.isInstalled().not) { | |
Error().throw; // install failed, jump to catch | |
}; | |
if (expectedMatches.notEmpty) { | |
" ([%] should contain [%] after install)".format( | |
Quarks.installed.join(", "), | |
expectedMatches.join(", ") | |
).postln; | |
}; | |
Quarks.installed.do { | |
|installed| | |
var expectedMatch = expectedMatches.detect({ |m| | |
m.name == installed.name | |
}); | |
if (expectedMatch.isNil) { | |
// this is okay, just an additional dep installed | |
} { | |
if (expectedMatch.version == installed.version) { | |
expectedMatches.remove(expectedMatch); | |
} { | |
"WARNING: Expected version %, actually installed version %".format(expectedMatch.version, installed.version).postln; | |
}; | |
}; | |
}; | |
expectedMatches.do { | |
|expected| | |
"WARNING: Expected quark % to be installed, but it was not".format(expected).postln; | |
} | |
} { | |
"WARNING: Quark % failed to install.".format(quark.name); | |
}; | |
Quarks.clear(); | |
0.0001.wait; | |
} | |
} | |
}.fork; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment