From 9f8db7cc3726c8e5e5dacc4b738b96fc8e5028c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Thu, 5 Mar 2015 18:23:25 +0100 Subject: [PATCH 1/5] Support commits metatada --- index.html | 33 +++++++++++++++++++++++++++++---- js/script.js | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 9780b41..00504ae 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@
-

Semantic Release Notes v 0.3

+

Semantic Release Notes v 0.4-beta

@@ -191,6 +191,10 @@

The axes of Semantic Release Notes

Additionally the release note should be able to indicate what category an item is. For instance, "+New", "+Change", "+Bug-Fix", +Developer". This is indicated via a single word, or - (dash) delimited phrase, that has a "+" prefix. +
  • + Metadata: + A list of metadata can be added to a release note. Only some elements are possible, with their respective specific syntax. +
  • Release: As SRN allows for many releases to be defined within the one block of text, the system needs @@ -312,6 +316,25 @@

    Category

    
                         
  • +

    Metadata

    +

    + It can be useful to add some metadata to a release note, for example the list of commits targeted by the release note. +

    +

    + Each supported metadata have it's own syntax, here is the list: +

      +
    • Commits: the word "commits" (case insensitive) followed by a colon, then the first and last commits separated by three dots, included or not in a link +
    +

    +
    + Examples: +
    commits:56af25a...d3fead4
    +Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4)
    +                        
    +
    +
    
    +                    
    +

    Release (Not Working)

    In some cases we want to have the one document that describes many releases. In this case, the @@ -376,7 +399,7 @@

    Release (Not Working)

    - +

    Examples

      @@ -453,7 +476,9 @@

      Examples

      # Plugin [[icon][http://getglimpse.com/release/icon/mvc.png]] This description is specific to plugin section. 1. *Timeline*: Comes with an additional grid view to show the same data. +Changed - 1. *Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix [[i1234][http://getglimpse.com]] + 1. *Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix [[i1234][http://getglimpse.com]] + +Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4) Result:
      Object: @@ -501,7 +526,7 @@

      Micro Format

    diff --git a/js/script.js b/js/script.js index 01018c3..33b5b82 100644 --- a/js/script.js +++ b/js/script.js @@ -75,6 +75,28 @@ var processSyntax = (function () { else obj.sections[obj.sections.length - 1].items.push(item); } + }, + { + metadataPatterns : [{ name : 'Commits', pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i }], + test : function (input) { + return this.metadataPatterns.some(function (element, index, array) + { + return element.pattern.test(input) + }); + }, + process : function (obj, input) { + + for(var metadataPatternIndex in this.metadataPatterns) { + var metadataPattern = this.metadataPatterns[metadataPatternIndex]; + var metadata = metadataPattern.pattern.exec(input); + if (metadata) { + if (!obj.metadata) { + obj.metadata = []; + } + obj.metadata.push({ name : metadataPattern.name, data : metadata[1] ? metadata[1] : metadata[2] }); + } + } + } }], primary : { pattern : /^[a-zA-Z0-9]/i, @@ -114,7 +136,7 @@ var processSyntax = (function () { if (!matched) lineProcessor.primary.process(result, rawLine, rawLines[+rawLineIndex + 1]); } - + return result; }; @@ -199,7 +221,13 @@ var formatSyntax = (function () { result += '

    ' + feature.name + '

    ' + processString(feature.summary) + processList(feature.items) + '
    '; } - + + for (var metadataIndex in val.metadata) { + var metadata = val.metadata[metadataIndex]; + + result += '
    ' + metadata.name + ': ' + processString(metadata.data) + '
    '; + } + return result; }; From 51cc4d1fa6694ea67996345535cb5f8fa5f47ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Thu, 5 Mar 2015 19:24:31 +0100 Subject: [PATCH 2/5] Improve definition and code --- index.html | 6 +++--- js/script.js | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 00504ae..bbb8cb3 100644 --- a/index.html +++ b/index.html @@ -321,14 +321,14 @@

    Metadata

    It can be useful to add some metadata to a release note, for example the list of commits targeted by the release note.

    - Each supported metadata have it's own syntax, here is the list: + All metadata can be preceded by its name (case insensitive) followed by a colon, but each supported metadata have it's own syntax:

      -
    • Commits: the word "commits" (case insensitive) followed by a colon, then the first and last commits separated by three dots, included or not in a link +
    • Commits: the first and last commits separated by three dots, included or not in a link

    Examples: -
    commits:56af25a...d3fead4
    +                        
    56af25a...d3fead4
     Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4)
                             
    diff --git a/js/script.js b/js/script.js index 33b5b82..0eb77e9 100644 --- a/js/script.js +++ b/js/script.js @@ -77,23 +77,27 @@ var processSyntax = (function () { } }, { - metadataPatterns : [{ name : 'Commits', pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i }], + metadataCollection : [{ + name : 'Commits', + pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i, + getValue : function(metadataMatch) { return metadataMatch[1] ? metadataMatch[1] : metadataMatch[2] } + }], test : function (input) { - return this.metadataPatterns.some(function (element, index, array) + return this.metadataCollection.some(function (element, index, array) { return element.pattern.test(input) }); }, process : function (obj, input) { - for(var metadataPatternIndex in this.metadataPatterns) { - var metadataPattern = this.metadataPatterns[metadataPatternIndex]; - var metadata = metadataPattern.pattern.exec(input); - if (metadata) { + for(var metadataIndex in this.metadataCollection) { + var metadata = this.metadataCollection[metadataIndex]; + var metadataMatch = metadata.pattern.exec(input); + if (metadataMatch) { if (!obj.metadata) { obj.metadata = []; } - obj.metadata.push({ name : metadataPattern.name, data : metadata[1] ? metadata[1] : metadata[2] }); + obj.metadata.push({ name : metadata.name, data : metadata.getValue(metadataMatch) }); } } } From bd747b768401f14d51dcf9c5d11b46055e9c727d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Thu, 5 Mar 2015 18:23:25 +0100 Subject: [PATCH 3/5] Support commits metatada --- index.html | 31 ++++++++++++++++++++++++++++--- js/script.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0d912ff..3ccffd7 100644 --- a/index.html +++ b/index.html @@ -192,6 +192,10 @@

    The axes of Semantic Release Notes

    Additionally the release note should be able to indicate what category an item is. For instance, "+New", "+Change", "+Bug-Fix", +Developer". This is indicated via a single word, or - (dash) delimited phrase, that has a "+" prefix. +
  • + Metadata: + A list of metadata can be added to a release note. Only some elements are possible, with their respective specific syntax. +
  • Release: As SRN allows for many releases to be defined within the one block of text, the system needs @@ -314,6 +318,25 @@

    Category

    
                         
  • +

    Metadata

    +

    + It can be useful to add some metadata to a release note, for example the list of commits targeted by the release note. +

    +

    + Each supported metadata have it's own syntax, here is the list: +

      +
    • Commits: the word "commits" (case insensitive) followed by a colon, then the first and last commits separated by three dots, included or not in a link +
    +

    +
    + Examples: +
    commits:56af25a...d3fead4
    +Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4)
    +                        
    +
    +
    
    +                    
    +

    Release (Not Working)

    In some cases we want to have the one document that describes many releases. In this case, the @@ -378,7 +401,7 @@

    Release (Not Working)

    - +

    Examples

      @@ -455,7 +478,9 @@

      Examples

      # Plugin [[icon][http://getglimpse.com/release/icon/mvc.png]] This description is specific to plugin section. 1. *Timeline*: Comes with an additional grid view to show the same data. +Changed - 1. *Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix [[i1234][http://getglimpse.com]] + 1. *Ajax*: Fix that crashed poll in Chrome and IE due to log/trace statement. +Fix [[i1234][http://getglimpse.com]] + +Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4) Result:
      Object: @@ -518,7 +543,7 @@

      Tools

    diff --git a/js/script.js b/js/script.js index 0160c15..af81bdd 100644 --- a/js/script.js +++ b/js/script.js @@ -105,6 +105,28 @@ var processSyntax = (function () { else obj.sections[obj.sections.length - 1].items.push(item); } + }, + { + metadataPatterns : [{ name : 'Commits', pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i }], + test : function (input) { + return this.metadataPatterns.some(function (element, index, array) + { + return element.pattern.test(input) + }); + }, + process : function (obj, input) { + + for(var metadataPatternIndex in this.metadataPatterns) { + var metadataPattern = this.metadataPatterns[metadataPatternIndex]; + var metadata = metadataPattern.pattern.exec(input); + if (metadata) { + if (!obj.metadata) { + obj.metadata = []; + } + obj.metadata.push({ name : metadataPattern.name, data : metadata[1] ? metadata[1] : metadata[2] }); + } + } + } }], primary : { pattern : /^[a-zA-Z0-9]/i, @@ -237,7 +259,13 @@ var formatSyntax = (function () { result += '

    ' + feature.name + '

    ' + processString(feature.summary) + processList(feature.items) + '
    '; } - + + for (var metadataIndex in val.metadata) { + var metadata = val.metadata[metadataIndex]; + + result += '
    ' + metadata.name + ': ' + processString(metadata.data) + '
    '; + } + return result; }; From 45dbe06a9cad91f66e91f0d80d810a436829c961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Thu, 5 Mar 2015 19:24:31 +0100 Subject: [PATCH 4/5] Improve definition and code --- index.html | 6 +++--- js/script.js | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 3ccffd7..f7504d0 100644 --- a/index.html +++ b/index.html @@ -323,14 +323,14 @@

    Metadata

    It can be useful to add some metadata to a release note, for example the list of commits targeted by the release note.

    - Each supported metadata have it's own syntax, here is the list: + All metadata can be preceded by its name (case insensitive) followed by a colon, but each supported metadata have it's own syntax:

      -
    • Commits: the word "commits" (case insensitive) followed by a colon, then the first and last commits separated by three dots, included or not in a link +
    • Commits: the first and last commits separated by three dots, included or not in a link

    Examples: -
    commits:56af25a...d3fead4
    +                        
    56af25a...d3fead4
     Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4)
                             
    diff --git a/js/script.js b/js/script.js index af81bdd..eec9f70 100644 --- a/js/script.js +++ b/js/script.js @@ -107,23 +107,27 @@ var processSyntax = (function () { } }, { - metadataPatterns : [{ name : 'Commits', pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i }], + metadataCollection : [{ + name : 'Commits', + pattern : /^(?:commits:)?[ ]*(?:([0-9a-f]{5,40}\.{3}[0-9a-f]{5,40})|(\[[0-9a-f]{5,40}\.{3}[0-9a-f]{5,40}\]\(https?:\/\/\S+\)))$/i, + getValue : function(metadataMatch) { return metadataMatch[1] ? metadataMatch[1] : metadataMatch[2] } + }], test : function (input) { - return this.metadataPatterns.some(function (element, index, array) + return this.metadataCollection.some(function (element, index, array) { return element.pattern.test(input) }); }, process : function (obj, input) { - for(var metadataPatternIndex in this.metadataPatterns) { - var metadataPattern = this.metadataPatterns[metadataPatternIndex]; - var metadata = metadataPattern.pattern.exec(input); - if (metadata) { + for(var metadataIndex in this.metadataCollection) { + var metadata = this.metadataCollection[metadataIndex]; + var metadataMatch = metadata.pattern.exec(input); + if (metadataMatch) { if (!obj.metadata) { obj.metadata = []; } - obj.metadata.push({ name : metadataPattern.name, data : metadata[1] ? metadata[1] : metadata[2] }); + obj.metadata.push({ name : metadata.name, data : metadata.getValue(metadataMatch) }); } } } From 917e89c4e82a72be97858eb2278914dac118b450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bertrand?= Date: Tue, 5 May 2015 08:59:27 +0200 Subject: [PATCH 5/5] Add contributors, source, binaries and generated at metadata support --- index.html | 19 +++++-- js/script.js | 144 +++++++++++++++++++++++++++++---------------------- 2 files changed, 95 insertions(+), 68 deletions(-) diff --git a/index.html b/index.html index f7504d0..453b659 100644 --- a/index.html +++ b/index.html @@ -317,7 +317,7 @@

    Category

    
                         
    - +

    Metadata

    It can be useful to add some metadata to a release note, for example the list of commits targeted by the release note. @@ -325,18 +325,27 @@

    Metadata

    All metadata can be preceded by its name (case insensitive) followed by a colon, but each supported metadata have it's own syntax:

      -
    • Commits: the first and last commits separated by three dots, included or not in a link +
    • Commits: the first and last commits separated by three dots, included or not in a link. Name optional.
    • +
    • Contributors: list of all contributors for the release. Name mandatory.
    • +
    • Source: link to the sources. Name mandatory.
    • +
    • Binaries: link to the binaries. Name mandatory.
    • +
    • Generated at: generation time of the release notes with the following format: yyyy-mm-ddTHH:mm:ssZ (ISO 8601). Name optional.

    Examples:
    56af25a...d3fead4
     Commits: [56af25a...d3fead4](https://github.com/Glimpse/Semantic-Release-Notes/compare/56af25a...d3fead4)
    +Contributors: Jérémie Bertrand, Jake Ginnivan, [Anthony van der Hoorn](https://github.com/avanderhoorn)
    +source: [MyPackage.zip](https://github.com/laedit/MyPackage/archive/v0.1.0.zip)
    +binaries: [MyPackage.exe](https://github.com/laedit/MyPackage/releases/download/v0.1.0/MyPackage.exe)
    +Generated at: 2015-05-04T08:45:36Z
    +2015-05-04T08:45:36Z
                             
    
    -                    
    - +
    +

    Release (Not Working)

    In some cases we want to have the one document that describes many releases. In this case, the @@ -550,7 +559,7 @@

    Tools

    - +