[Pharo-project] Artifacts Mirroring

Camillo Bruni camillo.bruni at inria.fr
Tue Jan 31 07:38:06 EST 2012


On 2012-01-29, at 19:21, Sven Van Caekenberghe wrote:
> Camillo,
> 
> On 28 Jan 2012, at 01:46, Camillo Bruni wrote:
> 
>> On 2012-01-27, at 20:43, Sven Van Caekenberghe wrote:
>>> On 27 Jan 2012, at 17:31, Camillo Bruni wrote:
>>>> ./googlecode_upload.py --help
>>>> Usage: googlecode-upload.py -s SUMMARY -p PROJECT [options] FILE
>>>> 
>>>> Options:
>>>> -h, --help            show this help message and exit
>>>> -s SUMMARY, --summary=SUMMARY
>>>>                     Short description of the file
>>>> -p PROJECT, --project=PROJECT
>>>>                     Google Code project name
>>>> -u USER, --user=USER  Your Google Code username
>>>> -w PASSWORD, --password=PASSWORD
>>>>                     Your Google Code password
>>>> -l LABELS, --labels=LABELS
>>>>                     An optional lis
>>> 
>>> I had a quick look at http://code.google.com/p/support/source/browse/trunk/scripts/googlecode_upload.py
>>> 
>>> should be doable with zn+zdc as well…
>> 
>> you know I still have this inner fear of creating scripts in pharo :D and I immediately back out and use ruby / bash :P
>> 
>> I'll have a look, for now I'm fine with a minimal effort solution :).
> 
> Sure, I understand: if something usable exists, why not use it, often there is not much reason to reinvent the wheel.
> 
> But just for the sake of it, this (untested) code is more or less (from my understanding of the Python code) what the key logic would be in Smalltalk:
> 
> filepath := '/tmp/foo.txt'.
> projectname := 'pharo'.
> username := 'sven.van.caekenberghe'.
> password := 's46K48jc0kn1'.
> summary := 'Testing uploading a file to a Google project'.
> labels := #( 'Cool' 'Cooler' 'Coolest').
> 
> (client := ZnClient new)
> 	systemPolicy;
> 	beOneShot;
> 	https;
> 	host: projectname, '.googlecode.com';
> 	username: username password: password;
> 	multiPartFormDataEntity;
> 	addPart: (ZnMimePart fieldName: 'filename' fileNamed: filepath);
> 	addPart: (ZnMimePart fieldName: 'summary' value: summary).
> labels do: [ :each |
> 	addPart: (ZnMimePart fieldName: 'label' value: each) ].
> client post.
> client response location.
> 
> Wouldn't you agree that this is pretty cool code ?

Oh, definitely :)
I'll give it a shot :)

>> BTW: with the Monkey we already did a complete google API authentification which works perfectly :)
> 
> I know, and I was very happy with it !
> 
> Sven





More information about the Pharo-dev mailing list