forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_notes_builder.livecodescript
More file actions
740 lines (637 loc) · 27.1 KB
/
Copy pathrelease_notes_builder.livecodescript
File metadata and controls
740 lines (637 loc) · 27.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
script "ReleaseNotesBuilder"
/*
This stack implements the command "compileReleaseNotes <release number>"
which creates a pdf file of the release notes from various markdown files.
The notes directory should contain
- "platforms.md" and "setup.md"
- optional files "issues.md" containing any known issues, "proposed_changes.md" and "user_guide_changes.md"
- an optional file "overview.md", if this release has any specific focus or direction
- the feature and bugfix files used to generate the notes.
Each file details a single bug fix or feature implementation, according to the following specifications:
The file should be named "bugfix-<bug number>.md" or "feature-<feature number>.md".
It should have a title as the first line, prefixed by a hash symbol.
# <title>
For images, use the syntax

The image must be named bugfix-<bug number>-<image number>.<extension>
Otherwise the file should be LiveCode flavoured Markdown.
Single line files will be added to the table of sepcific bug fixes along with a link to their entry
on Bugzilla. Multiline files will have their own subsection in the release notes.
*/
global gExperimental, gPageBreak, gAnchor
function releaseNotesCSS
return url ("file:" & builderSystemFolder() & slash & "release_notes_css_prefix.txt")
end releaseNotesCSS
command releaseNotesBuilderInitialize
start using stack (builderSystemFolder() & slash & "markdown_compiler.livecodescript")
put 1 into gAnchor
put "<p style=" & quote & "color:red; font-weight:bold" & quote & ">Important: This feature is currently experimental. " into gExperimental
put gExperimental & "This means that it may not be complete, or may fail in some circumstances that you would expect it to work. " into gExperimental
put gExperimental & "Please do not be afraid to try it out as we need feedback to develop it further.</p>" & CR into gExperimental
put CR & "<div style=" & quote & "page-break-after: always;" & quote & "><span style=" & quote & "display: none;" & quote & "> </span></div>" & CR into gPageBreak
set the defaultfolder to builderRepoFolder()
set hideconsolewindows to true
end releaseNotesBuilderInitialize
command releaseNotesBuilderFinalize
stop using stack (builderSystemFolder() & slash & "markdown_compiler.livecodescript")
end releaseNotesBuilderFinalize
command releaseNotesBuilderRun pEdition, pVersion, pReleaseType, pOutputDir
builderLog "report", "Building release notes for version" && pVersion
releaseNotesBuilderInitialize
local tTags
put shell("git tag") into tTags
sortTags tTags
local tContents
local tBody
builderLog "message", "Creating base release notes"
local tOverview
put notesFileToHTML("overview.md", pVersion, tContents) into tOverview
if tOverview is empty then
put tBody & newSection("Overview", 1, tContents) into tBody
put "This document describes all the changes that have been made for LiveCode " & pVersion & ", including bug fixes and new syntax." into tOverview
end if
put tBody & tOverview & CR into tBody
local tIssues
put notesFileToHTML("issues.md", pVersion, tContents) into tIssues
if tIssues is empty then
put tBody & newSection("Known Issues", 1, tContents) into tBody
put "There are no known issues with this release." into tIssues
end if
put tBody & tIssues & CR into tBody
put tBody & notesFileToHTML("platforms.md", pVersion, tContents) into tBody
put tBody & gPageBreak into tBody
put tBody & notesFileToHTML("setup.md", pVersion, tContents) into tBody
put tBody & notesFileToHTML("proposed_changes.md", pVersion, tContents) into tBody
put tBody & gPageBreak into tBody
put tBody & newSection("Engine changes", 1, tContents) into tBody
builderLog "message", "Adding entries for bugfixes and features"
local tUpdateFeatures
local tUpdateBugs
put tBody & notesFolderToHTML(false, notesPath(), pVersion, tTags, tContents, tUpdateFeatures, tUpdateBugs) into tBody
put tBody & newSection("IDE changes", 1, tContents) into tBody
builderLog "message", "Adding entries for ide bugfixes and features"
put tBody & notesFolderToHTML(true, notesPath(), pVersion, tTags, tContents, tUpdateFeatures, tUpdateBugs) into tBody
put tBody & gPageBreak into tBody
put tBody & newSection("LiveCode Builder changes", 1, tContents) into tBody
builderLog "message", "Adding entries for lcb bugfixes and features"
put tBody & notesFolderLCBToHTML(pVersion, tTags, tContents) into tBody
put tBody & gPageBreak into tBody
builderLog "message", "Adding entries for dictionary and user guide changes"
local tChangeList
local tChangeStatusList
getDictionaryChanges pVersion, tTags, tChangeStatusList, tChangeList
if tChangeStatusList is not empty then
put tBody & newSection("Dictionary additions", 1, tContents) into tBody
put tBody & "<ul>" & CR & tChangeStatusList & "</ul>" into tBody
end if
local tUserGuideChanges
put notesFileToHTML("user_guide_changes.md", pVersion, tContents) into tUserGuideChanges
if tUserGuideChanges is not empty then
put tBody & tUserGuideChanges into tBody
end if
if tChangeList is not empty then
put tBody & newSection("Dictionary changes", 1, tContents) into tBody
put tBody & "<ul>" & CR & tChangeList & "</ul>" into tBody
end if
put tBody & gPageBreak into tBody
builderLog "message", "Adding links to previous notes"
put tBody & newSection("Previous Release Notes", 1, tContents) into tBody
put tBody & getPastNotes(tTags) into tBody
local tNotesFileURL
local tNotesFile
local tOutputDir
if pOutputDir is empty then
put builderRepoFolder() & slash & targetPath() into tOutputDir
else
put pOutputDir into tOutputDir
end if
builderEnsureFolder tOutputDir
put tOutputDir & slash & "LiveCodeNotes-" & replaceText(pVersion, "[-,\.]", "_") into tNotesFile
put "file:" & tNotesFile & ".html" into tNotesFileURL
local tNotesPrefix
local tNotesSuffix
local tTitle
put "LiveCode " & pVersion & " Release Notes" into tTitle
put "<html><br>" & CR & releaseNotesCSS() & CR into tNotesPrefix
put tNotesPrefix & "<h1 style = " & quote & "text-align : center" & quote & ">" & tTitle & "</h1>" & CR into tNotesPrefix
put tNotesPrefix & "<h2>Table of contents</h2>" & CR into tNotesPrefix
put "</html>" into tNotesSuffix
put tNotesPrefix & tContents & gPageBreak & tBody & tNotesSuffix into url tNotesFileURL
builderLog "message", "Converting release notes to PDF"
HTMLToPDF tNotesFile, tTitle
builderLog "message", "Copying PDF release notes into IDE"
put URL ("binfile:" & tNotesFile & ".pdf") into URL ("binfile:" & builderIDEFolder() & "/Release Notes.pdf")
builderLog "message", "Generating updater text"
local tUpdateText
filter tUpdateFeatures without ""
filter tUpdateBugs without ""
exportUpdateText pVersion, tUpdateFeatures, tUpdateBugs, pReleaseType
put the result into tUpdateText
releaseNotesBuilderFinalize
builderLog "report", "Building release notes for version" && pVersion && "complete"
return tUpdateText
end releaseNotesBuilderRun
command HTMLToPDF pName, pTitle
local tShell
local tOptions
local tCommand
put " --header-right " & quote & pTitle & " " & the date & quote into tOptions
put tOptions & " --header-font-size 8 --header-spacing 5 --footer-center [page] --footer-font-size 8 --footer-spacing 5 " into tOptions
put tOptions & "--margin-top 30 --margin-bottom 20 --margin-left 20 --margin-right 20 --enable-internal-links " into tOptions
if $WKHTMLTOPDF is empty then
put builderRepoFolder() & slash & "builder" & slash & "wkhtmltopdf" into tCommand
else
put $WKHTMLTOPDF into tCommand
end if
put quote & tCommand & quote & tOptions & pName & ".html " & pName & ".pdf" into tShell
get shell(tShell)
if the result is not 0 then
builderLog "error", "Failed to run wkhtmltopdf"
throw "wkhtmltopdf failed"
end if
end HTMLToPDF
function getPastNotes pTags
local tNumTags
filter pTags without "*rc*"
filter pTags without "*dp*"
put number of lines in pTags into tNumTags
local tTable
put "<table>" & CR into tTable
local i
put 1 into i
local tLink
repeat while i < 21 and i < tNumTags + 1
local tVersion
put line -i of pTags into tVersion
put tTable & "<tr>" & CR & "<td>" & tVersion & " Release Notes</td>" & CR into tTable
put replaceText(tVersion, "\.", "_") into tVersion
put "http://downloads.livecode.com/livecode/" & tVersion & "/LiveCodeNotes-" & tVersion & ".pdf" into tLink
put tTable & "<td><a href=" & quote & tLink & quote & ">" & tLink & "</a></td>" & CR into tTable
put tTable & "</tr>" & CR into tTable
add 1 to i
end repeat
put tTable & "</table>" into tTable
return tTable
end getPastNotes
function newSection pSection, pLevel, @xContents
local tSection
put "<h" & pLevel + 1 & " " & getAnchor(pSection) & ">" & pSection & "</h" & pLevel + 1 & ">" & CR into tSection
appendLink pLevel, pSection, xContents
return tSection
end newSection
function notesFileToHTML pFileName, pVersion, @xContents
local tFileUrl
local tFileText
local tBody
put empty into tBody
put "file:" & notesPath() & slash & pFileName into tFileUrl
put url tFileUrl into tFileText
if tFileText is not empty then
replace "<version>" with pVersion in tFileText
put markdownToHTML(tFileText, 1, 0, xContents, true) into tBody
end if
return tBody
end notesFileToHTML
function makeBugTable pBugs, pBold
local tBugs
local tNoID
local tBugTable
local tBugUrl
local tBold
put "<table>" into tBugTable
repeat for each line tLine in pBugs
if item 1 of tLine is not a number then
put tNoID & CR & "<tr><td></td>" & CR into tNoID
if pBold then
put tNoID & "<td><strong>" & item 2 of tLine & "</strong></td></tr>" into tNoID
else
put tNoID & "<td>" & item 2 of tLine & "</td></tr>" into tNoID
end if
else
put "http://quality.livecode.com/show_bug.cgi?id=" & item 1 of tLine into tBugUrl
if pBold then
put tBugs & CR & "<tr><td><strong>" & item 1 of tLine & "</strong></td>" & CR into tBugs
put tBugs & "<td><a href=" & quote & tBugUrl & quote & "><strong>" & item 2 of tLine & "</strong></a></td></tr>" into tBugs
else
put tBugs & CR & "<tr><td>" & item 1 of tLine & "</td>" & CR into tBugs
put tBugs & "<td><a href=" & quote & tBugUrl & quote & ">" & item 2 of tLine & "</a></td></tr>" into tBugs
end if
end if
end repeat
put tBugTable & tNoID & tBugs & CR & "</table>" into tBugTable
return tBugTable
end makeBugTable
function getTerms pFileList
local tTermList, tFile, tTerm
repeat for each line tLine in pFileList
put url ("file:" & tLine) into tFile
get matchText(tFile, "<term>(.*)</term>", tTerm)
put tTermList & tTerm & CR into tTermList
end repeat
filter tTermList without empty
return tTermList
end getTerms
command getDictionaryChanges pVersion, pTags, @rStatusList, @rOtherList
put empty into rStatusList
put empty into rOtherList
local tFrom, tExtension
if pVersion begins with "8.0" then
put "f9fb4130b570fd7df3b8e1526bbfe6074e798098" into tFrom #initial commit of dictionary
put "lcdoc" into tExtension
set the wholematches to false
else
put "xml" into tExtension
if pVersion begins with "6.1" or pVersion is empty then
put "81c1b70f3c86c0a85a184c8773001570ba2c7559" into tFrom #initial commit of dictionary
else
local tIndex
put the number of lines in pTags into tIndex
repeat while tIndex > 1 and line tIndex of pTags begins with char 1 to 3 of pVersion
subtract 1 from tIndex
end repeat
put line tIndex of pTags into tFrom
end if
end if
local tModifiedEntries
put shell("git diff --name-only " & tFrom & "...HEAD -- " & dictPath()) into tModifiedEntries
repeat for each line tLine in tModifiedEntries
local tFile
if there is not a file (item 1 of tLine) then next repeat
if not (tLine ends with tExtension) then next repeat
put url ("file:" & item 1 of tLine) into tFile
if tExtension is "xml" then
local tVersion
local tTree
put revCreateXMLTree(tFile, false, true, false) into tTree
local tName
local tType
local tEntry
put revXMLNodeContents(tTree, "doc/name") into tName
put revXMLNodeContents(tTree, "doc/type") into tType
put "<strong>" & tName & "</strong> (<em>" & tType & "</em>)" into tEntry
put revXMLAttribute(tTree, "doc/history/introduced", "version") into tVersion
else
put word 2 to -1 of line lineOffset("Name:", tFile) of tFile into tName
put word 2 to -1 of line lineOffset("Type:", tFile) of tFile into tType
put word 2 to -1 of line lineOffset("Introduced:", tFile) of tFile into tVersion
put "<strong>" & tName & "</strong> (<em>" & tType & "</em>)" into tEntry
end if
if (pVersion begins with tVersion) then
#it was added in this version
put rStatusList & "<li>" & tEntry into rStatusList
put rStatusList & " has been added to the dictionary." & CR into rStatusList
else
put rOtherList & "<li>The entry for " & tEntry & " has been updated." & CR into rOtherList
end if
end repeat
end getDictionaryChanges
function fetchNameOnlyDiff pFromTag, pToTag, pPath
return shell("git diff --name-only " & pFromTag & "..." & pToTag & " -- " & pPath)
end fetchNameOnlyDiff
function relevantTags pVersion, pTags
local tEnd
local tStart
repeat for each line tLine in pTags
if tLine begins with char 1 to 3 of pVersion then
exit repeat
end if
add 1 to tStart
end repeat
put line tStart to -1 of pTags into pTags
repeat for each line tLine in pTags
if not (tLine begins with char 1 to 3 of pVersion) then
if not (tEnd is 0) then
exit repeat
end if
end if
add 1 to tEnd
end repeat
put line 1 to tEnd of pTags into pTags
if (pVersion is not line -1 of pTags) then
put pTags & CR & "HEAD" into pTags
end if
return pTags
end relevantTags
function notesFolderToHTML pIsIDE, pFolder, pVersion, pTags, @xContents, @rUpdateFeatures, @rUpdateBugs
local tBody
local tNumTags
put relevantTags(pVersion, pTags) into pTags
put the number of lines in pTags into tNumTags
local tList
local tFirstVersion
local tCurVersion
put line 1 of pTags into tFirstVersion
put line -1 of pTags into tCurVersion
if pIsIDE then
put fetchIDENameOnlyDiff(tFirstVersion, tCurVersion) into tList
else
put fetchNameOnlyDiff(tFirstVersion, tCurVersion, pFolder) into tList
end if
local tDiff
local tId
local tFileText
local tTitle
local tNumLines
local tOneLiners
local tBugNumber
local tBugTable
local tBugTableContents
local tExperimental
local tParsedFile
local tIndex
local tBoldBugs
put tNumTags into tIndex
repeat while tIndex > 1 and tList is not empty
put line tIndex of pTags into tCurVersion
if tCurVersion is "HEAD" or tCurVersion is pVersion then
put true into tBoldBugs
put pVersion into tCurVersion
else
put false into tBoldBugs
end if
if pIsIDE then
put fetchIDENameOnlyDiff(line tIndex - 1 of pTags, line tIndex of pTags) into tDiff
else
put fetchNameOnlyDiff(line tIndex - 1 of pTags, line tIndex of pTags, pFolder) into tDiff
end if
local tBugList
local tFeatureList
put tDiff into tBugList
put tDiff into tFeatureList
filter tBugList with "*bugfix*.md"
filter tFeatureList with "*feature*.md"
set the itemdelimiter to "-"
sort lines in tBugList descending numeric by item 2 of each
sort lines in tFeatureList by item 2 of each
put tFeatureList & CR & tBugList into tDiff
repeat for each line tLine in tDiff
if tLine is among the lines of tList then
local tFile
if pIsIDE then
put "ide/" & tLine into tFile
else
put tLine into tFile
end if
put url ("file:" & tFile) into tFileText
put the number of lines of tFileText into tNumLines
// AL-2014-11-14: Still a one-liner if the bugfix note contains a second empty line
if tNumLines is 2 and word 1 of line 2 of tFileText is empty then
delete line 2 of tFileText
end if
if tLine contains "bugfix" then
local tOffset
get matchText(tLine, "-(.*)\.", tId)
put offset("#", tFileText) into tOffset
put char tOffset+1 to -1 of line 1 of tFileText into tTitle
put tOneLiners & tId & "," & tTitle & CR into tOneLiners
put tId & " - " & tTitle & CR after rUpdateBugs
end if
if tNumLines > 1 and not (tNumLines is 2 and the last line of tFileText is not empty) then
if tLine contains "feature" then put char 2 to -1 of line 1 of tFileText & CR after rUpdateFeatures
put markdownToHTML(tFileText, 2, 1, xContents, true) into tParsedFile
if tParsedFile is not empty then
set the itemdelimiter to "."
replace "<img src=" & quote with "<img src=" & quote & builderRepoFolder() & slash & item 1 to -2 of tLine & "-" in tParsedFile
if line 1 of tParsedFile contains "experimental" then
replace "experimental" with pVersion & " - experimental" in line 1 of tParsedFile
put tParsedFile & gExperimental into tParsedFile
else
put " (" & tCurVersion & ")" after char -6 of line 1 of tParsedFile
end if
put tBody & tParsedFile into tBody
end if
end if
filter tList without tLine
end if
end repeat
if tOneLiners is not empty then
appendBugs tCurVersion, tOneLiners, tBoldBugs, tBugTable, tBugTableContents
put empty into tOneLiners
end if
subtract 1 from tIndex
end repeat
put xContents & tBugTableContents into xContents
put tBody & tBugTable into tBody
return tBody
end notesFolderToHTML
command appendBugs pVersion, pBugs, pBold, @xTable,@xContents
put xTable & newSection("Specific bug fixes (" & pVersion & ")" , 2, xContents) into xTable
if pBold then
put xTable & "<i>(bug fixes specific to the current build are highlighted in bold, reverted bug fixes are stricken through)</i>" & CR into xTable
end if
put xTable & makeBugTable(pBugs, pBold) into xTable
end appendBugs
function notesFolderLCBToHTML pVersion, pTags, @xContents
local tBody
local tNumTags
put relevantTags(pVersion, pTags) into pTags
put the number of lines in pTags into tNumTags
local tList
local tFirstVersion, tCurVersion
put line 1 of pTags into tFirstVersion
put line -1 of pTags into tCurVersion
put fetchNameOnlyDiff(tFirstVersion, tCurVersion, notesPathLCB()) into tList
local tDataA
repeat for each line tFile in tList
addLCBReleaseNoteData tFile, tDataA
end repeat
local tConglomeratedMarkdown
put noteDataLCBToMD(tDataA) into tConglomeratedMarkdown
return markdownToHTML(tConglomeratedMarkdown, 2, 1, xContents, true)
end notesFolderLCBToHTML
function noteSubsectionDataToMD pLevel, pDataA
local tHashes
repeat pLevel
put "#" after tHashes
end repeat
local tMD
repeat for each key tSubsection in pDataA
put tHashes && tSubsection & return after tMD
if pDataA[tSubsection]["data"] is not empty then
put pDataA[tSubsection]["data"] & return after tMD
end if
if pDataA[tSubsection]["subsection"] is not empty then
put noteSubsectionDataToMD(pLevel + 1, pDataA[tSubsection]["subsection"]) & return after tMD
end if
end repeat
return tMD
end noteSubsectionDataToMD
function noteDataLCBToMD pDataA
local tMD
repeat for each key tSection in pDataA
put "#" && tSection & return after tMD
if pDataA[tSection]["subsection"] is not empty then
put noteSubsectionDataToMD(2, pDataA[tSection]["subsection"]) & return after tMD
end if
if pDataA[tSection]["bugs"] is not empty then
put "##" && "Bugs fixed" & return after tMD
put pDataA[tSection]["bugs"] & return after tMD
end if
end repeat
return tMD
end noteDataLCBToMD
function numberOfHashes pWord
local tCount
put 0 into tCount
repeat while char tCount + 1 of pWord is "#"
add 1 to tCount
end repeat
return tCount
end numberOfHashes
function lineIsBugInfo pLine
return matchText(pLine, "^ *# *\[[0-9]*\]")
end lineIsBugInfo
on addDataToSection pLevel, @xData, @xSectionA
repeat while xData is not empty
get line 1 of xData
if word 1 of it is empty then
delete line 1 of xData
next repeat
end if
local tCount
put numberOfHashes(word 1 of it) into tCount
if tCount is 0 then
if xSectionA["data"] is empty then
put it into xSectionA["data"]
else
put return & it after xSectionA["data"]
end if
delete line 1 of xData
else if pLevel >= tCount then
exit addDataToSection
else
local tSection
put word 2 to -1 of it into tSection
delete line 1 of xData
addDataToSection pLevel + 1, xData, xSectionA["subsection"][tSection]
end if
end repeat
end addDataToSection
on addLCBReleaseNoteData pFile, @xDataA
local tNoteData
put url ("file:" & pFile) into tNoteData
local tCount, tSection
repeat while tNoteData is not empty
get line 1 of tNoteData
if word 1 of it is empty then
delete line 1 of tNoteData
next repeat
end if
put numberOfHashes(word 1 of it) into tCount
# tCount should always be 1
if tCount is 1 then
# If this is not a bug number, then it is a section
if lineIsBugInfo(it) then
if xDataA[tSection]["bugs"] is empty then
put word 2 to -1 of it into xDataA[tSection]["bugs"]
else
put return & word 2 to -1 of it after xDataA[tSection]["bugs"]
end if
delete line 1 of tNoteData
else
put word 2 to -1 of it into tSection
delete line 1 of tNoteData
addDataToSection 1, tNoteData, xDataA[tSection]
end if
else
// throw error?
delete line 1 of tNoteData
end if
end repeat
end addLCBReleaseNoteData
function dictPath
# path to the dictionary folder in git
return "docs" & slash & "dictionary"
end dictPath
function notesPath
# return the path to the folder of release notes gubbins
return "docs" & slash & "notes"
end notesPath
function targetPath
return "_build" & slash & "notes"
end targetPath
function notesPathLCB
return "docs" & slash & "lcb" & slash & "notes"
end notesPathLCB
function notesPathIDE
return "ide" & slash & "notes"
end notesPathIDE
command exportUpdateText pVersion, pFeatures, pBugs, pReleaseType
local tHtmlText
put "<p>LiveCode " & pVersion & " is now available.<br>" & CR into tHtmlText
set the casesensitive to false
if pReleaseType is not "stable" then
put "<strong>Warning: this is not a stable release. Please ensure you back up your stacks before testing them.</strong><br>" & CR after tHtmlText
put "If you do not wish to be notified of test releases, uncheck the appropriate boxes in the Updates section of your LiveCode Preferences.<br><br>" & CR after tHtmlText
end if
put "This " & pReleaseType & " release contains the following changes:</p>" & CR & "<ul>" & CR after tHtmlText
repeat for each line tLine in pFeatures
put "<li>" & tLine & "</li>" & CR after tHtmlText
end repeat
local tNumBugs
put the number of lines in pBugs into tNumBugs
put "<li>" & tNumBugs & " bug fixes:" & CR & "<ul>" & CR after tHtmlText
repeat with i = 1 to tNumBugs
put "<li>" & line i of pBugs & "</li>" & CR after tHtmlText
end repeat
put "</ul>" & CR & "</li>" & CR & "</ul>" & CR after tHtmlText
put "<p><strong>AUTO UPDATER</strong></p>" & CR after tHtmlText
put "<p>The auto updater pops up whenever a new release of LiveCode is available. There are 4 types of release: <br>" & CR after tHtmlText
put "<strong>Stable:</strong> The release has been through a full testing cycle and is deemed stable.<br>" & CR after tHtmlText
put "<strong>Maintenance:</strong> The release is the previous stable release with fixes ready for testing.<br>" & CR after tHtmlText
put "<strong>Beta:</strong> The release contains new features which are complete and ready for testing.<br>" & CR after tHtmlText
put "<strong>Development:</strong> The release contains untested new features.<br>" & CR after tHtmlText
return tHtmlText
end exportUpdateText
command sortTags @rTags
local tSortedTags
set the itemdelimiter to "-"
local tGM, tRCs, tDPs
local tVersion, tPrevVersion
repeat for each line tLine in rTags
put item 1 of tLine into tVersion
if tVersion is not tPrevVersion then
sort tDPs ascending numeric by item 3 of each
sort tRCs ascending numeric by item 3 of each
put tDPs & tRCs & tGM after tSortedTags
put empty into tRCs
put empty into tDPs
put empty into tGM
end if
put tVersion into tPrevVersion
if item 2 of tLine is empty then
put tLine & CR into tGM
else if item 2 of tLine is "dp" then
put tLine & CR after tDPs
else if item 2 of tLine is "rc" then
put tLine & CR after tRCs
end if
end repeat
sort tDPs ascending numeric by item 3 of each
sort tRCs ascending numeric by item 3 of each
put tDPs & tRCs & tGM after tSortedTags
delete the last char of tSortedTags
put tSortedTags into rTags
end sortTags
function fetchIDENameOnlyDiff pFromTag, pToTag
local tFirstCommit, tLastCommit
fetchIDECommits pFromTag, pToTag, tFirstCommit, tLastCommit
local tDefaultFolder
put the defaultFolder into tDefaultFolder
set the defaultFolder to tDefaultFolder & slash & "ide"
local tDiff
put shell("git diff --name-only" && tFirstCommit & "..." & tLastCommit && "--" && "notes") into tDiff
set the defaultFolder to tDefaultFolder
return tDiff
end fetchIDENameOnlyDiff
function fetchIDEDiff pFromTag, pToTag
return shell("git diff" && pFromTag & "..." & pToTag & " -- ide")
end fetchIDEDiff
on fetchIDECommits pFirstVersion, pLastVersion, @rFirst, @rLast
local tDiff
put fetchIDEDiff(pFirstVersion, pLastVersion) into tDiff
local tString
put "Subproject commit (.*)" into tString
get matchText(tDiff, "\-" & tString, rFirst)
get matchText(tDiff, "\+" & tString, rLast)
end fetchIDECommits