Use:
(ConfigurationOfTilingWindowManager project
version: #bleedingEdge) load(ConfigurationOfTilingWindowManager project
version: #bleedingEdge) loadGofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
Gofer it
squeaksource: 'ShortWays';
package: 'ConfigurationOfKeymapping';
load.
(ConfigurationOfKeymapping project version: '1.7') load.
Gofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
(Smalltalk at: #StandardUITheme) beCurrent.
(Smalltalk at: #TWMBar) showTWMBar:true.
Gofer it
squeaksource: 'ShortWays';
package: 'ConfigurationOfKeymapping';
load.
(Smalltalk at: #ConfigurationOfKeymapping project version: '1.7') load.
Gofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
Gofer it
squeaksource: 'PBASandbox';
package: 'PBSandbox';
load.
StandardUITheme beCurrent.
(Class new
superclass: StringMorph;
setFormat: StringMorph format;
compile: 'step self contents: Time now printString';
new)
openInWindowLabeled: 'Petite Horloge'."This creates a class and one instance on the fly"
counter := Class new
superclass: Object;
addInstVarNamed: 'counter';
compile: 'initialize
counter := 0';
compile: 'counterString
^ counter asString';
compile: 'increment
counter := counter + 1.
self changed:#counterString';
compile: 'decrement
counter := counter - 1.
self changed:#counterString';
new.
(UITheme builder newColumn: {
UITheme builder newLabelFor: counter getLabel: #counterString getEnabled: nil.
UITheme builder newRow: {
UITheme builder newButtonFor: counter action: #increment label: '+' help: nil.
UITheme builder newButtonFor: counter action: #decrement label: '-' help: nil.
}
}) openInWindowLabeled: 'Counter example'.|wm|
wm := WorldManager instance.
#('2' '3' '4') do: [:aString| wm createOrSwitchToWorldNamed: aString].
wm worlds keysAndValuesDo: [:aWorldName :aWorld| |dock|
dock := DockingBarMorph new
adhereToTop;
openInWorld: aWorld.
wm worlds keysAndValuesDo: [:aWorldName2 :aWorld2|
dock addMorph: (SimpleButtonMorph new
label: aWorldName2;
target: [wm createOrSwitchToWorldNamed: aWorldName2];
actionSelector: #value) ].
dock addMorph: (StringMorph contents: aWorldName).
].
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfMocketry';
load.
(Smalltalk at:#ConfigurationOfMocketry) project latestVersion load.
Gofer it
squeaksource: 'LaurentLSandbox';
package: 'Picasa';
load.
HTTPSocket class>>httpGet:, one way is to give a mock to PicasaSearch so we can check (and stub) the HTTP request: PicasaSearchTwoRoughSeaTest>>setUp
[:mockHTTPSocketClass|
[photos := PicasaSearch new
httpSocketClass: mockHTTPSocketClass;
addKeyword: 'rough';
addKeyword: 'sea';
maxResult: 2;
photos.]
should strictly satisfy: [
(mockHTTPSocketClass httpGet:
'http://picasaweb.google.com/data/feed/api/all?q=rough+sea&max-results=2')
willReturn: self fixtureXMLResponseForTwoRoughSea]
] runScenario.
#fixtureXMLResponseForTwoRoughSea will return an XML string and test methods will check that it is correctly parsed.httpGetDocument
|url|
url := String streamContents: [:aStream|
aStream
nextPutAll: 'http://picasaweb.google.com/data/feed/api/all?q=';
nextPutAll: ('+' join: self keywords);
nextPutAll: '&max-results=';
nextPutAll: self maxResult asString.
].
^ (self httpSocketClass httpGet: url).[:myFirstMock :mySecondMock|
"do stuff with mocks"
] runScenario
[:myFirstMock :mySecondMock|
[ "do stuff with mocks" ]
should strictly satisfy:
[ "what is expected on mocks" ]
] runScenario
Gofer new
squeaksource: 'LaurentLSandbox';
package: 'XML-GUI';
load.
((Smalltalk at:#XMLBrowser) labelled: 'Picasa search')
browseAtUrl:
'http://picasaweb.google.com/data/feed/api/all?q=lighthouse&max-results=10'.
XMLBrowser comment for examples.
fb := [:counter| |rules|
rules := {15->'FizzBuzz'. 5->'Buzz'. 3->'Fizz'. 1->counter}.
rightRule := rules detect: [:aRule| counter \\ aRule key == 0].
rightRule value].
self assert: (fb value: 7) == 7.
self assert: (fb value: 3) == 'Fizz'.
self assert: (fb value: 5) == 'Buzz'.
self assert: (fb value: 15) == 'FizzBuzz'.
1 to: 100 do: [:counter |
Transcript
show: (fb value: counter) asString;
cr]rightRule := rules detect: [:aRule| counter isDivisibleBy: aRule key]
a := Operation new.
a result.
Should return 0.b := Operation new.
b add: 2.
b add: 3.
b result.
Should return 5.Operation new
add: 2;
add: 4;
divideBy: 2;
result.
Should return 3.Operation>>#multiplyBy by yourself.
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfProfStef';
load.
ConfigurationOfProfStef project latestVersion load.
ProfStef
go;
tutorial: SmalltalkSyntaxTutorial lesson: #instanciation.(defun foo (n)
(lambda (i) (incf n i)))
foo: n
|s|
s := n.
^[:i| s := s+i. ]
foo: n
^[:i| n := n+i]
./easy_squeakvm.sh
mkdir ~/squeakvm cd ~/squeakvm
wget http://www.squeakvm.org/unix/release/Squeak-3.11.3.2135-src.tar.gz tar -xvzf Squeak-3.11.3.2135-src.tar.gz
Gofer new squeaksource: 'MetacelloRepository'; package: 'ConfigurationOfVMMaker'; load. (Smalltalk at:#ConfigurationOfVMMaker) project lastVersion load.
MCHttpRepository location:'http://www.squeaksource.com/FreeTypePlus' user: '' password: ''. MCHttpRepository location: 'http://source.impara.de/freetype' user: '' password: ''.
VMMakerTool openInWorld


rm -rf ~/squeakvm/Squeak-3.11.3.2135-src/unix/src cp -a ~/squeakvm/src32 ~/squeakvm/Squeak-3.11.3.2135-src/unix/src
mkdir ~/squeakvm/Squeak-3.11.3.2135-src/build cd ~/squeakvm/Squeak-3.11.3.2135-src/build
../unix/cmake/configure
CMake Warning (dev) in
/home/lol/squeakvm/Squeak-3.11.3.2135-src/build/=/CMakeLists.txt:
Syntax error in cmake code when parsing string
${=_link_directories}
syntax error, unexpected cal_SYMBOL, expecting } (21)
cd ~/squeakvm/Squeak-3.11.3.2135-src/unix/cmake/ wget http://lolgzs.free.fr/pharo/Plugins.cmake.patch patch -p0 < Plugins.cmake.patchThen clean and run the configure script again
cd ~/squeakvm/Squeak-3.11.3.2135-src/build rm -rf * ../unix/cmake/configureYou should have the Makefile now. Run make:
makeThen another problem as libfreetype (needed by FT2Plugin) is not found. To correct it, create config.cmake for FT2Plugin this way:
mkdir ~/squeakvm/Squeak-3.11.3.2135-src/unix/plugins/FT2Plugin/
echo "PLUGIN_FIND_LIBRARY(FT2 freetype)" >
~/squeakvm/Squeak-3.11.3.2135-src/unix/plugins/FT2Plugin/config.cmake
More informations on this error here. make clean makeThen install:
sudo make install7. Conclusion
Gofer new
squeaksource: 'Loader';
package: 'Loader';
load.
Loader new load: 'ProfStef'.
ProfStef goOn: HowToMakeYourOwnTutorial.
Gofer new
squeaksource: 'ProfStef';
package: 'ProfStef';
load.
|aWindow aPanel buttonPanel|
aWindow := SystemWindow labelled: 'My first window'.
aPanel := PluggablePanelMorph new.
aWindow addMorph: aPanel fullFrame: (
LayoutFrame
fractions: (0@0 corner: 1@1)
offsets: (0@0 corner: 0@50 negated)).
aPanel color: (Color blue).
buttonPanel := PluggablePanelMorph new.
aWindow addMorph: buttonPanel fullFrame: (
LayoutFrame
fractions: (0@0.99 corner: 1@1)
offsets: (0@50 negated corner: 0@0)).
buttonPanel color: (Color green).
#(one two three) do: [:label| |aButton|
aButton := PluggableButtonMorph new label: label; yourself.
buttonPanel addMorph: aButton fullFrame: nil.
].
aWindow openInWorld.