Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* added support for repository level properties.json file

* fixed JSON>>parseNumber
  • Loading branch information...
commit 8a247e49e88d3503f88c0e3cd7c0fa7c4440b593 1 parent 5d77968
@mkobetic mkobetic authored
Showing with 49 additions and 24 deletions.
  1. BIN  STIG.pcl
  2. +1 −1  STIG.pst
  3. +3 −2 packages/STIG-Json.package/JSON.class/instance/parseNumber.st
  4. +4 −0 packages/STIG.package/CypressLayout.class/instance/commentFile.st
  5. +6 −0 packages/STIG.package/CypressLayout.class/instance/format..st
  6. +4 −0 packages/STIG.package/CypressLayout.class/instance/propertyFile.st
  7. +2 −2 packages/STIG.package/CypressLayout.class/instance/readBoundVariable..st
  8. +2 −2 packages/STIG.package/CypressLayout.class/instance/readClass.using..st
  9. +1 −1  packages/STIG.package/CypressLayout.class/instance/readNamespace.using..st
  10. +2 −2 packages/STIG.package/CypressLayout.class/instance/readPackage..st
  11. +2 −2 packages/STIG.package/CypressLayout.class/instance/saveClass..st
  12. +1 −1  packages/STIG.package/CypressLayout.class/instance/saveMethod..st
  13. +2 −2 packages/STIG.package/CypressLayout.class/instance/saveNamespace..st
  14. +2 −2 packages/STIG.package/CypressLayout.class/instance/savePackage..st
  15. +1 −1  packages/STIG.package/CypressLayout.class/instance/saveProperty..st
  16. +4 −1 packages/STIG.package/CypressLayout.class/properties.json
  17. +10 −5 packages/STIG.package/DirectoryLayout.class/class/root..st
  18. +2 −0  packages/STIG.package/DirectoryLayout.class/instance/format..st
View
BIN  STIG.pcl
Binary file not shown
View
2  STIG.pst
1 addition, 1 deletion not shown
View
5 packages/STIG-Json.package/JSON.class/instance/parseNumber.st
@@ -1,7 +1,8 @@
private-parsing
parseNumber
- | number |
+ | number digit |
number := String new writeStream.
- [ (char := self get) isDigit ] whileTrue: [ number nextPut: char ].
+ [ (digit := self get) isDigit ] whileTrue: [ number nextPut: digit ].
+ char := digit.
^Number readFrom: number contents readStream
View
4 packages/STIG.package/CypressLayout.class/instance/commentFile.st
@@ -0,0 +1,4 @@
+accessing
+commentFile
+
+ ^commentFile ifNil: [ commentFile := CommentFile ]
View
6 packages/STIG.package/CypressLayout.class/instance/format..st
@@ -0,0 +1,6 @@
+accessing
+format: properties
+
+ (properties at: 'version' ifAbsent: nil) ifNotNil: [ :v | version := v ].
+ (properties at: 'commentFile' ifAbsent: nil) ifNotNil: [ :v | commentFile := v ].
+ (properties at: 'propertyFile' ifAbsent: nil) ifNotNil: [ :v | propertyFile := v ].
View
4 packages/STIG.package/CypressLayout.class/instance/propertyFile.st
@@ -0,0 +1,4 @@
+accessing
+propertyFile
+
+ ^propertyFile ifNil: [ propertyFile := PropertyFile ]
View
4 packages/STIG.package/CypressLayout.class/instance/readBoundVariable..st
@@ -2,8 +2,8 @@ loading
readBoundVariable: variable
variable directoryContentsDo: [:eachFile :eachTail |
- (eachFile isDirectory or: [ eachTail = CommentFile ]) ifFalse: [
- eachTail = PropertyFile
+ (eachFile isDirectory or: [ eachTail = self commentFile ]) ifFalse: [
+ eachTail = self propertyFile
ifTrue: [ (variable name endsWith: '.pool')
ifTrue: [self readNamespace: eachFile using: variable]
ifFalse: [self readClass: eachFile using: variable ] ]
View
4 packages/STIG.package/CypressLayout.class/instance/readClass.using..st
@@ -15,9 +15,9 @@ readClass: aFilename using: fromDisk
blueprint classInstanceVariables: (properties at: 'classinstvars' ifAbsent: [Array new]).
blueprint attributes: (properties at: 'attributes' ifAbsent: [ Array new ]).
blueprint behaviorType: (properties at: 'type' ifAbsent: [ #none ]).
- blueprint comment: ((file := aFilename directory / CommentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
+ blueprint comment: ((file := aFilename directory / self commentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
superref := ((properties at: 'superNamespace' ifAbsent: [nil]) ifNil: [''] ifNotNil: [ :ns | ns, '.' ]), (properties at: 'super').
blueprint superclassReference: (Compiler evaluate: superref) fullName asQualifiedReference makeUnambiguous.
- blueprint comment: ((file := aFilename directory / CommentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
+ blueprint comment: ((file := aFilename directory / self commentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
fromDisk addBlueprint: blueprint.
^fromDisk
View
2  packages/STIG.package/CypressLayout.class/instance/readNamespace.using..st
@@ -10,6 +10,6 @@ readNamespace: aFilename using: fromDisk
blueprint reference: reference.
blueprint importsString: (self decodeImportsString: (properties at: 'imports' ifAbsent: [''])).
blueprint isPrivate: (properties at: 'private' ifAbsent: [ false ]).
- blueprint comment: ((file := aFilename directory / CommentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
+ blueprint comment: ((file := aFilename directory / self commentFile) exists ifTrue: [fromDisk fileContents: file] ifFalse: ['']).
fromDisk addBlueprint: blueprint.
^fromDisk
View
4 packages/STIG.package/CypressLayout.class/instance/readPackage..st
@@ -5,6 +5,6 @@ readPackage: package
eachFile isDirectory
ifTrue: [ (BoundVariableFromDisk parent: package directory: eachFile name: eachTail) read: self ]
ifFalse: [
- eachTail = CommentFile ifTrue: [ self readComment: eachFile using: package ].
- eachTail = PropertyFile ifTrue: [ self readProperties: eachFile using: package ] ] ].
+ eachTail = self commentFile ifTrue: [ self readComment: eachFile using: package ].
+ eachTail = self propertyFile ifTrue: [ self readProperties: eachFile using: package ] ] ].
^package
View
4 packages/STIG.package/CypressLayout.class/instance/saveClass..st
@@ -5,7 +5,7 @@ saveClass: blueprint
name := blueprint reference name.
path := (Array with: blueprint packageName, '.package' with: name, '.class').
blueprint comment size = 0 ifFalse: [
- self path: path tail: CommentFile write: [ :ws | ws nextPutAll: blueprint comment] ].
+ self path: path tail: self commentFile write: [ :ws | ws nextPutAll: blueprint comment] ].
properties := Dictionary new.
properties at: 'name' put: name.
(IgnoredNamespaces includes: (ns := blueprint reference environment)) ifFalse: [
@@ -20,4 +20,4 @@ saveClass: blueprint
blueprint importsString isEmpty ifFalse: [ properties at: 'imports' put: (self encodeImportsString: blueprint) ].
blueprint isPrivate ifTrue: [ properties at: 'private' put: blueprint isPrivate ].
blueprint attributes isEmpty ifFalse: [ properties at: 'attributes' put: blueprint attributes ].
- self path: path tail: PropertyFile write: [ :ws | properties jsonWriteOn: ws ]
+ self path: path tail: self propertyFile write: [ :ws | properties jsonWriteOn: ws ]
View
2  packages/STIG.package/CypressLayout.class/instance/saveMethod..st
@@ -11,7 +11,7 @@ saveMethod: blueprint
properties := Dictionary new at: 'name' put: reference name; yourself.
(IgnoredNamespaces includes: reference environment) ifFalse: [
properties at: 'namespace' put: reference environment fullName ].
- self path: dir tail: PropertyFile write: [ :ws | properties jsonWriteOn: ws ].
+ self path: dir tail: self propertyFile write: [ :ws | properties jsonWriteOn: ws ].
dir ] ].
path := classDirectory copyWith: (blueprint isInstanceBehavior ifTrue: ['instance'] ifFalse: ['class']).
tail := self encodeSelector: blueprint selector.
View
4 packages/STIG.package/CypressLayout.class/instance/saveNamespace..st
@@ -5,11 +5,11 @@ saveNamespace: aNamespaceBlueprint
name := aNamespaceBlueprint reference name.
path := Array with: aNamespaceBlueprint packageName, '.package' with: aNamespaceBlueprint reference name, '.pool'.
aNamespaceBlueprint comment size = 0 ifFalse: [
- self path: path tail: CommentFile write: [ :ws | ws nextPutAll: aNamespaceBlueprint comment ] ].
+ self path: path tail: self commentFile write: [ :ws | ws nextPutAll: aNamespaceBlueprint comment ] ].
properties := Dictionary new.
properties at: 'name' put: name.
(IgnoredNamespaces includes: (ns := aNamespaceBlueprint reference environment)) ifFalse: [
properties at: 'namespace' put: ns fullName ].
aNamespaceBlueprint importsString isEmpty ifFalse: [ properties at: 'imports' put: (self encodeImportsString: aNamespaceBlueprint) ].
aNamespaceBlueprint isPrivate ifTrue: [ properties at: 'private' put: aNamespaceBlueprint isPrivate ].
- self path: path tail: PropertyFile write: [ :ws | properties jsonWriteOn: ws ]
+ self path: path tail: self propertyFile write: [ :ws | properties jsonWriteOn: ws ]
View
4 packages/STIG.package/CypressLayout.class/instance/savePackage..st
@@ -4,7 +4,7 @@ savePackage: package
| path blueprints comment |
path := Array with: package packageName, '.package'.
(comment := package imagePackage comment) size = 0 ifFalse: [
- self path: path tail: CommentFile write: [ :ws | ws nextPutAll: comment] ].
+ self path: path tail: self commentFile write: [ :ws | ws nextPutAll: comment] ].
blueprints := package imagePackage propertyBlueprints reject: [ :bp | IgnoredProperties includes: bp key ].
blueprints := blueprints inject: Dictionary new into: [ :d :bp | d at: bp key put: bp value; yourself ].
- self path: path tail: PropertyFile write: [ :ws | blueprints jsonWriteOn: ws ]
+ self path: path tail: self propertyFile write: [ :ws | blueprints jsonWriteOn: ws ]
View
2  packages/STIG.package/CypressLayout.class/instance/saveProperty..st
@@ -6,5 +6,5 @@ saveProperty: aPropertyBlueprint
path := Array with: aPropertyBlueprint codeComponentName.
self
path: path
- tail: CommentFile
+ tail: self commentFile
write: [:ws | ws nextPutAll: aPropertyBlueprint value]
View
5 packages/STIG.package/CypressLayout.class/properties.json
@@ -1,6 +1,9 @@
{ "classinstvars" : [ "specials" ],
"instvars" : [ "classPaths",
- "definedClasses" ],
+ "definedClasses",
+ "commentFile",
+ "propertyFile",
+ "version" ],
"name" : "CypressLayout",
"namespace" : "STIG",
"super" : "DirectoryLayout",
View
15 packages/STIG.package/DirectoryLayout.class/class/root..st
@@ -1,8 +1,13 @@
instance creation
root: dir
- | type file |
- type := (file := dir asFilename / 'properties.json') exists
- ifTrue: [ self halt ]
- ifFalse: [ DefaultLayout ].
- ^type new root: dir
+ | layout file |
+ layout := (file := dir asFilename / 'properties.json') exists
+ ifTrue: [ | properties formatName |
+ properties := JSON read: file contentsOfEntireFile readStream.
+ formatName := properties at: 'format'.
+ (self allSubclasses detect: [ :c | c name sameAs: formatName ]) new
+ format: properties;
+ yourself ]
+ ifFalse: [ DefaultLayout new ].
+ ^layout root: dir
View
2  packages/STIG.package/DirectoryLayout.class/instance/format..st
@@ -0,0 +1,2 @@
+accessing
+format: properties

0 comments on commit 8a247e4

Please sign in to comment.
Something went wrong with that request. Please try again.