I've prototyped a package downloading system (Mapt) that supports multiple versions, and will show its basic functionality below. Does it work? would you use it? what needs to change? what else would you want it to do? what packages do you want? do you want to work on this project together? do you have an alternative way of doing this?
Load Mapt:
Get[ "http://mfvonh.me/mapt" ] ;
??Mapt
It is not yet installed locally:
Mapt[ Path ]
None
It can be installed anywhere in $Path
.
Mapt[ Install ]
True
Then it can be loaded with Needs[ "Mapt`" ] if it is not in an Autoload folder:
FindFile[ "Mapt`" ]
D:\Program Files\Wolfram Research\Mathematica\9.0\AddOns\Autoload\Mapt\init.m
These are the available packages:
Mapt[ List ]
{"HelloWorld", "LevelScheme"}
And basic installation:
Mapt[ Get , "HelloWorld" ]
True
Packages can then be loaded like this:
Needs["HelloWorld`Current`"]
??HelloWorld
All available versions of a package can be listed:
Mapt[ VersionNumber , "HelloWorld" , All ]
{1.0, 1.1}
A specific version can be installed:
Mapt[ Get , "HelloWorld" , "1.0" ]
True
Multiple versions can be on the disk:
Needs[ "HelloWorld`Version1$0`" ]
??HelloWorld
A more complex package:
Mapt[ Get , "LevelScheme" ]
Fetching LevelScheme...
Extracting...
Initializing...
Done
Needs[ "LevelScheme`Current`" ]
Figure[{
SetOptions[Lev, Thickness -> 3, Color -> Red],
SetOptions[Trans, ArrowType -> ShapeArrow, FillColor -> LightGray],
Lev[lev1, 0, 2, 0],
Lev[lev2, 1, 2, 100],
Lev[lev3, 0, 2, 200],
Trans[lev2, 0.5, lev1, 0.9, Width -> 10],
Trans[lev3, 0.5, lev1, 0.5, Width -> 20]},
PlotRange -> {{0, 2}, {-10, 210}},
ImageSize -> 72*{3, 3}]
To install the package Mapt creates a temporary directory, sets it, and then just pulls a small script:
Import[Mapt[Path,"Mapt-Packages"]<>"LevelScheme/install-LevelScheme-3.53.m","Text"]
=
Module[
{ progress , update } ,
Print[ "Fetching LevelScheme... " ] ;
progress = 0 ;
update[ _ , "progress" , { now_ , total_ , __ } ] :=
progress = now / total // Quiet ;
URLSaveAsynchronous[
"http://scidraw.nd.edu/levelscheme/versions/LevelScheme-3.53.zip" ,
"ls.zip" ,
update ,
"Progress" -> True ] ;
While[ progress < 1 , Pause[ .1 ] ] ;
Print[ "Extracting..." ] ;
ExtractArchive[ "ls.zip", Directory[ ] ] ;
SetDirectory[ "LevelScheme" ] ;
URLSave[
Mapt[ Path , "Mapt-Packages" ] <> "LevelScheme/3.53/init.m" ,
"init.m" ] ;
Print[ "Initializing..." ] ;
Mapt[ Initialization , "LevelScheme" , "3.53" ] ;
Print[ "Done." ] ] ;
I would like to get a project going on GitHub, so if you are interested in working on it please chime in.