mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
sweet checkstrings
This commit is contained in:
parent
dbdb1e5682
commit
3d01473ec4
2 changed files with 49 additions and 2 deletions
|
@ -1388,7 +1388,7 @@ GitEngine.prototype.deleteBranch = function(name) {
|
||||||
this.HEAD.get('target') === target) {
|
this.HEAD.get('target') === target) {
|
||||||
|
|
||||||
throw new GitError({
|
throw new GitError({
|
||||||
msg: intl.str('git-error-brnach')
|
msg: intl.str('git-error-branch')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ GitEngine.prototype.statusStarter = function() {
|
||||||
lines.push(intl.str('git-status-detached'));
|
lines.push(intl.str('git-status-detached'));
|
||||||
} else {
|
} else {
|
||||||
var branchName = this.HEAD.get('target').get('id');
|
var branchName = this.HEAD.get('target').get('id');
|
||||||
lines.push(intl.str('git-stauts-onbranch', {branch: branchName}));
|
lines.push(intl.str('git-status-onbranch', {branch: branchName}));
|
||||||
}
|
}
|
||||||
lines.push('Changes to be committed:');
|
lines.push('Changes to be committed:');
|
||||||
lines.push('');
|
lines.push('');
|
||||||
|
|
47
src/js/intl/checkStrings.js
Normal file
47
src/js/intl/checkStrings.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
var sys = require('sys');
|
||||||
|
var _ = require('underscore');
|
||||||
|
var child_process = require('child_process');
|
||||||
|
var strings = require('../intl/strings').strings;
|
||||||
|
|
||||||
|
var searchCommand = 'grep -C 2 -r "intl.str(" ../../';
|
||||||
|
var genBadKeyCommand = function(key) {
|
||||||
|
return 'grep -r "' + key + '" ../../';
|
||||||
|
};
|
||||||
|
|
||||||
|
var easyRegex = /intl.str\('([a-zA-Z-]+)'/g;
|
||||||
|
var hardRegex = /\s+'([a-z-]+)',/g;
|
||||||
|
|
||||||
|
var findKey = function(badKey) {
|
||||||
|
child_process.exec(genBadKeyCommand(badKey), function(err, output) {
|
||||||
|
console.log(output);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var validateKey = function(key) {
|
||||||
|
if (!strings[key]) {
|
||||||
|
console.log('NO KEY for: "', key, '"');
|
||||||
|
findKey(key);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var processLines = function(lines) {
|
||||||
|
_.each(lines, function(line) {
|
||||||
|
var results = easyRegex.exec(line);
|
||||||
|
if (results && results[1]) {
|
||||||
|
validateKey(results[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// could be a multi-liner
|
||||||
|
results = hardRegex.exec(line);
|
||||||
|
if (results && results[1]) {
|
||||||
|
validateKey(results[1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
child_process.exec(
|
||||||
|
searchCommand,
|
||||||
|
function(err, output) {
|
||||||
|
processLines(output.split('\n'));
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue