All files / src/modules git.js

100% Statements 48/48
100% Branches 7/7
100% Functions 6/6
100% Lines 48/48

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 491x 1x 22x 22x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 1x 1x 5x 5x 5x 5x 5x 5x 5x 1x 1x 6x 6x 6x 6x 6x 6x 1x 1x 6x 6x 6x 6x 6x 1x 1x 2x 2x 2x 2x 2x 1x  
export class Git {
  constructor(pure) {
    this.pure = pure;
  }
 
  branch() {
    const noun = this.pure.hacker.noun().replace(' ', '-');
    const verb = this.pure.hacker.verb().replace(' ', '-');
 
    return `${noun}-${verb}`;
  }
 
  commitEntry(options = {}) {
    let entry = 'commit {{git.commitSha}}\r\n';
 
    if (options.merge) {
      entry += 'Merge: {{git.shortSha}} {{git.shortSha}}\r\n';
    }
 
    entry += 'Author: {{name.firstName}} {{name.lastName}} <{{internet.email}}>\r\n';
    entry += `Date: ${this.pure.date.recent().toString()}\r\n`;
    entry += '\r\n\xa0\xa0\xa0\xa0{{git.commitMessage}}\r\n';
 
    return this.pure.fake.parse(entry);
  }
 
  commitMessage() {
    const noun = this.pure.hacker.noun().replace(' ', '-');
    const verb = this.pure.hacker.verb().replace(' ', '-');
    const adjective = this.pure.hacker.adjective().replace(' ', '-');
 
    return `${verb} ${adjective} ${noun}`;
  }
 
  commitSha() {
    const template = this.pure.helpers.repeatString({ string: '#', num: 40 });
    const commit = this.pure.helpers.replaceSymbolWithHex({ string: template });
 
    return commit;
  }
 
  shortSha() {
    const template = this.pure.helpers.repeatString({ string: '#', num: 7 });
    const shortSha = this.pure.helpers.replaceSymbolWithHex({ string: template });
 
    return shortSha;
  }
}