/** * * @param type $id * @return type */ public static function run($id) { $local = \Apigenci\Model::dbRepo($id); $login = \Apigenci\Model::dbUser($local->user_id)->login; $nonce = self::nonce(); if (!$local->enabled || !$local->queued) { return; } // Url to the projects source zip $wget = "https://github.com/{$login}/{$local->repo}/archive/master.zip"; // create nonce folder exec("mkdir -p /tmp/{$nonce}"); self::cmd("cd /tmp/{$nonce} ; wget {$wget} --no-check-certificate", $nonce); self::cmd("cd /tmp/{$nonce} ; unzip master.zip", $nonce); $workdir = "/tmp/{$nonce}/{$local->repo}-master"; $options = \Apigenci\Model\Build::apigenOptions($workdir); // Run apigen self::cmd("apigen generate {$options} --destination=/tmp/{$nonce}/apigen", $nonce); // Create the target folder in the webroot $public = base_path("vendor/apigen-ci/apigen-ci/public/github/{$login}/{$local->repo}"); exec("mkdir -p {$public}"); if (!file_exists("/tmp/{$nonce}/apigen/index.html")) { \DB::connection('apigenci')->table('repos')->where('id', $id)->update(['failed' => 2, 'queued' => 0, 'built' => 0]); } else { # copy docs into webroot exec("rsync -a --delete /tmp/{$nonce}/apigen/ {$public}"); // Remove queued and failed flags \DB::connection('apigenci')->table('repos')->where('id', $id)->update(['failed' => 0, 'queued' => 0, 'built' => 1]); } // Copy log into webroot exec("rsync -a /tmp/{$nonce}/log {$public}/log.txt"); // Output time into finished dir file_put_contents("{$public}/date.txt", mysqltime()); // Delete nonce folder and cache folders exec("rm -rf /tmp/{$nonce}"); exec('rm -rf /tmp/_apigen'); }
} @keyframes spin { from { transform: scale(1) rotate(0deg);} to { transform: scale(1) rotate(360deg);} } </style> <?php $localRepos = \Apigenci\Model::dbUserRepos(\Apigenci\Model::githubId()); ?> @foreach($repos as $repo) <?php $encrypted = \Apigenci\Model::repoEncodeWeb($repo->id); $localRepo = \Apigenci\Model::dbRepo($repo->id, $localRepos); ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="repolist panel panel-default"> <div class="panel-body"> <div class="floatLeft"> <a target="_blank" href="{{ $repo->html_url }}"><img src="/images/github32px.png" /></a> {{ \Session::get('user')->login }} / <span class="repoName">{{ $repo->name }}</span> @if (is_object($localRepo) && $localRepo->queued) <span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> @endif </div>