Ejemplo n.º 1
0
 } elseif ($spark->repository_type == 'git') {
     $token = 'spark-' . $spark->id . '-' . time();
     `git clone {$spark->base_location} {$tmp}`;
     `cd {$tmp} ; git checkout {$spark->tag} -b {$token} ; cd ..`;
 } else {
     echo "Unknown repo type ({$spark->repository_type}) for {$spark->name}.. skipping.\n";
     $unsuccessful[] = $spark;
     continue;
 }
 # Switch back to the webroot
 chdir($webroot);
 try {
     # All or nothing. Verify versions aand insert dependencies atomically
     $CI->db->trans_begin();
     # Load and validate the basics of the spark's YAML Spec
     $spec = Spark_spec::loadFromDirectory($tmp);
     # Check that everything looks with the spec on our end
     $spark->runPreSubmissionChecks($spec);
     # Add any dependencies in the spec
     $spark->processDependencies($spec);
     # Set the version
     $spark->setVersion($spec->version);
     # If there's a README file, store the contents
     $release = "{$spark->name}-{$spec->version}";
     $release_dir = $spark_path . $spark->name;
     if ($readme = $spec->getReadme()) {
         $readme = file_get_contents($tmp . '/' . $readme);
         $spark->setVersionReadme($spec->version, $readme);
     }
     # Mark this spark as verified
     $spark->setVerified($spec->version, TRUE, base_url() . config_item('archive_path') . $spark->name . '/' . $release . ".zip");
Ejemplo n.º 2
0
<?php

require_once dirname(__FILE__) . '/../libraries/spark_spec.php';
$args = $_SERVER['argv'];
$script = $args[0];
if (count($args) != 2) {
    exit("Usage: php {$script} [SPARK-PATH]\n");
}
$spark_path = rtrim($args[1], '/') . '/';
try {
    $spec = Spark_spec::loadFromDirectory($spark_path);
} catch (Exception $ex) {
    exit("Validation failed: " . $ex->getMessage() . "\n");
}
echo "Validation passed!\n";