[squeak-dev] The Inbox: Installer-Core-fbs.366.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 18 11:47:03 UTC 2013


Frank Shearar uploaded a new version of Installer-Core to project The Inbox:
http://source.squeak.org/inbox/Installer-Core-fbs.366.mcz

==================== Summary ====================

Name: Installer-Core-fbs.366
Author: fbs
Time: 18 March 2013, 11:46:52.277 am
UUID: f665ad84-81d3-4337-8527-4c5f320ec2ab
Ancestors: Installer-Core-fbs.365

InstallerGitHub lets you install source stored in a GitHub repository. It detects FileTree repositories (through the .filetree marker file) and otherwise assumes chunk format.

It will lazily pull in WebClient, SqueakSSL and FileTree as and when necessary. Note that since GitHub uses SSL everywhere, you MUST have the SqueakSSL plugin installed in your VM to use this class.

=============== Diff against Installer-Core-fbs.365 ===============

Item was added:
+ Installer subclass: #InstallerGitHub
+ 	instanceVariableNames: 'user repository commitId'
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Installer-Core'!
+ 
+ !InstallerGitHub commentStamp: 'fbs 3/18/2013 11:41' prior: 0!
+ An Installer that can install code stored in GitHub repositories (either in chunk format or FileTree). Typical usage:
+ 
+ (Installer github
+ 	user: 'frankshearar' repository: 'Zippers' commitId: 'master') install!

Item was added:
+ ----- Method: InstallerGitHub class>>user:repository: (in category 'instance creation') -----
+ user: userString repository: repoString
+ 	^ self basicNew
+ 		initializeWithUser: userString
+ 		repository: repoString
+ 		commitId: 'master'!

Item was added:
+ ----- Method: InstallerGitHub class>>user:repository:commitId: (in category 'instance creation') -----
+ user: userString repository: repoString commitId: treeishString
+ 	^ self basicNew
+ 		initializeWithUser: userString
+ 		repository: repoString
+ 		commitId: treeishString!

Item was added:
+ ----- Method: InstallerGitHub>>basicBrowse (in category 'basic interface') -----
+ basicBrowse
+ 	^ (Installer url: self gitHubUrl asString) browse!

Item was added:
+ ----- Method: InstallerGitHub>>basicInstall (in category 'basic interface') -----
+ basicInstall
+ 	| zip webResponse |
+ 	useFileIn := true.
+ 	webResponse := self webClientClassReference httpGet: self zipballUrl asString.
+ 	webResponse isSuccess ifFalse: [self error: ('Failed to download zipball ({1})' format: {webResponse printString})].
+ 	zip := ZipArchive new
+ 				readFrom: (RWBinaryOrTextStream with: webResponse content).
+ 	zip members
+ 		detect: [:member | member fileName = '.filetree']
+ 		ifFound: [self loadFiletreeFormatFiles: zip]
+ 		ifNone: [self loadChunkFormatFiles: zip]!

Item was added:
+ ----- Method: InstallerGitHub>>basicView (in category 'basic interface') -----
+ basicView
+ 	^ (Installer url: self gitHubUrl) view!

Item was added:
+ ----- Method: InstallerGitHub>>commitId (in category 'accessing') -----
+ commitId
+ 	^ commitId!

Item was added:
+ ----- Method: InstallerGitHub>>createTempDir (in category 'private') -----
+ createTempDir
+ 	| newDir |
+ 	"Vulnerable to a time-of-check-time-of-use race."
+ 	[newDir := UUID new asString.
+ 	FileDirectory default directoryExists: newDir]
+ 		whileTrue.
+ 	^ FileDirectory default createDirectory: newDir!

Item was added:
+ ----- Method: InstallerGitHub>>fileTreeStReader (in category 'class references') -----
+ fileTreeStReader
+ 	self class environment
+ 		at: #MCFileTreeStReader
+ 		ifPresent: [:cls | ^ cls]
+ 		ifAbsent: [self installFileTree].
+ 	^ self class environment at: #MCFileTreeStReader!

Item was added:
+ ----- Method: InstallerGitHub>>gitHubUrl (in category 'urls') -----
+ gitHubUrl
+ 	^ ('https://github.com/{1}/{2}/commits/{3}' format: {user. repository. commitId}) asUrl!

Item was added:
+ ----- Method: InstallerGitHub>>initializeWithUser:repository:commitId: (in category 'initialize-release') -----
+ initializeWithUser: userString repository: repoString commitId: treeishString
+ 	user := userString.
+ 	repository := repoString.
+ 	commitId := treeishString.!

Item was added:
+ ----- Method: InstallerGitHub>>installFiletree (in category 'private') -----
+ installFiletree
+ 	Installer squeakmap
+ 		update;
+ 		install: 'FileTree (for Squeak 4.4)'!

Item was added:
+ ----- Method: InstallerGitHub>>installWebClient (in category 'private') -----
+ installWebClient
+ 	Installer ss project: 'WebClient';
+ 		 install: 'WebClient-Core-ar.92.mcz'.
+ 	Installer ss project: 'SqueakSSL';
+ 		 install: 'SqueakSSL-Core-ar.26.mcz'!

Item was added:
+ ----- Method: InstallerGitHub>>loadChunkFormatFiles: (in category 'private') -----
+ loadChunkFormatFiles: zip
+ 	| defns loader |
+ 	defns := (zip membersMatching: '*.st')
+ 				collect: [:member | MCSnapshot fromDefinitions: (MCStReader new stream: member contentStream) definitions].
+ 	loader := MCPackageLoader new.
+ 	defns
+ 		do: [:member | loader installSnapshot: member].
+ 	loader loadWithName: repository!

Item was added:
+ ----- Method: InstallerGitHub>>loadFiletreeFormatFiles: (in category 'private') -----
+ loadFiletreeFormatFiles: zip
+ 	"FileTree works with directories. Extract the zip contents, load the definitions, and clean up."
+ 	| loader tempDir |
+ 	tempDir := self createTempDirectory.
+ 	[zip extractAllTo: tempDir.
+ 		loader := self fileTreeStReader new.
+ 		loader directory: FileDirectory.
+ 		loader loadDefinitions.]
+ 			ensure: [FileDirectory default deleteDirectory: tempDir pathName].!

Item was added:
+ ----- Method: InstallerGitHub>>repository (in category 'accessing') -----
+ repository
+ 	^ repository!

Item was added:
+ ----- Method: InstallerGitHub>>user (in category 'accessing') -----
+ user
+ 	^ user!

Item was added:
+ ----- Method: InstallerGitHub>>user:repository: (in category 'copying') -----
+ user: userString repository: repoString
+ 	^ self class user: userString repository: repoString!

Item was added:
+ ----- Method: InstallerGitHub>>user:repository:commitId: (in category 'copying') -----
+ user: userString repository: repoString commitId: treeishString
+ 	^ self class
+ 		user: userString
+ 		repository: repoString
+ 		commitId: treeishString.!

Item was added:
+ ----- Method: InstallerGitHub>>webClientClassReference (in category 'class references') -----
+ webClientClassReference
+ 	self class environment
+ 		at: #WebClient
+ 		ifPresent: [:cls | ^ cls]
+ 		ifAbsent: [self installWebClient].
+ 	^ self class environment at: #WebClient!

Item was added:
+ ----- Method: InstallerGitHub>>zipballUrl (in category 'urls') -----
+ zipballUrl
+ 	^ ('https://github.com/{1}/{2}/zipball/{3}' format: {user. repository. commitId}) asUrl!



More information about the Squeak-dev mailing list