Beispiel #1
0
    // Generate security file
    $dest = Project::root(Project::DIRECTORY_NAME) . '/';
    @mkdir($dest, 0777, true);
    @mkdir($dest . 'config/', 0777, true);
    @mkdir($dest . 'credentials/', 0777, true);
    $default_config_files = array('security.yaml', 'packages.yaml', 'schedule.yaml', 'schema.yaml', 'config/config.yaml', 'config/config.environment.yaml');
    foreach ($default_config_files as $config_file) {
        $dest_file = $dest . $config_file;
        $template = file_get_contents(__DIR__ . '/../../templates/' . $config_file);
        // replace environment on file
        if (preg_match('/\\.environment\\./', $dest_file)) {
            $dest_file = preg_replace('/\\.(environment)\\./', '.' . Project::getEnvironment() . '.', $dest_file);
            $template = preg_replace('/{{environment}}/', Project::getEnvironment(), $template);
        }
        if (!file_exists($dest_file)) {
            Console::success('create ' . str_replace(Project::root(), "", $dest_file));
            file_put_contents($dest_file, $template);
        }
    }
    if (!$args['json']) {
        Project::createCredentialsDirectory();
        foreach ($app->keys as $key) {
            $credentials = array('app_id' => $key->app_id, 'key' => $key->key, 'type' => $key->type, 'endpoint' => Client::getEndpoint());
            $dest_file = Project::getCredentialsPath() . $key->type . '.json';
            file_put_contents($dest_file, json_encode($credentials));
            Console::success('create ' . str_replace(Project::root(), "", $dest_file));
        }
        Console::output('Application created successfully.');
    }
    return $app->keys;
});
Beispiel #2
0
    // remove auto-generated PHP files
    if (count($js_converted_modules) > 0) {
        foreach ($js_converted_modules as $module) {
            unlink($module);
        }
    }
    if (isset($stats->error)) {
        Console::error($stats->error);
    }
    if (isset($stats->schedule)) {
        Console::output("Schedule updated.");
    }
    if (isset($stats->schema) && $stats->schema > 0) {
        Console::output($stats->schema . " collection(s) migrated.");
    }
    if (isset($stats->modules)) {
        if ($stats->modules->removed > 0) {
            Console::output($stats->modules->removed . " module(s) removed.");
        }
        if ($stats->modules->updated > 0) {
            Console::output($stats->modules->updated . " module(s) updated.");
        }
        if ($stats->modules->uploaded > 0) {
            Console::output($stats->modules->uploaded . " module(s) uploaded.");
        }
    }
    if (isset($stats->packages) && !empty($stats->packages)) {
        Console::output("\nPackages:\n\t" . preg_replace("/\\n/", "\n\t", $stats->packages));
    }
    Console::success("Successfully deployed.");
});