improve the freakin git assume-unchanged hack. do it when dist files are built

This commit is contained in:
Adam Shaw
2014-06-13 15:57:27 -07:00
parent 9d2ad1db54
commit 48dd2be73a
4 changed files with 26 additions and 8 deletions
+21
View File
@@ -12,6 +12,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jscs-checker');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('lumbar');
@@ -23,6 +24,7 @@ module.exports = function(grunt) {
uglify: {},
copy: {},
compress: {},
shell: {},
clean: {
temp: 'build/temp'
}
@@ -46,6 +48,7 @@ module.exports = function(grunt) {
// Bare minimum for debugging
grunt.registerTask('dev', [
'shell:assume-unchanged',
'lumbar:build',
'languages'
]);
@@ -374,6 +377,24 @@ module.exports = function(grunt) {
/* dist & git hacks
----------------------------------------------------------------------------------------------------
// These shell commands are used to force/unforce git from thinking that files have changed.
// Used to ignore changes when dist files are overwritten, but not committed, during development.
*/
config.shell['assume-unchanged'] = {
command: 'git update-index --assume-unchanged `git ls-files dist`'
};
config.shell['no-assume-unchanged'] = {
command: 'git update-index --no-assume-unchanged `git ls-files dist`'
};
config.shell['list-assume-unchanged'] = {
command: 'git ls-files -v | grep \'^h\''
};
// finally, give grunt the config object...
grunt.initConfig(config);
+2 -2
View File
@@ -11,7 +11,7 @@ fi
grunt bump --setversion=$version && \
grunt dist && \
npm run-script no-assume-unchanged && \
grunt shell:no-assume-unchanged && \
git add -f dist/*.js dist/*.css dist/lang/*.js && \
git add *.json && \
git commit -e -m "version $version" && \
@@ -21,7 +21,7 @@ status=$?
# regardless of error/success, undo the temporary no-assume-unchanged
git reset
npm run-script assume-unchanged
grunt shell:assume-unchanged
if [ $status -eq 0 ]
then
+1 -1
View File
@@ -2,5 +2,5 @@
cd "`dirname $0`/.."
npm run-script assume-unchanged
grunt shell:assume-unchanged
grunt lumbar:watch
+2 -5
View File
@@ -15,6 +15,7 @@
"grunt-contrib-clean": "^0.4.1",
"grunt-contrib-jshint": "^0.8.0",
"grunt-jscs-checker": "^0.4.4",
"grunt-shell": "^0.7.0",
"grunt-karma": "^0.8.3",
"grunt-bump": "0.0.14",
"lumbar": "^2.0.1",
@@ -22,10 +23,6 @@
"karma-phantomjs-launcher": "^0.1.4"
},
"scripts": {
"install": "bower install; npm run-script assume-unchanged",
"preuninstall": "npm run-script no-assume-unchanged",
"assume-unchanged": "git update-index --assume-unchanged dist/*.js dist/*.css dist/lang/*.js",
"no-assume-unchanged": "git update-index --no-assume-unchanged dist/*.js dist/*.css dist/lang/*.js",
"list-assume-unchanged": "git ls-files -v | grep '^h'"
"install": "bower install"
}
}