[Pkg] Installer: Installer-Core-kph.262.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Tue Dec 9 03:09:20 UTC 2008
A new version of Installer-Core was added to project Installer:
http://www.squeaksource.com/Installer/Installer-Core-kph.262.mcz
==================== Summary ====================
Name: Installer-Core-kph.262
Author: kph
Time: 9 December 2008, 3:09:17 am
UUID: 4db737ac-da53-44b7-9d40-b0e36ca23919
Ancestors: Installer-Core-kph.261
. InstallerInternetBased can extract html now.
test case:
Installer installUrl: 'installer.pbwiki.com/311'
=============== Diff against Installer-Core-kph.261 ===============
Item was changed:
+ ----- Method: InstallerInternetBased>>extractFromHtml:option: (in category 'as yet unclassified') -----
- ----- Method: InstallerInternetBased>>extractFromHtml:option: (in category 'url') -----
extractFromHtml: html option: allOrLast
| start stop test in |
start := self markersBegin.
stop := self markersEnd.
test := self markersTest.
in := ReadWriteStream with: String new.
[ html upToAll: start; atEnd ]
whileFalse: [
| chunk |
(allOrLast == #last) ifTrue: [ in resetToStart ].
chunk := html upToAll: stop.
self isSkipLoadingTestsSet ifTrue: [ chunk := chunk readStream upToAll: test ].
in nextPutAll: chunk.
].
^self removeHtmlMarkupFrom: in reset
!
Item was changed:
InstallerInternetBased subclass: #InstallerWebBased
+ instanceVariableNames: ''
- instanceVariableNames: 'markers'
classVariableNames: ''
poolDictionaries: ''
category: 'Installer-Core'!
Item was changed:
----- Method: InstallerInternetBased>>urlGet: (in category 'url') -----
urlGet: aUrl
| page |
page := HTTPSocket httpGet: aUrl accept: 'application/octet-stream'.
(page respondsTo: #reset) ifFalse: [ ^ nil ].
+ (self isHtmlStream: page) ifTrue: [ (Installer web copyFrom: self) self extractFromHtml: page option: nil ].
- (self isHtmlStream: page) ifTrue: [ page := self extractFromHtml: page option: nil ].
^ page reset
!
Item was added:
+ ----- Method: InstallerInternetBased>>markersTest (in category 'as yet unclassified') -----
+ markersTest
+
+ ^ self markers readStream upToAll: '...'; upToAll: '...'!
Item was added:
+ ----- Method: InstallerInternetBased>>markers (in category 'as yet unclassified') -----
+ markers
+
+ ^ markers ifNil: [ '<code st>..."test ...</code st>' ]!
Item was added:
+ ----- Method: InstallerInternetBased>>removeHtmlMarkupFrom: (in category 'as yet unclassified') -----
+ removeHtmlMarkupFrom: in
+
+ | out |
+ out := ReadWriteStream on: (String new: 100).
+ [ in atEnd ] whileFalse: [
+ out nextPutAll: (in upTo: $<).
+ (((in upTo: $>) asLowercase beginsWith: 'br') and: [ (in peek = Character cr) ]) ifTrue: [ in next ].
+ ].
+
+ ^self replaceEntitiesIn: out reset.
+ !
Item was changed:
Installer subclass: #InstallerInternetBased
+ instanceVariableNames: 'url pageDataStream markers'
- instanceVariableNames: 'url pageDataStream'
classVariableNames: 'Entities'
poolDictionaries: ''
category: 'Installer-Core'!
Item was changed:
----- Method: Installer class>>url (in category 'url') -----
url
+ ^ InstallerWeb new url: ''!
- ^ InstallerUrl new url: ''!
Item was added:
+ ----- Method: InstallerInternetBased>>markersBegin (in category 'as yet unclassified') -----
+ markersBegin
+
+ ^ self markers copyUpTo: $.!
Item was added:
+ ----- Method: InstallerInternetBased>>markersEnd (in category 'as yet unclassified') -----
+ markersEnd
+ "return the third marker or the second if there are only two"
+
+ | str a |
+ str := self markers readStream.
+ a := str upToAll: '...'; upToAll: '...'.
+ str atEnd ifTrue: [ ^a ] ifFalse: [ ^str upToEnd ]
+ !
Item was added:
+ ----- Method: InstallerInternetBased>>markers: (in category 'as yet unclassified') -----
+ markers: anObject
+
+ markers := anObject!
Item was removed:
- ----- Method: InstallerWebBased>>markersTest (in category 'url') -----
- markersTest
-
- ^ self markers readStream upToAll: '...'; upToAll: '...'!
Item was removed:
- ----- Method: InstallerWebBased>>markers (in category 'accessing') -----
- markers
-
- ^ markers ifNil: [ '<code st>..."test ...</code st>' ]!
Item was removed:
- ----- Method: InstallerWebBased>>removeHtmlMarkupFrom: (in category 'url') -----
- removeHtmlMarkupFrom: in
-
- | out |
- out := ReadWriteStream on: (String new: 100).
- [ in atEnd ] whileFalse: [
- out nextPutAll: (in upTo: $<).
- (((in upTo: $>) asLowercase beginsWith: 'br') and: [ (in peek = Character cr) ]) ifTrue: [ in next ].
- ].
-
- ^self replaceEntitiesIn: out reset.
- !
Item was removed:
- ----- Method: InstallerWebBased>>markers: (in category 'accessing') -----
- markers: anObject
-
- markers := anObject!
Item was removed:
- ----- Method: InstallerWebBased>>markersBegin (in category 'url') -----
- markersBegin
-
- ^ self markers copyUpTo: $.!
Item was removed:
- ----- Method: InstallerWebBased>>markersEnd (in category 'url') -----
- markersEnd
- "return the third marker or the second if there are only two"
-
- | str a |
- str := self markers readStream.
- a := str upToAll: '...'; upToAll: '...'.
- str atEnd ifTrue: [ ^a ] ifFalse: [ ^str upToEnd ]
- !
More information about the Packages
mailing list