Last active
August 29, 2015 13:57
-
-
Save arnested/9526828 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| # Copyright (C) 2014 Arne Jørgensen | |
| FILE=$1 | |
| if [ ! -r "${FILE}" ]; then | |
| echo \""${FILE}"\" is not readable | |
| exit 1; | |
| fi | |
| FILE_MIMETYPE=$(file --mime-type --brief "${FILE}") | |
| if [ "${FILE_MIMETYPE}" != 'application/x-tar' ] && | |
| [ "${FILE_MIMETYPE}" != 'text/x-lisp' ]; then | |
| echo \""${FILE}"\" is not a lisp file or a tar archive | |
| exit 2; | |
| fi | |
| read -p "Are you sure you want to upload \"${FILE}\" (yes/no)? " REPLY | |
| if [ "${REPLY}" != 'yes' ]; then | |
| exit 4; | |
| fi | |
| # Get my token from Macs Key Chain. | |
| TOKEN=$(security find-generic-password -gws 'Marmalade Repo API' -a "${USER}") | |
| curl --silent -F "name=${USER}" -F "token=${TOKEN}" -F "package=@${FILE}" http://marmalade-repo.org/v1/packages | json message |
Author
Author
You could also take a look at @lunaryorns much more streamlined implementation of this script: http://www.lunaryorn.com/2014/03/28/unbreaking-marmalade.html
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uploading to Marmalade is currently broken.
It is still possible to upload via Marmalades API though.
To upload via the API you need a token. You get your token via the API as well using you username and password.
I created this shell script to handle the upload for me.
I have stored my token in Mac OS X's Keychain. If you don't use Mac or Keychain - use something similar or put your token directly into the script.
The script goes to some length to make sure you don't upload something bogus to Marmalade:
The upload is handled by curl(1) and I use json to parse the feedback from Marmalade (install json with
npm install json).Feel free to use and adapt the script to your needs.