Skip to content
This repository has been archived by the owner on Jan 31, 2018. It is now read-only.

Add build step for stamping Butter with git commit sha version info. #298

Merged
merged 2 commits into from May 25, 2012
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions make.js
Expand Up @@ -75,6 +75,13 @@ target.build = function() {
exec(RJS + ' -o tools/build.js');
exec(RJS + ' -o tools/build.optimized.js');

// Stamp Butter.version with the git commit sha we are using
var version = exec('git show -s --pretty=format:%h',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using git show, you can use git describe which output looks like this: v0.4-81-g24d7d1b

It gives you 3 pieces of information: the tag that the commit is based off, how many commits have been made since that tag, and the commit sha.

{silent:true}).output.replace(/\r?\n/m, "");
console.log("'" + version + "'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this here, do we?

sed('-i', '@VERSION@', version, 'dist/butter.js');
sed('-i', '@VERSION@', version, 'dist/butter.min.js');

exec(STYLUS + ' css');
cp('css/*.css', DIST_DIR);
};
Expand Down
4 changes: 4 additions & 0 deletions src/main.js
Expand Up @@ -714,6 +714,10 @@

Butter.instances = __instances;

// Butter will report a version, which is the git commit sha
// of the version we ship. This happens in make.js's build target.
Butter.version = "@VERSION@";

if ( window.Butter.__waiting ) {
for ( var i=0, l=window.Butter.__waiting.length; i<l; ++i ) {
Butter.apply( {}, window.Butter.__waiting[ i ] );
Expand Down