release-buddy
v1.0.3
Published
Helps you track cross-project and cross-repo changes
Downloads
1
Readme
Release Buddy
Provide release buddy with a list of bower and/or maven code repositories along with a work directory, and it will pull the projects down, understand how the project dependency graph, and enable querying for commits across linked projects so not only can you ask "what changed in this project", you can ask "what changed in this project and it's dependent projects?".
Important note: release buddy assumes that all provided dependencies are dependent on the 'HEAD' (or SNAPSHOT) version of the repo (rather than a explicit versioning). That's usually ok, because updating and explicit version requires a commit to occur to the project.
var createBuddy = require('release-buddy');
var workDir = '/tmp';
var repos = [{
name: 'popcorn',
packageManager: 'bower',
repoUrl: '[email protected]:signalfuse/popcorn.git'
},{
name: 'angular-popcorn',
packageManager: 'bower',
repoUrl: '[email protected]:signalfuse/angular-popcorn.git'
},{
name: 'sf:caramel',
repoUrl: '[email protected]:signalfuse/caramel.git'
}];
createBuddy(workDir, repos).then(function(buddy){
// fetch and update repos
buddy.update().then(function(){
buddy.diff('popcorn', 'two days ago', 'yesterday').then(function(commits){
commits.forEach(function(commit){
// commit.hash - the commit hash
// commit.authorName
// commit.authorEmail
// commit.time - the commit time
// commit.subject
// commit.details.filesChanged -- number of files changed for commit
// commit.details.insertions -- lines added by commit
// commit.details.deletions -- lines deleted by commit
// commit.project.name -- project name
// commit.project.repoUrl -- project url
// commit.project.dependencies -- projects depended upon by the project of this commit
});
});
})
});
API
// Create a buddy by giving it a working directory and a list of project repos.
// Repos should have a 'name' and 'repoUrl' property which will be used to git
// clone the repo in the working directory. An additional package manager
// property may be sent to disambiguate when multiple package manager files
// are present in a repository.
var buddyPromise = createBuddy(workDir, repos);
buddyPromise.then(function(buddy){
// Update repos
var updatePromise = buddy.update();
// Get a diff between an approxidate time period
var diffsPromise = buddy.diff(projectName, 'two days ago', 'yesterday');
// Get a diff between two commits
var diffsPromise = buddy.diff(projectName, 'fa8b9034ec71fefca83e9b115e07a7e0d71b8339', '4b9b41f9975502b98869d615832192cecdcc51dd');
// Get the tags for a project repo
var tags = buddy.tags(projectName);
// Get the project object
var project = buddy.get(projectName);
// Get local dependent project which would be searched during diff requests
var dependencies = buddy.localDependencies(projectName);
});