continuuity/loom — pull request #382 by dereklwood (2014-08-15 17:41:03+00:00)
Title: Feature/data uploader utility

- [x] data-uploader utility to upload a single resource to loom server.
- [ ] the rest-client library is supposed to upload files automatically as multipart, but doesn't look like its working, so i may need to replace with something else. but it should work for all our stuff.
- [x] it does the gzipping in pure ruby but also in-memory for now. If needed it can upload a pre-existing tgz.

```
$ ./data-uploader.rb -h
Usage: ./data-uploader.rb [options]
-u, --uri URI Server URI, defaults to ENV['LOOM_SERVER_URI'] else "http://localhost:55054"
-t, --tenant TENANT Tenant, defaults to ENV['LOOM_TENANT'] else "superadmin"
-U, --user USER User, defaults to ENV['LOOM_API_USER'] else "admin"

Required Arguments:
: one of upload, stage, or sync (sync acts on all staged resources, so can be dangerous)
: path to the local copy of the resource to upload
: api path defining the resource

Example:
./data-uploader.rb -u http://localhost:55054 -t superadmin -U admin sync ./my/local/cookbooks/hadoop automatortypes/chef-solo/cookbooks/hadoop

```

```
./data-uploader.rb -u http://localhost:55054 -t superadmin -U admin sync /Users/derek/git/hadoop_cookbook automatortypes/chef-solo/cookbooks/hadoop
upload successful for http://localhost:55054/v1/loom/automatortypes/chef-solo/cookbooks/hadoop, version: 15
stage successful for http://localhost:55054/v1/loom/automatortypes/chef-solo/cookbooks/hadoop/versions/15/stage
sync successful
```