How to use the git-rev-sync.branch function in git-rev-sync

To help you get started, we’ve selected a few git-rev-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenNeuroOrg / openneuro / server / server.js View on Github external
import routes from './routes'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import mongo from './libs/mongo'
import { connect as redis_connect } from './libs/redis'
import { connect as resque_connect } from './libs/queue'
import notifications from './libs/notifications'
import git from 'git-rev-sync'
import aws from './libs/aws'
// import events lib to instantiate CRN Emitter
import events from './libs/events'

// configuration ---------------------------------------------------
const ravenConfig = {
  release: git.long(),
  tags: { branch: git.branch() },
  environment: config.sentry.ENVIRONMENT,
  autoBreadcrumbs: true,
}
Raven.config(config.sentry.DSN, ravenConfig).install()

mongo.connect(config.mongo.url)

const redisConnect = async () => {
  try {
    const redis = await redis_connect(config.redis)
    await resque_connect(redis)
    console.log('Resque connected')
    // start background tasks
    notifications.initCron()
    aws.batch.initCron()
    aws.cloudwatch.initEvents().then(aws.batch.initQueue)
github brownplt / code.pyret.org / src / run.js View on Github external
var res = Q.fcall(function(db) {
  server.start({
    development: process.env["NODE_ENV"] !== "production",
    baseUrl: process.env["BASE_URL"],
    logURL: process.env["LOG_URL"],
    gitRev:    process.env["GIT_REV"]    || git.short(),
    gitBranch: process.env["GIT_BRANCH"] || git.branch(),
    port: process.env["PORT"],
    sessionSecret: process.env["SESSION_SECRET"],
    db: storage.makeStorage(client),
    google: {
      apiKey: process.env["GOOGLE_API_KEY"],
      clientId: process.env["GOOGLE_CLIENT_ID"],
      clientSecret: process.env["GOOGLE_CLIENT_SECRET"],
      redirect: "/oauth2callback"
    },
    version: process.env["CURRENT_PYRET_RELEASE"],
    pyret: process.env["PYRET"]
  }, function(app) {
    console.log("Server ready.");
  });
});
res.fail(function(err) {
github art-software / art-core / packages / art-compiler-ssr / src / scripts / build.ts View on Github external
forEach(answer.moduleEntryKeys, (entryKey) => {
        console.log(
          chalk.black.bold(`Clean folder "${chalk.cyan(entryKey)}"`)
        );
        emptyDirSync(join(BUILD_PATH, entryKey));
        try {
          outputJsonSync(join(BUILD_PATH, entryKey, 'version.txt'), {
            head: gitRev.long(),
            branch: gitRev.branch()
          });
        } catch (e) {
          console.log(
            chalk.yellow('current project is not a git repository!')
          );
        }
      });
      console.log();
github NMMES / nmmes-cli / src / options.js View on Github external
export function getVersion() {
    if (fs.existsSync('node_modules')) {
        try {
            let path = Path.resolve(fs.realpathSync('node_modules'), '../');
            let version = gitVer.branch(path) + '#' + gitVer.short(path);
            return `(Development Build) ${version}`;
        } catch (e) {
            Logger.trace(e);
        }
    }
    return Package.version;
}
github mozilla / web-ext / src / program.js View on Github external
export function defaultVersionGetter(
  absolutePackageDir: string,
  {globalEnv = WEBEXT_BUILD_ENV}: VersionGetterOptions = {}
): string {
  if (globalEnv === 'production') {
    log.debug('Getting the version from package.json');
    const packageData: any = readFileSync(
      path.join(absolutePackageDir, 'package.json'));
    return JSON.parse(packageData).version;
  } else {
    log.debug('Getting version from the git revision');
    return `${git.branch(absolutePackageDir)}-${git.long(absolutePackageDir)}`;
  }
}
github nystudio107 / annotated-webpack-4-config / webpack.prod.js View on Github external
const configureBanner = () => {
    return {
        banner: [
            '/*!',
            ' * @project        ' + settings.name,
            ' * @name           ' + '[filebase]',
            ' * @author         ' + pkg.author.name,
            ' * @build          ' + moment().format('llll') + ' ET',
            ' * @release        ' + git.long() + ' [' + git.branch() + ']',
            ' * @copyright      Copyright (c) ' + moment().format('YYYY') + ' ' + settings.copyright,
            ' *',
            ' */',
            ''
        ].join('\n'),
        raw: true
    };
};
github Niondir / iot-dashboard / gulpfile.js View on Github external
.pipe(jeditor(function (json) {
            json.version = packageJson.version;
            json.revision = git.long();
            json.revisionShort = git.short();
            json.branch = git.branch();
            return json;
        }))
        .pipe(gulp.dest("./src"));
github opendevise / presentation-documentation-as-code / gulpfile.js View on Github external
gulp.task('build-branch', ['build'], function() {
  var branch = git.branch();
  if (branch != 'master') {
    return gulp.src('dist/**/*').pipe(gulp.dest('dist/event/' + branch));
  }
});
github stormpath / stormpath-widget / publish.js View on Github external
let throwIfNotOnMaster = () => {
  const branch = git.branch();
  if (branch !== 'master') {
    throw new Error(`Must be on branch master (current branch is ${branch})`);
  }
};
github flyduino / kissfc-chrome-gui / gulpfile.js View on Github external
function getReleaseFilename(platform, ext) {
  return (
    pkg.name +
    "_" +
    pkg.version +
    "-" +
    git.branch() +
    "_" +
    git.short() +
    "-" +
    platform +
    "." +
    ext
  );
}

git-rev-sync

Synchronously get the current git commit hash, tag, or branch

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages