CypressModel.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 10 Sep 2012 23:52:10 +0000
changeset 11 333528cd629a
child 12 ec118792047a
permissions -rw-r--r--
- Cypress refactoring - towards a lot simpler code

"{ Package: 'stx:goodies/cypress' }"

Object subclass:#CypressModel
	instanceVariableNames:'name properties'
	classVariableNames:''
	poolDictionaries:''
	category:'Cypress-New-Model'
!

!CypressModel class methodsFor:'documentation'!

documentation
"
    An abstract class to model packages, classes and methods.

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!CypressModel methodsFor:'accessing'!

name
    ^ name
!

name:something
    name := something.
!

package
    "Returns a CypressPackage which the receiver belongs to"

    ^self subclassResponsibility

    "Created: / 10-09-2012 / 23:42:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

properties
    ^ properties
! !

!CypressModel methodsFor:'reading & writing'!

readFrom: filename
    "Initializes the receiver from directory/file named 'filename'"

    self subclassResponsibility

    "Created: / 11-09-2012 / 00:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

writeTo: filename notice: copyrightNotice
    "Writes the receiver into directory/file named 'filename'
     with given copyrightNotice"

    self subclassResponsibility

    "Created: / 11-09-2012 / 00:16:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CypressModel methodsFor:'reading & writing - private'!

writePropertiesTo: directory notice: copyrightNotice
    | props propertyFile |

    props := self properties.
    props isEmpty ifTrue:[ ^ self ].
    propertyFile := directory / 'properties.ston'.
    propertyFile writingFileDo:[:s|
        props copy;
            at: '_cypress_copyright' put: copyrightNotice;
            writeCypressJsonOn: s forHtml: false indent: 0.
    ]

    "Created: / 11-09-2012 / 00:24:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CypressModel class methodsFor:'documentation'!

version_SVN
    ^ '$Id::                                                                                                                        $'
! !