Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'develop'

  • Loading branch information...
commit f32c535bbe3982dec5fa0dfa052ed18289c7ddfc 2 parents 05bf6b8 + 57108d8
@katzgrau authored
View
1  .gitignore
@@ -5,3 +5,4 @@ application/logs/*
application/cache/*
*.swp
*.swo
+/vendor/.composer/
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
36 Boxfile
@@ -0,0 +1,36 @@
+web1: #component type & number
+ name: getsparks #component settings
+ shared_writable_dirs:
+ - application/cache
+ - application/logs
+ - static/cache
+ - static/archives
+ php_version: 5.3.8
+ php_extensions:
+ - 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
4 application/config/application.php
@@ -13,7 +13,7 @@
$config['sparks_download_button_url'] = config_item('base_url').'set-up';
# Get the latest
-$config['spark_manager_version_latest'] = '0.0.7';
+$config['spark_manager_version_latest'] = '0.0.9';
# Where to download the spark manager (the file)
$config['sparks_download_url'] = config_item('base_url').'static/install/spark-manager-'.$config['spark_manager_version_latest'].'.zip';
@@ -55,4 +55,4 @@
#'The one and only for PHP frameworks',
);
-$config['sparks_phrase'] = $config['sparks_phrases'][array_rand($config['sparks_phrases'])];
+$config['sparks_phrase'] = $config['sparks_phrases'][array_rand($config['sparks_phrases'])];
View
10 application/config/config.php
@@ -4,7 +4,11 @@
$config['is_maintanence'] = FALSE;
# Use prod settings? (Super-caching, minifying, etc)
-$config['is_production'] = FALSE;
+if(@$_SERVER['PAGODA_PRODUCTION']) {
+ $config['is_production'] = TRUE;
+} else {
+ $config['is_production'] = FALSE;
+}
# Environment-specific for SES. Required for mailing.
$config['ses_secret_key'] = '';
@@ -24,7 +28,7 @@
|
*/
# $config['base_url'] = '';
- $config['base_url'] = 'http://sparks.codeigniter.com/';
+$config['base_url'] = '/';
# $config['base_url'] = 'http://localhost:8888/';
/*
|--------------------------------------------------------------------------
@@ -367,4 +371,4 @@
/* End of file config.php */
-/* Location: ./application/config/config.php */
+/* Location: ./application/config/config.php */
View
16 application/config/database.php
@@ -41,9 +41,17 @@
$active_group = 'default';
$active_record = TRUE;
-$db['default']['hostname'] = '127.0.0.1:3306';
-$db['default']['username'] = 'root';
-$db['default']['password'] = '';
+if(@$_SERVER['PAGODA_PRODUCTION']) {
+ # Use built-in Padoga environment vars
+ $db['default']['hostname'] = $_SERVER['DB1_HOST'].':'.$_SERVER['DB1_PORT'];
+ $db['default']['username'] = $_SERVER['DB1_USER'];
+ $db['default']['password'] = $_SERVER['DB1_PASS'];
+} else {
+ $db['default']['hostname'] = '127.0.0.1:3306';
+ $db['default']['username'] = 'root';
+ $db['default']['password'] = '';
+}
+
$db['default']['database'] = 'sparks';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
@@ -59,4 +67,4 @@
/* End of file database.php */
-/* Location: ./application/config/database.php */
+/* Location: ./application/config/database.php */
View
10 application/controllers/packages.php
@@ -288,7 +288,7 @@ function summary()
* 'latest', 'featured' and 'official'
* @param string $type
*/
- function browse($type)
+ function browse($type = false)
{
UtilityHelper::tryPageCache(1);
@@ -318,6 +318,14 @@ function browse($type)
$data['browse_type'] = 'Browse Official';
$data['description'] = 'These are sparks written by GetSparks, the Reactor Team, or CodeIgntier gurus';
}
+ else
+ {
+ # Ugly fix for now, not sure why we didn't have a 'browse all'
+ # in the first place :P
+ $sparks = Spark::getTop(1000);
+ $data['browse_type'] = 'Browse All';
+ $data['description'] = 'These are all of GetSparks\' sparks';
+ }
# Get a list of spark ids on this page
$ids = array(); foreach($sparks as $s) $ids[] = $s->id;
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
2  application/views/home/make_sparks.php
@@ -18,7 +18,7 @@
<p>
GetSparks.org is <strong>entirely backed by external repositories.</strong>
That means we do not host your projects. Your project can live happily on your
- <a href="http://github.com" target="_blank">GitHub</a> or <a href="http://bitbucket.com" target="_blank">BitBucket</a> account, or personal git or mercurial server. When you
+ <a href="http://github.com" target="_blank">GitHub</a> or <a href="http://bitbucket.org" target="_blank">BitBucket</a> account, or personal git or mercurial server. When you
register a spark at GetSparks, you simply point us to your repository.
</p>
View
4 application/views/home/set_up.php
@@ -102,6 +102,6 @@
<a name="option-3"></a>
<h3>Option 3. It Doesn't Go Well</h3>
<p>
- Send us an email at <a href="ohcrap@getsparks.org">ohcrap@getsparks.org</a>, and let us know. We'll try and get you up and running.
+ Send us an email at <a href="mailto:ohcrap@getsparks.org">ohcrap@getsparks.org</a>, and let us know. We'll try and get you up and running.
</p>
-<?php $this->load->view('global/_new_footer.php'); ?>
+<?php $this->load->view('global/_new_footer.php'); ?>
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";
View
2  static/install.php
@@ -1,4 +1,4 @@
-$zip = "http://getsparks.org/static/install/spark-manager-0.0.5.zip";
+$zip = "http://getsparks.org/static/install/spark-manager-0.0.9.zip";
$loader = "http://getsparks.org/static/install/Loader.php.txt";
if(!file_exists("application/core"))
View
BIN  static/install/spark-manager-0.0.8.zip
Binary file not shown
View
BIN  static/install/spark-manager-0.0.9.zip
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.