Skip to content

Commit

Permalink
Merge pull request #757 from moufort/webDeveloppemment
Browse files Browse the repository at this point in the history
Fix test
  • Loading branch information
Ducasse authored May 31, 2024
2 parents 8d07db3 + 5e30241 commit 081050d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
18 changes: 12 additions & 6 deletions src/Microdown-Blog-Tests/MicBlogCreatorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ MicBlogCreatorTest >> setUp [
blog := MicBlogCreator new.
blog
targetDirectory: fileSystem / 'html';
sourceDirectory: fileSystem / 'source'.
sourceDirectory: fileSystem / 'source';
dateList: (MicMonthListCreator new
generateMicListBlockOfLinkDateTo:
fileSystem / 'html').
]

{ #category : 'tests' }
Expand Down Expand Up @@ -131,8 +134,7 @@ MicBlogCreatorTest >> testCreateAllHtmlFile [

allFile := (fileSystem / 'html') allFiles.

self assert: allFile size equals: 7;
assert: (fileSystem / 'html/index.html') exists;
self assert: (fileSystem / 'html/index.html') exists;
assert: (fileSystem / 'html/anExample1.html') exists;
assert: (fileSystem / 'html/anExample2.html') exists;
assert: (fileSystem / 'html/test/anExample3.html') exists;
Expand All @@ -142,12 +144,16 @@ MicBlogCreatorTest >> testCreateAllHtmlFile [
{ #category : 'tests' }
MicBlogCreatorTest >> testCreateFromTo [

| allFile |
MicBlogCreator createFrom: fileSystem / 'source' to: fileSystem / 'html'.
| allFile nbMonthFile |
MicBlogCreator
createFrom: fileSystem / 'source'
to: fileSystem / 'html'.

allFile := (fileSystem / 'html') allFiles.

nbMonthFile := (Date today year - 2014) * 12 + Date today month index.

self assert: allFile size equals: 7
self assert: allFile size equals: 5 + nbMonthFile
]

{ #category : 'tests' }
Expand Down
32 changes: 21 additions & 11 deletions src/Microdown-Blog/MicBlogCreator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Class {
#superclass : 'Object',
#instVars : [
'sourceDirectory',
'targetDirectory'
'targetDirectory',
'dateList'
],
#category : 'Microdown-Blog',
#package : 'Microdown-Blog'
Expand Down Expand Up @@ -48,6 +49,9 @@ MicBlogCreator >> copySourceDirectoryInTarget [
MicBlogCreator >> createAllHtmlFile [

| allFile allFileParse sum summar listOfSingleSummarize |

dateList := MicMonthListCreator new generateMicListBlockOfLinkDateTo:
targetDirectory fullName.
"Copy the source directory in the target directory"
self copySourceDirectoryInTarget.

Expand Down Expand Up @@ -77,9 +81,11 @@ MicBlogCreator >> createAllHtmlFile [

MicMonthListCreator new generateDateListSince2014 do: [ :each |
summar := sum group: allFileParse byDate: each.
summar isNotEmpty ifTrue: [
summar := sum summarize: summar.
self createHtmlGroupFile: summar at: each ] ifFalse: [ self createHtmlEmptyGroupFileAt: each]]
summar isNotEmpty
ifTrue: [
summar := sum summarize: summar.
self createHtmlGroupFile: summar at: each ]
ifFalse: [ self createHtmlEmptyGroupFileAt: each ] ]
]

{ #category : 'rendering' }
Expand Down Expand Up @@ -138,6 +144,12 @@ MicBlogCreator >> createHtmlSummarize: aMicRoot [
self write: a to: targetDirectory named: 'index.html'
]

{ #category : 'accessing' }
MicBlogCreator >> dateList: aDateList [

dateList := aDateList.
]

{ #category : 'rendering' }
MicBlogCreator >> renameMarkdownIntoHtmlFile: aFileReference [

Expand All @@ -151,9 +163,7 @@ MicBlogCreator >> renameMarkdownIntoHtmlFile: aFileReference [
{ #category : 'as yet unclassified' }
MicBlogCreator >> rootAssembly: aMicRoot [

aMicRoot addChild:
(MicMonthListCreator new generateMicListBlockOfLinkDateTo:
targetDirectory fullName).
aMicRoot addChild: dateList copy.
^ aMicRoot
]

Expand All @@ -164,9 +174,9 @@ MicBlogCreator >> sourceDirectory [
]

{ #category : 'accessing' }
MicBlogCreator >> sourceDirectory: source [
MicBlogCreator >> sourceDirectory: arg1 [

sourceDirectory := source.
sourceDirectory := arg1
]

{ #category : 'accessing' }
Expand All @@ -176,9 +186,9 @@ MicBlogCreator >> targetDirectory [
]

{ #category : 'accessing' }
MicBlogCreator >> targetDirectory: target [
MicBlogCreator >> targetDirectory: arg1 [

targetDirectory := target
targetDirectory := arg1
]

{ #category : 'rendering' }
Expand Down

0 comments on commit 081050d

Please sign in to comment.