function embed_url($embed_url) { print " - Embed URL: {$embed_url}\n"; list($headers, $data) = ezcurl($embed_url, $error); if ($data == false) { appdeck_warning("failed to download: {$embed_url}: {$error}"); return; } if (strpos($data, "<") !== false) { appdeck_warning("failed to parse: {$embed_url}: HTML code found, this should be a text file"); return; } $data = strip_c_comment($data); // we embed embed_url in application appdeck_add_ressource($embed_url, $data, $headers, true); // we embed all url listed in this file $lines = explode("\n", $data); foreach ($lines as $line) { if (trim($line) != "") { appdeck_add_ressource(trim($line)); } } }
mkdir($output_dir, 0777, true); } $output_dir_path = realpath($output_dir); if ($output_dir_path == false) { appdeck_error("failed to create embedresource directory {$output_dir}", __FILE__, __LINE__); } // set beacon if needed // this beacon is used to clear cache on startup after a clean build $beacon_output_file_path = $output_dir_path . "/beacon"; if (defined('FORCE_DOWNLOAD') && FORCE_DOWNLOAD === true && file_exists($beacon_output_file_path)) { unlink($beacon_output_file_path); } if (!file_exists($beacon_output_file_path)) { file_put_contents($beacon_output_file_path, mt_rand()); } list($json_headers, $json_data) = ezcurl($app_json_url, $error); if ($json_data == false) { appdeck_error("failed to download: {$app_json_url}: {$error}", $app_plist_path); } $info = json_decode(json_minify($json_data)); if ($info == false) { appdeck_error("{$app_json_url}: invalid json data: {$json_data}"); } $base_url = isset($info->base_url) ? $info->base_url : $app_json_url; if (!isset($info->embed_url) && !isset($info->embed)) { appdeck_warning("no embed ressources defined in app.json"); } // by default we always embed app.json appdeck_add_ressource($app_json_url, $json_data, true); // try to add files from embed url if (isset($info->embed_url)) {