okfn/dpm — Issue #36: lib.save function
Author: dgraziotin
Created: 2011-11-17 21:09:55+00:00
State: open
Labels: lib

A library function to help to save a package on disk is required.
Something like:

package = dpm.lib.init('/home/dgraziotin/Desktop/datapkg','test')
package.author = 'Daniel'
#update at '/home/dgraziotin/Desktop/datapkg/test'
package = dpm.lib.save(package)
package.author = 'Rufus'
#update package at '/home/dgraziotin/Desktop/datapkg/test2'
package = dpm.lib.save(package, '/home/dgraziotin/Desktop/datapkg/test2')
#package.name == 'test2' at this point?

The function should a wrapper around package.dist.write(path).
From what I see, I will probably need to change the end of [jsondist.py](https://github.com/okfn/dpm/blob/master/dpm/distribution/jsondist.py#L86) as follows:

if not os.path.exists(datadir):
os.makedirs(datadir)

Many, MANY tests must be provided :)