File: .bump.js

package info (click to toggle)
compass-singularitygs-plugin 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 592 kB
  • ctags: 15
  • sloc: ruby: 70; makefile: 29; sh: 4
file content (56 lines) | stat: -rw-r--r-- 1,374 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
54
55
56
'use strict';

var path = require('path'),
    fs = require('fs'),
    semver = require('semver'),
    exec = require('child_process').execSync,
    args = require('yargs').argv;

var pkg = require('./package.json'),
    ruby = fs.readFileSync('./lib/singularitygs.rb').toString();

var rubyString,
    date = new Date().toISOString();

var version = pkg.version;

if (exec('git status --porcelain').toString() !== '') {
  console.error('Working dirty. Please commit before trying again');
  process.exit(1);
}

version = {
  major: semver.major(version),
  minor: semver.minor(version),
  patch: semver.patch(version)
};

if (args.major) {
  version = `${version.major + 1}.0.0`;
}
else if (args.minor) {
  version = `${version.major}.${version.minor + 1}.0`;
}
else if (args.patch) {
  version = `${version.major}.${version.minor}.${version.patch + 1}`;
}
else {
  version = `${version.major}.${version.minor}.${version.patch}`;
}

date = date.substring(0, date.indexOf('T'));

rubyString = `module SingularityGS
  VERSION = "${version}"
  DATE = "${date}"
end`;

ruby = ruby.substring(0, ruby.indexOf('module SingularityGS')) + rubyString;

pkg.version = version;

fs.writeFileSync('./lib/singularitygs.rb', ruby + '\n');
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2) + '\n');

exec(`git commit -am "Release v${version}"`);
exec(`git tag v${version}`);