- CypressAbstractReaderWriter
added:10 methods
- CypressAbstractWriter
added:9 methods
changed:11 methods
category of:
#writeClass:to:
#writeMethod:to:
#writePackage:to:
- CypressModel
added:
#asChange
#asChangeSet
#changesInto:
#properties:
category of:
- CypressRepository
added:8 methods
category of: #writer
- CypressMethod
added:7 methods
changed: #category
category of:
- CypressFileTreeReader
added:11 methods
- CypressClass
added:10 methods
changed:
#initializeFromClass:
#methods
- CypressPackage
added:
#asChange
#changesInto:
changed:
#classes
#extensions
#initializeFromPackageDefinition:
- extensions
...
--- a/CypressAbstractReaderWriter.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressAbstractReaderWriter.st Tue Sep 18 10:40:17 2012 +0000
@@ -35,6 +35,81 @@
"Modified: / 17-09-2012 / 17:20:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressAbstractReaderWriter methodsFor:'defaults-filenames'!
+
+defaultFileNameForClassExtensionsNamed:classname
+ ^ ((classname copyReplaceAll:$: with:$_) , '.'
+ , self defaultFileSuffixForExtensions).
+
+ "Created: / 17-09-2012 / 18:27:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileNameForClassNamed:cclass
+ ^ ((cclass name copyReplaceAll:$: with:$_) , '.'
+ , self defaultFileSuffixForClass).
+
+ "Created: / 17-09-2012 / 18:11:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileNameForClassPackageNamed:aCypressPackage
+ ^ ((aCypressPackage name copy)
+ replaceAll:$: with:$_;
+ replaceAll:$/ with:$_;
+ yourself) , '.'
+ , self defaultFileSuffixForPackage
+
+ "Created: / 17-09-2012 / 17:32:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileNameForComment
+ ^ repository properties at:'commentFile' ifAbsent:[ 'README.md' ]
+
+ "Created: / 17-09-2012 / 18:07:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileNameForMethodNamed:selector
+
+ ^ (Dictionary new)
+ at:$/ put:'__quo__';
+ "/Add more"
+ at: selector
+ ifAbsent:[ ((selector copyReplaceAll:$: with:$.) , '.st') ]
+
+ "Created: / 17-09-2012 / 18:22:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileNameForProperties
+ ^ 'properties.ston'
+
+ "Created: / 17-09-2012 / 17:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressAbstractReaderWriter methodsFor:'defaults-suffixes'!
+
+defaultFileSuffixForClass
+ ^ 'class'
+
+ "Created: / 17-09-2012 / 18:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileSuffixForExtensions
+ ^ 'extension'
+
+ "Created: / 17-09-2012 / 18:09:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileSuffixForMethod
+ ^ 'st'
+
+ "Created: / 18-09-2012 / 10:02:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+defaultFileSuffixForPackage
+ ^ 'package'
+
+ "Created: / 17-09-2012 / 18:09:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressAbstractReaderWriter class methodsFor:'documentation'!
version_SVN
--- a/CypressAbstractWriter.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressAbstractWriter.st Tue Sep 18 10:40:17 2012 +0000
@@ -45,72 +45,6 @@
"Modified (comment): / 17-09-2012 / 17:19:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!CypressAbstractWriter methodsFor:'accessing-filenames'!
-
-directoryNameForClass: cclass
- ^((cclass name copyReplaceAll: $: with: $_) , '.', self suffixForClass).
-
- "Created: / 17-09-2012 / 18:11:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-directoryNameForExtensions: classname
- ^((classname copyReplaceAll: $: with: $_) , '.', self suffixForExtensions).
-
- "Created: / 17-09-2012 / 18:27:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-directoryNameForPackage: aCypressPackage
-
- ^(aCypressPackage name copy
- replaceAll:$: with: $_;
- replaceAll:$/ with: $_;
- yourself) , '.' , self suffixForPackage
-
- "Created: / 17-09-2012 / 17:32:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-fileNameForComment
- ^repository properties at:'commentFile' ifAbsent:['README.md']
-
- "Created: / 17-09-2012 / 18:07:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-fileNameForMethod: cmethod
- ^Dictionary new
- at: $/ put: '__quo__';
- "/Add more..."
-
- at: cmethod selector ifAbsent:[
- ((cmethod selector copyReplaceAll:$: with: $.) , '.st')
- ]
-
- "Created: / 17-09-2012 / 18:22:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-filenameNameForProperties
- ^'properties.ston'
-
- "Created: / 17-09-2012 / 17:38:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-suffixForClass
- ^'class'
-
- "Created: / 17-09-2012 / 18:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-suffixForExtensions
- ^'extension'
-
- "Created: / 17-09-2012 / 18:09:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-suffixForPackage
- ^'package'
-
- "Created: / 17-09-2012 / 18:09:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
!CypressAbstractWriter methodsFor:'writing-model'!
writeClass: cclass as: name to: directory
@@ -122,15 +56,6 @@
"Created: / 17-09-2012 / 22:19:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-writeClass: cclass to: directory
-
- self writeClass: cclass
- as: (self directoryNameForClass: cclass)
- to: directory
-
- "Created: / 17-09-2012 / 18:40:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
writeMethod: cmethod as: name to: directory
"Writes a given 'cmethod' into directory named 'name' under
'directory'"
@@ -140,15 +65,6 @@
"Created: / 17-09-2012 / 22:20:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-writeMethod: cmethod to: directory
-
- self writeMethod: cmethod
- as: (self fileNameForMethod: cmethod)
- to: directory
-
- "Created: / 17-09-2012 / 18:40:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
writePackage: cpackage as: name to: directory
"Writes a given 'cpackage' into directory named 'name' under
'directory'"
@@ -156,19 +72,19 @@
self subclassResponsibility
"Created: / 17-09-2012 / 22:15:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-writePackage: cpackage to: directory
-
- self writePackage: cpackage
- as: (self directoryNameForPackage: cpackage)
- to: directory
-
- "Created: / 17-09-2012 / 17:34:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressAbstractWriter methodsFor:'writing-utils'!
+writeClass: cclass to: directory
+
+ self writeClass: cclass
+ as: (self defaultFileNameForClassNamed:cclass name)
+ to: directory
+
+ "Created: / 17-09-2012 / 18:40:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
writeClasses: classes to: directory
"Writes my classes into 'directory' with given copyrightNotice"
@@ -179,7 +95,7 @@
directory directoryContentsAsFilenamesDo:[:each|
| suffix |
- each suffix = self suffixForClass ifTrue:[
+ each suffix = self defaultFileSuffixForClass ifTrue:[
obsolete add: each.
]
].
@@ -188,7 +104,7 @@
classes do:[:cclass|
| cpsClsDir name |
- cpsClsDir := directory / (name := self directoryNameForClass: cclass).
+ cpsClsDir := directory / (name := self defaultFileNameForClassNamed:cclass name).
obsolete remove:cpsClsDir ifAbsent:[].
self writeClass: cclass as: name to: directory
].
@@ -204,7 +120,7 @@
writeComment: comment to: directory
comment isNil ifTrue:[ ^ self ].
- (directory / (self fileNameForComment)) writingFileDo:[:f|
+ (directory / self defaultFileNameForComment) writingFileDo:[:f|
f nextPutAll: comment
]
@@ -237,7 +153,7 @@
extensionsPerClass keysAndValuesDo:[:name :cpsMthds |
| cpsClsDir cpsCls |
- cpsClsDir := directory / (self directoryNameForExtensions: name).
+ cpsClsDir := directory / (self defaultFileNameForClassExtensionsNamed:name).
obsolete remove: cpsClsDir ifAbsent:[].
cpsClsDir exists ifFalse: [ cpsClsDir makeDirectory ].
@@ -252,6 +168,15 @@
"Created: / 17-09-2012 / 18:29:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+writeMethod: cmethod to: directory
+
+ self writeMethod: cmethod
+ as: (self defaultFileNameForMethodNamed:cmethod selector)
+ to: directory
+
+ "Created: / 17-09-2012 / 18:40:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
writeMethods: methods to:directory
"Writes methods into given 'directory' with copyrightNotice in each file"
@@ -276,7 +201,7 @@
dir := cpsMthd meta ifTrue:[classDir] ifFalse:[instDir].
dir exists ifFalse:[ dir makeDirectory ].
- file := dir / (name := self fileNameForMethod: cpsMthd).
+ file := dir / (name := self defaultFileNameForMethodNamed:cpsMthd selector).
baseNameWithoutSuffix := file withoutSuffix baseName.
self writeMethod: cpsMthd as: name to: dir.
obsolete := obsolete reject:[:each|
@@ -292,12 +217,21 @@
"Created: / 17-09-2012 / 18:29:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+writePackage: cpackage to: directory
+
+ self writePackage: cpackage
+ as: (self defaultFileNameForClassPackageNamed:cpackage)
+ to: directory
+
+ "Created: / 17-09-2012 / 17:34:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
writeProperties: properties to: directory
| props propertyFile |
props := properties copy.
props isEmptyOrNil ifTrue:[ ^ self ].
- propertyFile := directory / self filenameNameForProperties.
+ propertyFile := directory / self defaultFileNameForProperties.
" add notice "
props at: '_cypress_copyright' put: notice.
--- a/CypressClass.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressClass.st Tue Sep 18 10:40:17 2012 +0000
@@ -28,6 +28,34 @@
!CypressClass methodsFor:'accessing'!
+category
+ ^properties at:'category' ifAbsent:['* as yet unclassified *']
+
+ "Created: / 18-09-2012 / 10:45:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classInstVarsAsString
+
+ ^String streamContents:[:s|
+ (properties at:'classinstvars' ifAbsent:[#()])
+ do:[:each|s nextPutAll: each]
+ separatedBy:[s space]
+ ]
+
+ "Created: / 18-09-2012 / 10:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+classVarsAsString
+
+ ^String streamContents:[:s|
+ (properties at:'classvars' ifAbsent:[#()])
+ do:[:each|s nextPutAll: each]
+ separatedBy:[s space]
+ ]
+
+ "Created: / 18-09-2012 / 10:51:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
comment
^ comment
!
@@ -36,17 +64,90 @@
comment := something.
!
+fullClassName
+ | ns |
+
+ ns := properties at: 'namespace' ifAbsent:[nil].
+ ^(ns notNil and:[ns ~= 'Smalltalk'])
+ ifFalse:[properties at: 'name']
+ ifTrue:[(properties at: 'name'), '::' , ns].
+
+ "Created: / 18-09-2012 / 10:44:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fullSuperName
+ | ns |
+
+ ns := properties at: 'superNamespace' ifAbsent:[nil].
+ ^(ns notNil and:[ns ~= 'Smalltalk'])
+ ifFalse:[properties at: 'super']
+ ifTrue:[(properties at: 'super'), '::' , ns].
+
+ "Created: / 18-09-2012 / 10:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+instVarsAsString
+
+ ^String streamContents:[:s|
+ (properties at:'instvars' ifAbsent:[#()])
+ do:[:each|s nextPutAll: each]
+ separatedBy:[s space]
+ ]
+
+ "Created: / 18-09-2012 / 10:50:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
methods
methods isNil ifTrue:[
- methods := OrderedCollection new.
- (Smalltalk at: name asSymbol) instAndClassMethodsDo:[:mthd|
- methods add: (CypressMethod fromMethod: mthd)
- ]
+ methods := OrderedCollection new
].
^methods
"Created: / 11-09-2012 / 00:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+name
+ name isNil ifTrue:[
+ properties notNil ifTrue:[
+ name := properties at:'name' ifAbsent:[nil]
+ ]
+ ].
+ ^name
+
+ "Created: / 18-09-2012 / 11:02:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+poolsAsString
+
+ ^String streamContents:[:s|
+ (properties at:'pools' ifAbsent:[#()])
+ do:[:each|s nextPutAll: each]
+ separatedBy:[s space]
+ ]
+
+ "Created: / 18-09-2012 / 10:53:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressClass methodsFor:'converting'!
+
+asChange
+ "superclass CypressModel says that I am responsible to implement this method"
+
+
+ ^ClassDefinitionChange new
+ className: self fullClassName;
+ superClassName: self fullSuperName;
+ category: self category;
+
+ instanceVariableNames: self instVarsAsString;
+ classVariableNames: self classVarsAsString;
+ classInstanceVariableNames: self classInstVarsAsString;
+ poolDictionaries: self poolsAsString;
+
+ yourself.
+
+ "Modified: / 18-09-2012 / 11:17:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressClass methodsFor:'initialization'!
@@ -73,6 +174,10 @@
properties
at:'_stx_type' put: aClass definitionSelector
].
+ methods := OrderedCollection new.
+ (Smalltalk at: name asSymbol) instAndClassMethodsDo:[:mthd|
+ methods add: (CypressMethod fromMethod: mthd)
+ ]
"Created: / 10-09-2012 / 23:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
@@ -89,6 +194,17 @@
"Created: / 11-09-2012 / 11:15:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressClass methodsFor:'private'!
+
+changesInto:aChangeSet
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ aChangeSet add: self asChange.
+ self methods do:[:each|each changesInto: aChangeSet].
+
+ "Modified: / 18-09-2012 / 10:58:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressClass methodsFor:'reading & writing - private'!
writeMethodsTo:directory notice:copyrightNotice
--- a/CypressFileTreeReader.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressFileTreeReader.st Tue Sep 18 10:40:17 2012 +0000
@@ -25,6 +25,157 @@
"
! !
+!CypressFileTreeReader methodsFor:'defaults-filenames'!
+
+defaultFileNameForProperties
+ ^ 'properties.json'
+
+ "Created: / 18-09-2012 / 09:44:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressFileTreeReader methodsFor:'reading-model'!
+
+readClass: name from: directory
+ | clsdir cls |
+
+ clsdir := directory / name.
+ clsdir exists ifFalse:[
+ clsdir := clsdir withSuffix: self defaultFileSuffixForClass.
+ ].
+ clsdir exists ifFalse:[
+ self error: 'No such class in ', directory pathName.
+ ^nil.
+ ].
+
+ cls := CypressClass new.
+ self
+ readPropertiesFor: cls from: clsdir;
+ readMethodsFor: cls from: clsdir.
+ ^cls
+
+ "Created: / 18-09-2012 / 09:54:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readMethod: name from: directory
+ | mthdfile mthd |
+
+ mthdfile := directory / name.
+ mthdfile exists ifFalse:[
+ mthdfile := mthdfile withSuffix: self defaultFileSuffixForMethod.
+ ].
+ mthdfile exists ifFalse:[
+ self error: 'No such method in ', directory pathName.
+ ^nil.
+ ].
+
+ mthd := CypressMethod new.
+ mthdfile readingFileDo:[:s|
+ mthd category: s nextLine.
+ mthd source: s upToEnd.
+ ].
+ ^mthd
+
+ "Created: / 18-09-2012 / 10:03:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readPackage: name from: directory
+ | pkgdir pkg |
+
+ pkgdir := directory / name.
+ pkgdir exists ifFalse:[
+ pkgdir := pkgdir withSuffix: self defaultFileSuffixForPackage.
+ ].
+ pkgdir exists ifFalse:[
+ self error: 'No such package in ', directory pathName.
+ ^nil.
+ ].
+
+ pkg := CypressPackage new.
+ self
+ readPropertiesFor: pkg from: pkgdir;
+ readClassesFor: pkg from: pkgdir;
+ readExtensionsFor: pkg from: pkgdir.
+ ^pkg
+
+ "Created: / 18-09-2012 / 09:43:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressFileTreeReader methodsFor:'reading-utils'!
+
+readClassesFor: pkg from: directory
+
+ directory directoryContentsAsFilenamesDo:[:each|
+ each suffix = self defaultFileSuffixForClass ifTrue:[
+ pkg classes add: (self readClass: each baseName from: directory)
+ ]
+ ]
+
+ "Created: / 18-09-2012 / 09:52:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readExtensionsFor: pkg from: directory
+
+ directory directoryContentsAsFilenamesDo:[:each|
+ each suffix = self defaultFileSuffixForExtensions ifTrue:[
+ | clsname dir |
+
+ clsname := each withoutSuffix baseName.
+ dir := each / 'class'.
+ dir exists ifTrue:[
+ self readMethodsForClassNamed: clsname meta: true from: dir into: pkg extensions.
+ ].
+ dir := each / 'instance'.
+ dir exists ifTrue:[
+ self readMethodsForClassNamed: clsname meta: false from: dir into: pkg extensions.
+ ]
+
+ ]
+ ]
+
+ "Created: / 18-09-2012 / 10:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readMethodsFor: cls from: directory
+ | dir |
+
+ (dir := directory / 'class') exists ifTrue:[
+ self readMethodsForClassNamed: cls name meta: true from: dir into: cls methods
+ ].
+ (dir := directory / 'instance') exists ifTrue:[
+ self readMethodsForClassNamed: cls name meta: false from: dir into: cls methods
+ ]
+
+ "Created: / 18-09-2012 / 09:56:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readMethodsForClassNamed: clsname meta: isClassMethod from: dir into: collection
+
+ dir directoryContentsAsFilenamesDo:[:each|
+ each suffix = 'st' ifTrue:[
+ | mthd |
+
+ mthd := self readMethod: each baseName from: dir.
+ mthd meta: isClassMethod.
+ mthd klass: clsname.
+ collection add: mthd.
+ ]
+ ]
+
+ "Created: / 18-09-2012 / 10:07:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readPropertiesFor: model from: directory
+ | props propFile |
+
+ propFile := directory / self defaultFileNameForProperties.
+ props := propFile exists
+ ifTrue:[CypressJSONReader parse: propFile]
+ ifFalse:[Dictionary new].
+ model properties: props.
+
+ "Created: / 18-09-2012 / 09:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressFileTreeReader class methodsFor:'documentation'!
version_SVN
--- a/CypressMethod.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressMethod.st Tue Sep 18 10:40:17 2012 +0000
@@ -27,17 +27,39 @@
!CypressMethod methodsFor:'accessing'!
category
- ^ category
+ ^ category ? '* as yet unclassified *'
+
+ "Modified: / 18-09-2012 / 10:56:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+category:something
+ category := something.
+!
+
+fullClassName
+ ^meta == true
+ ifTrue:[klass , ' class']
+ ifFalse:[klass]
+
+ "Created: / 18-09-2012 / 10:54:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
klass
^ klass
!
+klass:something
+ klass := something.
+!
+
meta
^ meta
!
+meta:something
+ meta := something.
+!
+
selector
^self name
@@ -46,6 +68,27 @@
source
^ source
+!
+
+source:aString
+ source := aString.
+ name := (Parser parseMethodSpecification: source) selector
+
+ "Modified: / 18-09-2012 / 11:09:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressMethod methodsFor:'converting'!
+
+asChange
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ ^ MethodDefinitionChange new
+ className: self fullClassName;
+ category: self category;
+ source: self source;
+ selector: self name.
+
+ "Modified: / 18-09-2012 / 11:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressMethod methodsFor:'initialization'!
@@ -66,6 +109,16 @@
"Created: / 11-09-2012 / 00:05:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressMethod methodsFor:'private'!
+
+changesInto:aChangeSet
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ ^ aChangeSet add: self asChange
+
+ "Modified: / 18-09-2012 / 10:57:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressMethod class methodsFor:'documentation'!
version_SVN
--- a/CypressModel.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressModel.st Tue Sep 18 10:40:17 2012 +0000
@@ -44,6 +44,38 @@
^properties
"Modified: / 17-09-2012 / 22:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+properties: aDictionary
+ properties := aDictionary
+
+ "Created: / 18-09-2012 / 10:14:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressModel methodsFor:'converting'!
+
+asChange
+ ^self subclassResponsibility
+
+ "Created: / 18-09-2012 / 10:17:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+asChangeSet
+ | cs |
+
+ cs := ChangeSet new.
+ self changesInto: cs.
+ ^cs.
+
+ "Created: / 18-09-2012 / 10:16:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CypressModel methodsFor:'private'!
+
+changesInto: aChangeSet
+ self subclassResponsibility
+
+ "Created: / 18-09-2012 / 10:16:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressModel class methodsFor:'documentation'!
--- a/CypressPackage.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressPackage.st Tue Sep 18 10:40:17 2012 +0000
@@ -38,9 +38,7 @@
classes
classes isNil ifTrue:[
- classes := definition classes collect:[:cls|
- CypressClass fromClass: cls.
- ]
+ classes := OrderedCollection new.
].
^classes
@@ -62,15 +60,23 @@
extensions
extensions isNil ifTrue:[
- extensions := definition extensions collect:[:mthd|
- CypressMethod fromMethod: mthd
- ]
+ extensions := OrderedCollection new.
].
^extensions
"Created: / 11-09-2012 / 11:03:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressPackage methodsFor:'converting'!
+
+asChange
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ ^ self shouldNotImplement
+
+ "Modified: / 18-09-2012 / 10:54:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressPackage methodsFor:'initialization'!
initializeFromDirectory: directory
@@ -88,9 +94,23 @@
at: '_cypress_copyright' put: (definition legalCopyright);
at: '_stx_name' put: name.
+ classes := definition classes collect:[:cls|CypressClass fromClass: cls].
+ extensions := definition extensions collect:[:mthd|CypressMethod fromMethod: mthd].
+
"Created: / 10-09-2012 / 23:35:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressPackage methodsFor:'private'!
+
+changesInto:aChangeSet
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ self classes do:[:each|each changesInto: aChangeSet].
+ self extensions do:[:each|each changesInto: aChangeSet].
+
+ "Modified: / 18-09-2012 / 10:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressPackage methodsFor:'reading & writing'!
writeTo: directory
--- a/CypressRepository.st Mon Sep 17 22:08:34 2012 +0000
+++ b/CypressRepository.st Tue Sep 18 10:40:17 2012 +0000
@@ -64,6 +64,44 @@
self initialize
"Modified: / 17-09-2012 / 22:29:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reader
+ ^readerClass onRepository: self
+
+ "Created: / 18-09-2012 / 09:21:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+readerClass
+ ^ readerClass
+!
+
+readerClass:something
+ readerClass := something.
+!
+
+writer
+ ^writerClass onRepository: self
+
+ "Created: / 17-09-2012 / 22:22:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+writerClass
+ ^ writerClass
+!
+
+writerClass:something
+ writerClass := something.
+! !
+
+!CypressRepository methodsFor:'converting'!
+
+asChange
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ ^ self shouldNotImplement
+
+ "Modified: / 18-09-2012 / 10:18:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressRepository methodsFor:'initialization'!
@@ -89,8 +127,25 @@
"Created: / 17-09-2012 / 22:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!CypressRepository methodsFor:'private'!
+
+changesInto:aChangeSet
+ "superclass CypressModel says that I am responsible to implement this method"
+
+ ^ self shouldNotImplement
+
+ "Modified: / 18-09-2012 / 10:58:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!CypressRepository methodsFor:'writing'!
+read: packageName
+
+ ^self reader readPackage: packageName from: directory
+
+ "Created: / 18-09-2012 / 09:34:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
write: packageIdOrProjectDefinition
self writer writePackage: packageIdOrProjectDefinition asCypressPackage to: directory
@@ -103,12 +158,6 @@
self writer writePackage: packageIdOrProjectDefinition as: nm to: directory
"Created: / 17-09-2012 / 22:23:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-writer
- ^writerClass onRepository: self
-
- "Created: / 17-09-2012 / 22:22:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!CypressRepository class methodsFor:'documentation'!
--- a/Make.proto Mon Sep 17 22:08:34 2012 +0000
+++ b/Make.proto Tue Sep 18 10:40:17 2012 +0000
@@ -181,7 +181,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)CypressAbstractReaderWriter.$(O) CypressAbstractReaderWriter.$(H): CypressAbstractReaderWriter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)CypressJsonParser.$(O) CypressJsonParser.$(H): CypressJsonParser.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)CypressJSONReader.$(O) CypressJSONReader.$(H): CypressJSONReader.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CypressModel.$(O) CypressModel.$(H): CypressModel.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_cypress.$(O) stx_goodies_cypress.$(H): stx_goodies_cypress.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)CypressAbstractReader.$(O) CypressAbstractReader.$(H): CypressAbstractReader.st $(INCLUDE_TOP)/stx/goodies/cypress/CypressAbstractReaderWriter.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec Mon Sep 17 22:08:34 2012 +0000
+++ b/Make.spec Tue Sep 18 10:40:17 2012 +0000
@@ -77,7 +77,7 @@
$(OUTDIR)CypressRepository.$(O) \
$(OUTDIR)CypressAbstractWriter.$(O) \
$(OUTDIR)CypressWriter.$(O) \
- $(OUTDIR)CypressJsonParser.$(O) \
+ $(OUTDIR)CypressJSONReader.$(O) \
$(OUTDIR)CypressAbstractReader.$(O) \
$(OUTDIR)CypressFileTreeReader.$(O) \
$(OUTDIR)CypressReader.$(O) \
--- a/bc.mak Mon Sep 17 22:08:34 2012 +0000
+++ b/bc.mak Tue Sep 18 10:40:17 2012 +0000
@@ -117,7 +117,7 @@
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
$(OUTDIR)CypressAbstractReaderWriter.$(O) CypressAbstractReaderWriter.$(H): CypressAbstractReaderWriter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)CypressJsonParser.$(O) CypressJsonParser.$(H): CypressJsonParser.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)CypressJSONReader.$(O) CypressJSONReader.$(H): CypressJSONReader.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CypressModel.$(O) CypressModel.$(H): CypressModel.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)stx_goodies_cypress.$(O) stx_goodies_cypress.$(H): stx_goodies_cypress.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)CypressAbstractReader.$(O) CypressAbstractReader.$(H): CypressAbstractReader.st $(INCLUDE_TOP)\stx\goodies\cypress\CypressAbstractReaderWriter.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/cypress.rc Mon Sep 17 22:08:34 2012 +0000
+++ b/cypress.rc Tue Sep 18 10:40:17 2012 +0000
@@ -3,7 +3,7 @@
// automagically generated from the projectDefinition: stx_goodies_cypress.
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,2,14,14
+ FILEVERSION 6,2,16,16
PRODUCTVERSION 6,2,3,1
#if (__BORLANDC__)
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
BEGIN
VALUE "CompanyName", "Jan Vrany\0"
VALUE "FileDescription", "Cypress Package Format Reader/Writer (LIB)\0"
- VALUE "FileVersion", "6.2.14.14\0"
+ VALUE "FileVersion", "6.2.16.16\0"
VALUE "InternalName", "stx:goodies/cypress\0"
VALUE "LegalCopyright", "Copyright Jan Vrany & Dale Henrichs 2012\0"
VALUE "ProductName", "Cypress\0"
VALUE "ProductVersion", "6.2.3.1\0"
- VALUE "ProductDate", "Mon, 17 Sep 2012 21:53:17 GMT\0"
+ VALUE "ProductDate", "Tue, 18 Sep 2012 10:41:05 GMT\0"
END
END