On 12/23/11 3:49 AM, Vladimir Panteleev wrote:
On Friday, 23 December 2011 at 08:56:09 UTC, Andrei Alexandrescu wrote:
What am I doing wrong?

The script suffered some bitrot. The version I posted in IRC works for
me on both Ruby 1.8 and 1.9:

http://dump.thecybershadow.net/7f0b3e4b56df6bf78382f6161115f7e1/github_upload.rb


Prodded GitHub support to have a look at the pull requests, too...

Works, thanks! One problem remains, we need the script to also remove the old file... right now the second attempt to upload fails with

/Users/aalexandre/.gem/ruby/1.8/gems/json-1.6.3/lib/json/common.rb:148:in `parse': 751: unexpected token at 'Filename has already been taken' (JSON::ParserError) from /Users/aalexandre/.gem/ruby/1.8/gems/json-1.6.3/lib/json/common.rb:148:in `parse'
        from ./github_upload:102

In fact in an ideal world the script would upload to a temporary file and then move the temporary file into the target file atomically, so as to not disrupt downloads for the duration of the upload.


Andrei

Reply via email to