forked from Metacello/metacello
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue Metacello#406: bonus cleanup of .err files created downloading …
…github tag files ... only an issue for Squeak and GemStone
- Loading branch information
1 parent
f3257d7
commit 494fe28
Showing
6 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
37 changes: 25 additions & 12 deletions
37
...atform.package/MetacelloPharoCommonPlatform.class/instance/downloadJSON.username.pass..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
github/bitbucket support | ||
downloadJSON: url username: username pass: pass | ||
"return result of parsing JSON downloaded from url. username:pass may be nil, but calls will be subject to severe rate limits." | ||
"return result of parsing JSON downloaded from url. username:pass may be nil, but calls will be subject to severe rate limits." | ||
|
||
| jsonFileName jsonFile | | ||
jsonFileName := self tempFileFor: 'tags-' , self processPID suffix: 'json'. | ||
self | ||
downloadBasicFile: url | ||
to: jsonFileName | ||
username: username | ||
pass: pass. | ||
jsonFile := self fileHandleOn: jsonFileName. | ||
jsonFile containingDirectory | ||
readOnlyFileNamed: jsonFile localName | ||
do: [ :fileStream | ^ MCFileTreeJsonParser parseStream: fileStream ] | ||
| jsonFileName jsonFile errorFileName | | ||
jsonFileName := self | ||
tempFileFor: 'tags-' , self processPID | ||
suffix: 'json'. | ||
errorFileName := self | ||
downloadBasicFile: url | ||
to: jsonFileName | ||
username: username | ||
pass: pass. | ||
[ jsonFile := self fileHandleOn: jsonFileName. | ||
jsonFile containingDirectory | ||
readOnlyFileNamed: jsonFile localName | ||
do: [ :fileStream | | ||
| result | | ||
result := MCFileTreeJsonParser | ||
parseStream: fileStream self | ||
deleteFileNamed: errorFileName. | ||
^ result ] ] | ||
on: Error | ||
do: [ :ex | | ||
self | ||
error: | ||
'Error during download (' , ex description , ') please check the file ' | ||
, errorFileName printString , ' for error message.' ] |
28 changes: 21 additions & 7 deletions
28
...monPlatform.package/MetacelloPharoCommonPlatform.class/instance/downloadZipArchive.to..st
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,24 @@ | ||
github support | ||
downloadZipArchive: url to: outputFileName | ||
"download zip archive from <url> into <outputFileName>" | ||
"download zip archive from <url> into <outputFileName>" | ||
|
||
| archive zipfile | | ||
self downloadBasicFile: url to: outputFileName username: nil pass: nil. | ||
archive := ZipArchive new. | ||
zipfile := self fileHandleOn: outputFileName. | ||
zipfile containingDirectory readOnlyFileNamed: zipfile localName do: [ :fileStream | archive readFrom: fileStream ]. | ||
^ archive | ||
| archive zipfile errorFileName | | ||
errorFileName := self | ||
downloadBasicFile: url | ||
to: outputFileName | ||
username: nil | ||
pass: nil. | ||
archive := ZipArchive new. | ||
zipfile := self fileHandleOn: outputFileName. | ||
zipfile containingDirectory | ||
readOnlyFileNamed: zipfile localName | ||
do: [ :fileStream | | ||
[ archive readFrom: fileStream ] | ||
on: Error | ||
do: [ :ex | | ||
self | ||
error: | ||
'Error during download (' , ex description , ') please check the file ' | ||
, errorFileName printString , ' for error message.' ] ]. | ||
self deleteFileNamed: errorFileName. | ||
^ archive |
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
repository/Metacello-PharoCommonPlatform.package/monticello.meta/version
This file contains 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