openknowledge-archive / dpm-old

**DEPRECATED** - see https://github.com/frictionlessdata/. [[Data package manager (dpm) is a command line tool and Python library for working with data packages - http://data.okfn.org/standards/data-package/]]
http://dpm.readthedocs.org/
15 stars 8 forks source link

lib.save function #36

Closed dgraziotin closed 12 years ago

dgraziotin commented 12 years ago

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 as follows:

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

Many, MANY tests must be provided :)