Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions lib/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ module.exports = function( Release ) {
Release.define({
_generateChangelog: function( callback ) {
Release._generateCommitChangelog(function( commitChangelog ) {
var changelogPath = Release.dir.base + "/changelog",
changelog = Release.changelogShell() +
commitChangelog +
Release._generateIssueChangelog();

fs.writeFileSync( changelogPath, changelog );
console.log( "Stored changelog in " + chalk.cyan( changelogPath ) + "." );
callback();
Release._generateIssueChangelog(function( issueChangelog ) {
var changelogPath = Release.dir.base + "/changelog",
changelog = Release.changelogShell() +
commitChangelog +
"\n\n\n" +
"--- Issue List ---\n" +
issueChangelog;

fs.writeFileSync( changelogPath, changelog );
console.log( "Stored changelog in " + chalk.cyan( changelogPath ) + "." );

callback();
});
});
},

Expand Down Expand Up @@ -43,21 +48,10 @@ Release.define({
});
},

_generateIssueChangelog: function() {
_generateIssueChangelog: function( callback ) {
return Release.issueTracker === "trac" ?
Release._generateTracChangelog() :
Release._generateGithubChangelog();
},

_generateTracChangelog: function() {
console.log( "Adding Trac tickets..." );
return Release.trac( "/query?milestone=" + Release.tracMilestone() + "&resolution=fixed" +
"&col=id&col=component&col=summary&order=component" ) + "\n";
},

_generateGithubChangelog: function() {
console.log( "Adding GitHub issues..." );
// TODO
Release._generateTracChangelog( callback ) :
Release._generateGithubChangelog( callback );
}
});

Expand Down
64 changes: 25 additions & 39 deletions lib/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,51 +12,37 @@ function unique( arr ) {
}

Release.define({
_gatherContributors: function() {
var contributors,
contributorsPath = Release.dir.base + "/contributors.txt";

console.log( "Adding committers and authors..." );
Release.chdir( Release.dir.repo );
contributors = Release.gitLog( "%aN%n%cN" );
_gatherContributors: function( callback ) {
var contributorsPath = Release.dir.base + "/contributors.txt";

console.log( "Adding reporters and commenters from issues..." );
contributors = contributors.concat( Release._gatherIssueContributors() );

console.log( "Sorting contributors..." );
contributors = unique( contributors ).sort(function( a, b ) {
return a.toLowerCase() < b.toLowerCase() ? -1 : 1;
Release._gatherIssueContributors(function( contributors ) {
console.log( "Adding committers and authors..." );
Release.chdir( Release.dir.repo );
contributors = contributors.concat( Release.gitLog( "%aN%n%cN" ) );

console.log( "Sorting contributors..." );
contributors = unique( contributors ).sort(function( a, b ) {
return a.toLowerCase() < b.toLowerCase() ? -1 : 1;
});

console.log( "Adding people thanked in commits..." );
contributors = contributors.concat(
Release.gitLog( "%b%n%s" ).filter(function( line ) {
return (/thank/i).test( line );
}));

fs.writeFileSync( contributorsPath, contributors.join( "\n" ) );
console.log( "Stored contributors in " + chalk.cyan( contributorsPath ) + "." );

callback();
});

console.log( "Adding people thanked in commits..." );
contributors = contributors.concat(
Release.gitLog( "%b%n%s" ).filter(function( line ) {
return (/thank/i).test( line );
}));

fs.writeFileSync( contributorsPath, contributors.join( "\n" ) );
console.log( "Stored contributors in " + chalk.cyan( contributorsPath ) + "." );
},

_gatherIssueContributors: function() {
_gatherIssueContributors: function( callback ) {
return Release.issueTracker === "trac" ?
Release._gatherTracContributors() :
Release._gatherGithubIssueContributors();
},

_gatherTracContributors: function() {
var url = "/report/" + Release.contributorReportId +
"?V=" + Release.tracMilestone() + "&max=-1";

return Release.trac( url )
.split( /\r?\n/ )

// Remove header and trailing newline
.slice( 1, -1 );
},

_gatherGithubIssueContributors: function() {
// TODO
Release._gatherTracContributors( callback ) :
Release._gatherGithubIssueContributors( callback );
}
});

Expand Down
90 changes: 90 additions & 0 deletions lib/github.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
var querystring = require( "querystring" );
var github = require( "github-request" );

module.exports = function( Release ) {

Release.define({
_githubApiPath: function( path ) {
var repoUrl = Release._packageUrl( "bugs" );
var repo = repoUrl.match( /github\.com\/(\w+\/\w+)/ )[ 1 ];
return "/repos/" + repo + "/" + path;
},

_githubMilestone: function( callback ) {
github.requestAll({
path: Release._githubApiPath( "milestones" )
}, function( error, milestones ) {
if ( error ) {
Release.abort( "Error getting milestones.", error );
}

var milestone = milestones.filter(function( milestone ) {
return milestone.title === Release.newVersion;
})[ 0 ];

if ( !milestone ) {
Release.abort( "No milestone found." );
}

callback( milestone.number );
});
},

_generateGithubChangelog: function( callback ) {
Release._githubMilestone(function( milestone ) {
github.requestAll({
path: Release._githubApiPath( "issues?" + querystring.stringify( {
milestone: milestone,
state: "closed"
} ) ),
}, function( error, issues ) {
if ( error ) {
return Release.abort( "Error getting issues.", error );
}

var changelog = issues

// Remove pull requests from results
.filter(function( issue ) {
return !issue.pull_request;
})

// Convert each issue to text
.map(function( issue ) {
var component = "(none)";

issue.labels.forEach(function( label ) {
if ( /^component:/i.test( label.name ) ) {
component = label.name.substring( 11 );
}
});

return [
"#" + issue.number,
component,
issue.title
]
.sort(function( a, b ) {
return a.component > b.component ? 1 : -1;
})
.join( "\t" );
})

// Concatenate the issues into a string
.join( "\n" ) + "\n";

callback( changelog );
});
});
},

_gatherGithubIssueContributors: function( callback ) {

// TODO
process.nextTick(function() {
callback( [] );
});
}
});

};
24 changes: 24 additions & 0 deletions lib/trac.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ Release.define({
command: "curl -s '" + tracUrl + path + "&format=tab'",
silent: true
}, "Error getting Trac data." );
},

_generateTracChangelog: function( callback ) {
process.nextTick(function() {
console.log( "Adding Trac tickets..." );
var changelog = Release.trac(
"/query?milestone=" + Release.newVersion + "&resolution=fixed" +
"&col=id&col=component&col=summary&order=component" ) + "\n";
callback( changelog );
});
},

_gatherTracContributors: function( callback ) {
var url = "/report/" + Release.contributorReportId +
"?V=" + Release.tracMilestone() + "&max=-1";

process.nextTick(function() {
callback( Release.trac( url )
.split( /\r?\n/ )

// Remove header and trailing newline
.slice( 1, -1 )
);
});
}
});

Expand Down
20 changes: 20 additions & 0 deletions node_modules/github-request/LICENSE.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions node_modules/github-request/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading