コード例 #1
0
 def detect(self, app):
     """
     Given an app, run detect script on it to determine whether it can be
     built with this pack.  Return True/False.
     """
     script = os.path.join(self.folder, 'bin', 'detect')
     cmd = '%s %s' % (script, app.folder)
     result = run(cmd)
     return result.status_code == 0
コード例 #2
0
    def compile(self, app):
        log.info(
            'Compiling {app.basename} with {self.basename}'.format(**vars()))
        script = os.path.join(self.folder, 'bin', 'compile')

        cache_folder = os.path.join(CACHE_HOME,
                                    get_unique_repo_folder(app.url))

        cmd = ' '.join([script, app.folder, cache_folder])
        log.info(cmd)
        result = run(cmd, verbose=True)
        result.raise_for_status()
コード例 #3
0
    def tar(self, appname, appversion):
        """
        Given an app name and version to be used in the tarball name,
        create a tar.bz2 file with all of this folder's contents inside.

        Return a Build object with attributes for appname, appversion,
        time, and path.
        """
        name_tmpl = '%(app)s-%(version)s-%(time)s.tar.bz2'
        time = utc.now()
        name = name_tmpl % {
            'app': appname,
            'version': appversion,
            'time': time.strftime('%Y-%m-%dT%H-%M')
        }

        if not os.path.exists(TARBALL_HOME):
            os.mkdir(TARBALL_HOME)
        tarball = os.path.join(TARBALL_HOME, name)
        tar_params = {'filename': tarball, 'folder': self.folder}
        tar_result = run('tar -C %(folder)s -cjf %(filename)s .' % tar_params)
        tar_result.raise_for_status()
        return Build(appname, appversion, time, tarball)
コード例 #4
0
 def run(command):
     r = run(command, verbose=True)
     r.raise_for_status()
     return r
コード例 #5
0
 def release(self, app):
     script = os.path.join(self.folder, 'bin', 'release')
     result = run('%s %s' % (script, app.folder))
     assert result.status_code == 0, ("Failed release on %s with %s "
                                      "buildpack" % (app, self.basename))
     return yaml.safe_load(result.output)
コード例 #6
0
ファイル: test_repos.py プロジェクト: yougov/vr.common
 def test_git_folder_detection(self):
     with tmpdir():
         folder = os.path.abspath('.git')
         run('mkdir -p %s' % folder)
         assert repo.guess_folder_vcs(os.getcwd()) == 'git'
コード例 #7
0
ファイル: test_repos.py プロジェクト: yougov/vr.common
def _git_config():
    run('git config user.email "*****@*****.**"')
    run('git config --global user.name "Your Name"')
コード例 #8
0
ファイル: test_repos.py プロジェクト: mnowotka/vr.common
def test_hg_folder_detection():
    with tmpdir():
        folder = os.path.abspath('.hg')
        run('mkdir -p %s' % folder)

        assert repo.guess_folder_vcs(os.getcwd()) == 'hg'