views:

54

answers:

1

Hi,

I'm trying to upload my FAKE project (http://github.com/forki/FAKE) to RubyGems from F#:

let mutable rubyGems = "http://rubygems.org/api/v1/gems"

let PushGem gemFileName authCode = 
    let client = new System.Net.WebClient()
    client.Headers.Add(Net.HttpRequestHeader.Authorization,authCode)

    logfn "Uploading gem %s to %s." gemFileName rubyGems
    client.UploadFile(rubyGems,gemFileName)
      |> System.Text.Encoding.ASCII.GetString
      |> printfn "%s"

It returns: Uploading gem .\gems\fake-1.42.9.0.gem to http://rubygems.org/api/v1/gems. The remote server returned an error: (422) Unprocessable Entity.

The gem seems to be OK since I can install it. The API docs can be found at https://rubygems.org/pages/api_docs.

Any ideas?

Regards, Steffen

Update

curl --data-binary fake-1.42.11.0.gem -H 'Authorization:.....' http://rubygems.org/api/v1/gems

gives:

RubyGems.org cannot process this gem. Please try rebuilding itand installing it locally to make sure it's valid.

but gem push fake-1.42.11.0.gem seems to work.

Regards, Steffen

+1  A: 

if submitting file with curl (as it given in api sample) works correctly? If yes - you should compare requests from curl and WebClient.UploadFile.

desco
Thanks for the hint. I updated my question.
forki23