@@ -57,6 +57,10 @@ function commitMessages(commits) {
5757 return commitObject . commit . message ;
5858 } ) ;
5959}
60+ {
61+
62+ key : function ( message ) { return message . method } ,
63+ }
6064
6165/**
6266 * Creates the options to make the release
@@ -69,15 +73,22 @@ function prepareRelease(gren, tagName, commitMessages) {
6973 var body = commitMessages
7074 . slice ( 0 , - 1 )
7175 . filter ( function ( message ) {
72- switch ( gren . includemessages )
73- {
74- case 'merges' :
75- return message . match ( / ^ m e r g e / i) ;
76- case "all" :
77- return true ;
78- default :
79- return ! message . match ( / ^ m e r g e / i) ;
76+ var messageType = gren . options . includeMessages ;
77+ var filterMap = {
78+ merges : function ( message ) {
79+ return message . match ( / ^ m e r g e / i) ;
80+ } ,
81+ commits : function ( message ) {
82+ return ! message . match ( / ^ m e r g e / i) ;
83+ } ,
84+ all : function ( message ) { return true ; }
85+ } ;
86+
87+ if ( filterMap [ messageType ] ) {
88+ return filterMap [ messageType ] ( message ) ;
8089 }
90+
91+ return filterMap . commits ( message ) ;
8192 } )
8293 . map ( createBody )
8394 . join ( '\n' ) ;
@@ -187,6 +198,19 @@ function getLatestRelease(gren) {
187198 } ) ;
188199}
189200
201+ /**
202+ * Transforms a dasherize string into a camel case one.
203+ *
204+ * @param {[string] } value The dasherize string
205+ *
206+ * @return {[string] } The camel case string
207+ */
208+ function dashToCamelCase ( value ) {
209+ return value . replace ( / - ( [ a - z ] ) / g, function ( match ) {
210+ return match [ 1 ] . toUpperCase ( ) ;
211+ } ) ;
212+ }
213+
190214/**
191215 * Create a literal object of the node module options
192216 *
@@ -200,7 +224,7 @@ function getOptions(args) {
200224 for ( var i = 2 ; i < args . length ; i ++ ) {
201225 var paramArray = args [ i ] . split ( '=' ) ;
202226
203- settings [ paramArray [ 0 ] . replace ( '--' , '' ) ] = paramArray [ 1 ] ;
227+ settings [ dashToCamelCase ( paramArray [ 0 ] . replace ( '--' , '' ) ) ] = paramArray [ 1 ] ;
204228 }
205229
206230 return settings ;
@@ -220,7 +244,6 @@ function GithubReleaseNotes(options) {
220244 auth : 'oauth'
221245 } ) ;
222246
223- this . includemessages = this . options . includemessages || "commits" ;
224247 this . repo = github . getRepo ( this . options . username , this . options . repo ) ;
225248}
226249
0 commit comments