version as a command
966849
function bin (argv) {
  // setup config
  var config = require('../config/config.js')

  program
    .option('-d, --database <database>', 'Database')
    .option('-s, --safe     <safe>', 'Safe')
    .parse(argv)

  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase
  var mediaURI = process.argv[2]
  var safe = program.safe || 0

  if (!mediaURI) {
    console.error('Please supply a media URI')
  }

  if (/^\//.test(mediaURI)) {
    mediaURI = fileProtocol + mediaURI
  }

  qpmMedia.addMedia(mediaURI, null, safe).then(function (ret) {
    if (ret.conn) {
      ret.conn.close()
    }
    if (ret.ret) {
      console.log(ret.ret)
    }

    if (/^file:/.test(mediaURI)) {
      console.log('mediaURI', mediaURI)
      exec('./bin/getlength.sh "' + mediaURI + '"', function (err, stdout, stderr) {
        console.log('run getlength.sh', err, stdout, stderr)
        if (err) {
          console.error(err)
        } else {
          console.log(stdout)
          if (stdout && !isNaN(parseInt(stdout))) {
            var length = parseInt(stdout)
            console.log('length', length)
            var params = {}
            params.uri = mediaURI
            params.length = length
            qpmMedia.addMeta(params).then(function (ret) {
              if (ret && ret.conn && ret.conn.close) {
                ret.conn.close()
              }
            }).catch(function (err) {
              console.error(err)
            })
          }
        }
      })
    }
  }).then(function (ret) {
    console.log('added')
  }).catch(function (err) {
    console.error(err)
  })
}
674519
def version(**kwargs):
    
    retry = kwargs.get("retry")
    if retry:
        click.echo('Retrying publication of the same version...')
    else:
        click.echo('Creating new version..')

    try:
        current_version = get_current_version()
    except GitError as e:
        click.echo(click.style(str(e), 'red'), err=True)
        return False

    click.echo('Current version: {0}'.format(current_version))
    level_bump = evaluate_version_bump(current_version, kwargs['force_level'])
    new_version = get_new_version(current_version, level_bump)

    if new_version == current_version and not retry:
        click.echo(click.style('No release will be made.', fg='yellow'))
        return False

    if kwargs['noop'] is True:
        click.echo('{0} Should have bumped from {1} to {2}.'.format(
            click.style('No operation mode.', fg='yellow'),
            current_version,
            new_version
        ))
        return False

    if config.getboolean('semantic_release', 'check_build_status'):
        click.echo('Checking build status..')
        owner, name = get_repository_owner_and_name()
        if not check_build_status(owner, name, get_current_head_hash()):
            click.echo(click.style('The build has failed', 'red'))
            return False
        click.echo(click.style('The build was a success, continuing the release', 'green'))

    if retry:
        # No need to make changes to the repo, we're just retrying.
        return True

    if config.get('semantic_release', 'version_source') == 'commit':
        set_new_version(new_version)
        commit_new_version(new_version)
    tag_new_version(new_version)
    click.echo('Bumping with a {0} version to {1}.'.format(level_bump, new_version))
    return True
108320
async function commitVersionBump (version) {
  const gitDir = path.resolve(__dirname, '..')
  const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
  await GitProcess.exec(gitArgs, gitDir)
}
1374004
def rerun(version="3.7.0"):
    
    from commandlib import Command

    Command(DIR.gen.joinpath("py{0}".format(version), "bin", "python"))(
        DIR.gen.joinpath("state", "examplepythoncode.py")
    ).in_dir(DIR.gen.joinpath("state")).run()
780773
def _make_version(major, minor, micro, releaselevel, serial):
    """"""
    assert releaselevel in ['alpha', 'beta', 'candidate', 'final']
    version = "%d.%d" % (major, minor)
    if micro:
        version += ".%d" % (micro,)
    if releaselevel != 'final':
        short = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc'}[releaselevel]
        version += "%s%d" % (short, serial)
    return version
744240
def version(family='ipv4'):
    '''
    
    '''
    cmd = '{0} --version' . format(_iptables_cmd(family))
    out = __salt__['cmd.run'](cmd).split()
    return out[1]
614571
def _set_version(self, version):
        '''
        
        '''
        if not version:
            return

        exact_version = re.sub(r'[<>=+]*', '', version)
        self._op = version.replace(exact_version, '') or None
        if self._op and self._op not in self.Z_OP:
            raise CommandExecutionError('Zypper do not supports operator "{0}".'.format(self._op))
        self.version = exact_version
1096594
def cmd(send, msg, args):
    
    parser = arguments.ArgParser(args['config'])
    parser.add_argument('action', choices=['check', 'master', 'commit'], nargs='?')

    try:
        cmdargs = parser.parse_args(msg)
    except arguments.ArgumentException as e:
        send(str(e))
        return
    api_output = get('https://api.github.com/repos/%s/branches/master' % args['config']['api']['githubrepo']).json()
    commit, version = misc.get_version(args['handler'].confdir)
    if not cmdargs.action:
        send(version)
        return
    if cmdargs.action == 'master':
        send(api_output['commit']['sha'])
    elif cmdargs.action == 'check':
        if commit is None:
            send("Not running from git, version %s" % version)
        else:
            check = 'Same' if api_output['commit']['sha'] == commit else 'Different'
            send(check)
    elif cmdargs.action == 'commit':
        if commit is None:
            send("Not running from git, version %s" % version)
        else:
            send(commit)
658535
def _get_version():
    """"""
    with open(os.path.join(os.path.dirname(__file__), PACKAGE_NAME, 'VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version
846417
def version
      v = KJess::Request::Version.new
      r = send_recv( v )
      return r.version if Response::Version === r
      raise KJess::ProtocolError, "Unexpected Response from VERSION command"
    end
452120
def versions(runas=None):
    '''
    
    '''
    ret = _rbenv_exec(['versions', '--bare'], runas=runas)
    return [] if ret is False else ret.splitlines()
7198
function toDrupalMajorVersion(version) {
    var regex = /^(\d+)\.\d+\.[x\d+]/;
    var match = version.match(regex)
    if (match) {
      return match[1] + '.x';
    }

    return version;
  }
781205
def convert_old_command_expansions(command):
    """"""
    command = command.replace("!VERSION!",       "{version}")
    command = command.replace("!MAJOR_VERSION!", "{version.major}")
    command = command.replace("!MINOR_VERSION!", "{version.minor}")
    command = command.replace("!BASE!",          "{base}")
    command = command.replace("!ROOT!",          "{root}")
    command = command.replace("!USER!",          "{system.user}")
    return command
221543
def versionfile(dir = Dir.pwd, options = {})
      file    = (options[:file])    ? options[:file]    : 'VERSION'
      version = (options[:version]) ? options[:version] : '0.0.0'
      info " ==> bootstrapping a VERSION file"
      path = normalized_path(dir)
      path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
      unless Dir.exist?( path )
        warning "The directory #{path} does not exists and will be created"
        really_continue?
        FileUtils.mkdir_p path
      end
      versionfile = File.join(path, file)
      if File.exist?( versionfile )
        puts "  ... not overwriting the #{file} file which already exists"
      else
        FalkorLib::Versioning.set_version(version, path, :type => 'file',
                                          :source => { :filename => file })
        Dir.chdir( path ) do
          run %( git tag #{options[:tag]} ) if options[:tag]
        end
      end

      # unless File.exists?( versionfile )
      #     run %{  echo "#{version}" > #{versionfile} }
      #     if FalkorLib::Git.init?(path)
      #         FalkorLib::Git.add(versionfile, "Initialize #{file} file")
      #         Dir.chdir( path ) do
      #             run %{ git tag #{options[:tag]} } if options[:tag]
      #         end
      #     end
      # else
      #     puts "  ... not overwriting the #{file} file which already exists"
      # end
    end
585864
def version(*args, **attrs):
    """"""
    if hasattr(sys, "_getframe"):
        package = attrs.pop("package", sys._getframe(1).f_globals.get("__package__"))
        if package:
            attrs.setdefault("version", get_version(package))
    return click.version_option(*args, **attrs)
1062677
function generateVersionsTooltip(versions) {
    return versions.map(function(lib) {
      return lib.name + " " + lib.version;
    }).join("\n");
  }
861402
def _git_version():
    """"""

    import subprocess
    import os

    def _minimal_ext_cmd(cmd):
        # construct minimal environment
        env = {}
        for k in ['SYSTEMROOT', 'PATH']:
            v = os.environ.get(k)
            if v is not None:
                env[k] = v
        # LANGUAGE is used on win32
        env['LANGUAGE'] = 'C'
        env['LANG'] = 'C'
        env['LC_ALL'] = 'C'
        FNULL = open(os.devnull, 'w')
        cwd = os.path.dirname(os.path.realpath(__file__))
        proc = subprocess.Popen(
            cmd, stdout=subprocess.PIPE, stderr=FNULL, env=env, cwd=cwd)
        out = proc.communicate()[0]
        return out

    try:
        out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
        return out.strip().decode('ascii')
    except OSError:
        return "unknown"