Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More pagoda settings

  • Loading branch information...
commit f029beb9edc636ed9a33190b0da4a6adbf2e679f 1 parent d0abaad
@katzgrau authored
View
138 API.markdown
@@ -0,0 +1,138 @@
+# GetSparks.org API Description
+
+Part of the goal of a CodeIgniter package manager was making it possible to
+host package sources other than GetSparks.org. You can do that one of two ways:
+
+1. Deploy the open-source GetSparks.org codebase somewhere
+2. Create an application that conforms to the same API interface as GetSparks.org
+
+This document is aimed toward describing the JSON API that the command line
+spark utility interacts with. If this API is replicated in a new app, it can
+act as a spark provider.
+
+At this time, GetSparks.org has a read-only API.
+
+## Packages
+
+### GET api/packages/search
+
+Used for searching for existing sparks.
+
+#### URI Parameters
+
+None
+
+#### Query Parameters
+
+**q**: The search string
+
+#### Example
+
+[http://getsparks.org/api/packages/search?q=sdk](http://getsparks.org/api/packages/search?q=sdk)
+
+#### Example Output (snipped)
+
+ {
+ "success": true,
+ "results": [
+ {
+ "id": "68",
+ "contributor_id": "2",
+ "name": "spark-sdk",
+ "summary": "A spark for validating other sparks.",
+ "description": "A spark for validating other sparks. Useful for spark contributors.\n\nIt is the exact same library used by GetSparks.org to automatically validate new sparks.",
+ "repository_type": "git",
+ "base_location": "git://github.com/katzgrau/spark-sdk.git",
+ "website": "https://github.com/katzgrau/spark-sdk",
+ "is_unsupported": "0",
+ "is_approved": "0",
+ "is_featured": "1",
+ "is_official": "1",
+ "is_browse": "1",
+ "fork_id": "0",
+ "created": "2011-04-30 21:47:04",
+ "modified": "2011-04-30 21:47:04",
+ "username": "katzgrau",
+ "email": "katzgrau@gmail.com",
+ "last_push": "2011-05-06 06:43:28"
+ },
+ ... More ...
+ }
+
+### GET api/packages/**package_name**/versions/**version**/spec
+
+This call returns all of the info needed to install a spark locally.
+
+#### URI Parameters
+
+**Package Name**: The name of the package
+**Version**: The version of the spark you're looking for. Using 'HEAD' will
+ grab the latest version of the spark.
+
+#### Example Output
+
+ {
+ "success": true,
+ "spec": {
+ "id": "22",
+ "contributor_id": "11",
+ "name": "amazon-ses",
+ "summary": "A CodeIgniter library to interact with Amazon Web Services (AWS) Simple Email Service (SES)",
+ "description": "",
+ "repository_type": "git",
+ "base_location": "git://github.com/joelcox/codeigniter-amazon-ses.git",
+ "website": "http://github.com/joelcox/codeigniter-amazon-ses",
+ "is_unsupported": "0",
+ "is_approved": "0",
+ "is_featured": "1",
+ "is_official": "0",
+ "is_browse": "1",
+ "fork_id": "0",
+ "created": "2011-02-28 19:51:01",
+ "modified": "2011-02-28 19:51:01",
+ "version": "0.3.1",
+ "is_deactivated": "0",
+ "archive_url": "http://getsparks.org/static/archives/amazon-ses/amazon-ses-0.3.1.zip",
+ "tag": "0.3.1",
+ "readme": "CodeIgniter Amazon SES\n======================\n (Snipped for brevity)",
+ "version_id": "853",
+ "spark_home": "http://getsparks.org/packages/amazon-ses/show",
+ "contributor": {
+ "id": "11",
+ "username": "joelcox",
+ "email": "joel@joelcox.nl",
+ "email_hash": "d664f094eaeebaa43bd3a2afe4e63c36",
+ "real_name": "Joël Cox",
+ "community_profile_link": "",
+ "website": "http://joelcox.nl",
+ "is_admin": "0",
+ "created": "2011-02-28 19:45:15",
+ "modified": "2011-02-28 19:45:14"
+ },
+ "dependencies": [
+ {
+ "id": "25",
+ "contributor_id": "14",
+ "name": "curl",
+ "summary": "Work with cURL easily from your CodeIgniter application.",
+ "description": "CodeIgniter-cURL is a CodeIgniter library which makes it easy to do simple cURL requests and makes more complicated cURL requests easier too.",
+ "repository_type": "git",
+ "base_location": "git://github.com/philsturgeon/codeigniter-curl.git",
+ "website": null,
+ "is_unsupported": "0",
+ "is_approved": "0",
+ "is_featured": "0",
+ "is_official": "1",
+ "is_browse": "1",
+ "fork_id": "0",
+ "created": "2011-03-01 00:31:37",
+ "modified": "2011-03-01 00:31:37",
+ "version": "1.0.0",
+ "tag": "1.0",
+ "is_deactivated": "0",
+ "version_id": "29",
+ "is_direct": "1"
+ }
+ ]
+ }
+ }
View
22 Boxfile
@@ -10,7 +10,27 @@ web1: #component type & number
- mysql
- apc
- curl
-
+ - zip
+
db1: #component type & number
name: sparks #component settings
type: mysql
+
+# General Pagoda Settings:
+#
+# Environment Variables:
+#
+# To let the app know it's running in production:
+#
+# PAGODA_PRODUCTION = 1
+#
+# Mailing is done through Amazon SES (for now)
+#
+# SES_SECRET_KEY = ?
+# SES_ACCESS_KEY = ?
+#
+# Importing Existing GetSparks.org Content
+#
+#
+#
+#
View
46 application/helpers/utility_helper.php
@@ -102,4 +102,50 @@ public static function isWindows()
$platform = $CI->agent->platform();
return strstr($platform, 'Windows');
}
+
+ /**
+ * Taken lovingly from StackOverflow.
+ * @link http://stackoverflow.com/questions/1334613/how-to-recursively-zip-a-directory-in-php
+ * @param string $source Source path
+ * @param string $destination The target destination
+ * @return boolean Success status
+ */
+ function zip($source, $destination)
+ {
+ if (!extension_loaded('zip') || !file_exists($source)) {
+ return false;
+ }
+
+ $zip = new ZipArchive();
+ if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
+ return false;
+ }
+
+ $source = str_replace('\\', '/', realpath($source));
+
+ if (is_dir($source) === true)
+ {
+ $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($source), RecursiveIteratorIterator::SELF_FIRST);
+
+ foreach ($files as $file)
+ {
+ $file = str_replace('\\', '/', realpath($file));
+
+ if (is_dir($file) === true)
+ {
+ $zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
+ }
+ else if (is_file($file) === true)
+ {
+ $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
+ }
+ }
+ }
+ else if (is_file($source) === true)
+ {
+ $zip->addFromString(basename($source), file_get_contents($source));
+ }
+
+ return $zip->close();
+ }
}
View
3  scripts/gather-zips.php
@@ -92,7 +92,7 @@
}
catch(Exception $ex)
{
- $CI->db->trans_rollback();
+ $CI->db->trans_rollback();
echo "Error processing {$spark->name} - {$spark->tag}: " . $ex->getMessage() . ". Removing..\n";
$errors = array($ex->getMessage());
$spark->removeTagAndNotify($spark->tag, $errors);
@@ -105,6 +105,7 @@
chdir($tmp);
# The spark's been added, now do some disk cleanup
@mkdir($release_dir, 0777, TRUE);
+ # http://stackoverflow.com/questions/1334613/how-to-recursively-zip-a-directory-in-php
`zip -r $release.zip *`;
@copy("$tmp/$release.zip", $release_dir."/$release.zip");
echo "Verified $spark->name v$spec->version -- $tmp\n";
Please sign in to comment.
Something went wrong with that request. Please try again.