Permalink
Browse files

Merge branch 'master' of github.com:katzgrau/getsparks.org

  • Loading branch information...
Beau Frusetta
Beau Frusetta committed Feb 24, 2011
2 parents 6cccefe + 54ebc01 commit 2391a75a2a026126c5423f3cc77d0375c3995094
View
@@ -1 +0,0 @@
-static/archives.*
View
5 TODO
@@ -1,5 +0,0 @@
-- Create sparks directory if it doesn't exist.
-- Say when the internet connection isn't available vs 404
-- update and update-all
-- match CI coding standards
-- $ tools/spark search [term]
@@ -4,12 +4,18 @@
$config['install_prototype_nix'] = 'tools/spark install';
-$config['sparks_download_text'] = 'Get Sparks';
+$config['sparks_download_button_text'] = 'Get Sparks Now!';
-$config['sparks_download_url'] = 'http://getsparks.org/static/spark-manager.zip';
+$config['sparks_download_button_url'] = config_item('base_url').'set-up';
+
+$config['sparks_download_url'] = config_item('base_url').'static/install/spark-manager-0.0.2.zip';
+
+$config['sparks_loader_url'] = config_item('base_url').'static/install/Loader.php.txt';
$config['install_count_base'] = 1232;
$config['archive_path'] = 'static/archives/';
-$config['system_alert_email'] = 'cron@oconf.org';
+$config['system_alert_email'] = 'cron@oconf.org';
+
+$config['support_email'] = 'katzgrau@gmail.com';
@@ -19,7 +19,7 @@
$route['home'] = "home/index";
$route['download'] = "home/download";
-$route['install'] = "home/install";
+$route['set-up'] = "home/set_up";
$route['get-sparks'] = "home/get_sparks";
$route['make-sparks'] = "home/make_sparks";
$route['about'] = "home/about";
@@ -28,6 +28,8 @@
$route['register'] = "contributors/register";
$route['contact'] = "home/contact";
$route['privacy'] = "home/privacy";
+$route['go-sparks'] = "home/go_sparks";
+$route['install'] = "home/set_up";
$route['contributors/(:any)/profile'] = "contributors/profile/$1";
$route['contributors/(:any)/profile/edit'] = "contributors/edit/";
@@ -23,9 +23,9 @@ function index()
$this->load->view('home/index', $data);
}
- function install()
+ function set_up()
{
- $this->load->view('home/install');;
+ $this->load->view('home/set_up');;
}
function get_sparks()
@@ -60,6 +60,22 @@ function privacy()
{
$this->load->view('home/privacy');
}
+
+ function project()
+ {
+ $this->load->spark('gravatar-helper/1.1');
+ $this->load->helper('gravatar');
+
+ $this->load->view('home/project');
+ }
+
+ /**
+ * The installation script
+ */
+ function go_sparks()
+ {
+ $this->load->view('home/go_sparks');
+ }
}
/* End of file welcome.php */
@@ -1,9 +1,15 @@
<?php
+/**
+ * The file contains a model for dealing with contributors
+ */
+/**
+ * This model represents a spark contributor
+ */
class Contributor extends CI_Model
{
/**
- *
+ * Insert a contributor record
* @param <type> $data
* @return bool
*/
@@ -62,7 +68,7 @@ public function getContributions()
}
/**
- *
+ * Update a contributor's data
* @param int $id
* @param array $data
* @return bool
@@ -1,7 +1,18 @@
<?php
+/**
+ * A file that contains a model for dealing with downloads
+ */
+/**
+ * A model for tracking download activity on the site
+ */
class Download extends CI_Model
{
+ /**
+ * Record a download in the downloads table
+ * @param string $type The type of download
+ * @return bool True on success, false on failure
+ */
public static function recordDownload($type = 'unknown')
{
$CI = &get_instance();
@@ -24,7 +24,7 @@
<ul>
<?php foreach ($official_sparks as $spark) { ?>
<li class="clearfix">
- <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo GravatarHelper::from_email($spark->email, null, 40); ?>" /></a>
+ <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo Gravatar_helper::from_email($spark->email, null, 40); ?>" /></a>
<p class="no-margin">
<a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><?php echo $spark->name; ?></a><br />
by: <a href="<?php echo base_url(); ?>contributors/<?php echo $spark->username; ?>/profile"><?php echo $spark->username; ?></a>
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title><?php if(isset($title)) echo "$title &mdash; "; ?>CodeIgniter Sparks Repository </title>
+<title>CodeIgniter Sparks | <?php echo isset($title) ? "$title" : "The Package Manager and Repository"; ?></title>
<link rel='stylesheet' type='text/css' media='all' href='/static/styles/reset.css' />
<link rel='stylesheet' type='text/css' media='all' href='/static/styles/fancybox.css' />
@@ -25,12 +25,12 @@
<body>
<div id="header" class="clearfix">
- <div class="wrapper">
+ <div class="wrapper header-wrapper">
<h1><a href="/" title="Sparks | Automated Package Management for Codeigniter">Sparks</a></h1>
<div class="spark-count">
<p>
<?php echo number_format(UtilityHelper::getGlobalInstallCount()); ?> Installs and Counting!
- <a href="#" title="Get Sparking!">Get Sparks Now!</a>
+ <a href="<?php echo config_item('sparks_download_button_url'); ?>" title="Get Sparking!"><?php echo config_item('sparks_download_button_text'); ?></a>
</p>
</div>
</div>
@@ -1,6 +1,6 @@
-<?php $this->load->view('global/_header.php', array('title' => 'How to Write a Spark')); ?>
+<?php $this->load->view('global/_new_header.php', array('title' => 'Installing Sparks')); ?>
-<h2>Step 2. Installing Sparks</h2>
+<h2>Guide #2: Installing Sparks</h2>
<p>
This document will explain how to install sparks with both the spark manager <em>and</em>
@@ -44,15 +44,58 @@
$this->example_spark->printHello(); # echo's "Hello from the example spark!"
</pre>
+<p>Now you can install all the sparks you want. And if you feel like contributing your own, check out <a href="<?php echo base_url(); ?>make-sparks">Step 3</a>.</p>
+
<h3>Installing Sparks Manually</h3>
<p>
- Find the package you want to install in the repository, perhaps via <a href="#">search</a>.
- For this example, we'll use 'example-spark', whose page can be found here:
- <a target="_blank" href="<?php echo base_url(); ?>packages/example-spark/show">
- <?php echo base_url(); ?>packages/example-spark/show
- </a>
+ Follow these directions for installing sparks without a script. This is most
+ practical for developers on shared servers, where using the PHP would prove
+ difficult or impossible.
</p>
+<ol>
+ <li>
+ Browse or search for the package that you need. As an example, we'll use
+ <a target="_blank" href="<?php echo base_url(); ?>packages/example-spark/show">
+ example-spark
+ </a>.
+ </li>
+ <li>
+ Find the version you would like to download. This is most likely the top-listed
+ version, which is the latest (sometimes denoted as 'HEAD').
+ </li>
+ <li>
+ Click the link to "Get example-spark-v1.0.zip", and download it.
+ </li>
+ <li>
+ Extract the contents of the zip to a folder inside the sparks/ directory at the base of
+ your application.
+ </li>
+ <li>
+ You can name the folder anything you'd like, but <strong>example-spark</strong> should be sufficient.
+ <em>You can additionally nest the spark into a second folder with its verison number (as the
+ CLI script does), but that is entirely optional.</em>
+ </li>
+ <li>You should now have a directory structure similar to:
+<pre>
+/application
+/system
+/sparks
+..../example-spark
+......../config
+......../libraries
+</pre>
+ </li>
+
+<p>Now your spark is installed! Try this from within your application:</p>
+
+<pre>
+$this->spark->load('example-spark'); # Don't forget to add '/[version]' if you added a version folder!
+$this->example_spark->printHello(); # echo's "Hello from the example spark!"
+</pre>
+</ol>
+
+<p>Lookin' good? Want to contribute? Check out <a href="<?php echo base_url(); ?>make-sparks">Step 3</a>.</p>
-<?php $this->load->view('global/_footer.php'); ?>
+<?php $this->load->view('global/_new_footer.php'); ?>
@@ -0,0 +1,40 @@
+$zip = "<?php echo config_item('sparks_download_url'); ?>";
+$loader = "<?php echo config_item('sparks_loader_url'); ?>";
+
+if(!file_exists("application/core"))
+{
+ echo "Can't find application/core. Currently this script only works with the default instance of Reactor. You may need to try a manual installation..\n";
+ exit;
+}
+
+echo "Pulling down spark manager from $zip ...\n";
+copy($zip, "sparks.zip");
+
+echo "Pulling down Loader class core extension from $loader ...\n";
+copy($loader, "application/core/MY_Loader.php");
+
+echo "Extracting zip package ...\n";
+if(class_exists('ZipArchive'))
+{
+ $zip = new ZipArchive;
+ if ($zip->open('sparks.zip') === TRUE)
+ {
+ $zip->extractTo('./tools');
+ $zip->close();
+ } else {
+ echo "Extraction failed .. exiting.\n";
+ exit;
+ }
+} elseif(!!@`unzip`) {
+ `unzip sparks.zip -d ./tools`;
+} else
+{
+ echo "It seems you have no PHP zip library or `unzip` in your path. Use the manual installation.\n";
+ exit;
+}
+
+echo "Cleaning up ...\n";
+@unlink('sparks.zip');
+
+echo "Spark Manager has been install successfully!\n";
+echo "Try: `php tools/spark help`\n";
@@ -15,7 +15,7 @@
<ul>
<?php foreach ($featured_sparks as $spark) { ?>
<li class="clearfix">
- <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo GravatarHelper::from_email($spark->email, null, 40); ?>" /></a>
+ <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo Gravatar_helper::from_email($spark->email, null, 40); ?>" /></a>
<p>
<a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><?php echo $spark->name; ?></a><br />
by: <a href="<?php echo base_url(); ?>contributors/<?php echo $spark->username; ?>/profile"><?php echo $spark->username; ?></a>
@@ -33,7 +33,7 @@
<ul>
<?php foreach ($top_sparks as $spark) { ?>
<li class="clearfix">
- <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo GravatarHelper::from_email($spark->email, null, 40); ?>" /></a>
+ <a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><img src="<?php echo Gravatar_helper::from_email($spark->email, null, 40); ?>" /></a>
<p>
<a style="font-size:16px;" href="<?php echo base_url(); ?>packages/<?php echo $spark->name; ?>/versions/HEAD/show"><?php echo $spark->name; ?></a><br />
by: <a href="<?php echo base_url(); ?>contributors/<?php echo $spark->username; ?>/profile"><?php echo $spark->username; ?></a>
Oops, something went wrong.

0 comments on commit 2391a75

Please sign in to comment.