Permalink
Browse files

Detect and configure Git updates from plugin headers only.

  • Loading branch information...
1 parent 45ec318 commit 312a9623422a704d1b75c5d6a7d5f1cbb858495a @pdclark committed Jun 29, 2012
Showing with 217 additions and 213 deletions.
  1. +9 −22 README.md
  2. +9 −48 plugin.php
  3. +199 −143 updater.php
View
@@ -9,32 +9,19 @@ The code is still in it's infancy, but [I am currently using it](https://github.
Usage instructions
===========
-* The class should be included somewhere in your plugin. You will need to require the file (example: `include_once('updater.php');`).
-* You will need to initialize the class using something similar to this:
+* The plugin can be either be activated in WordPress, or updater.php can be included in your own plugin using `include_once 'updater.php';`.
+* Either way, the plugin will activate Github updates for every plugin with a github.com repository as the Plugin URI in its header:
<pre>
- if (is_admin()) { // note the use of is_admin() to double check that this is happening in the admin
- $config = array(
- 'slug' => plugin_basename(__FILE__), // this is the slug of your plugin
- 'proper_folder_name' => 'plugin-name', // this is the name of the folder your plugin lives in
- 'api_url' => 'https://api.github.com/repos/username/repository-name', // the github API url of your github repo
- 'raw_url' => 'https://raw.github.com/username/repository-name/master', // the github raw url of your github repo
- 'github_url' => 'https://github.com/username/repository-name', // the github url of your github repo
- 'zip_url' => 'https://github.com/username/repository-name/zipball/master', // the zip url of the github repo
- 'sslverify' => true // wether WP should check the validity of the SSL cert when getting an update, see https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/2 and https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/issues/4 for details
- 'requires' => '3.0', // which version of WordPress does your plugin require?
- 'tested' => '3.3', // which version of WordPress is your plugin tested up to?
- 'readme' => 'README.MD' // which file to use as the readme for the version number
- );
- new WPGitHubUpdater($config);
- }
+ /*
+ Plugin Name: Plugin Example
+ Plugin URI: https://github.com/jkudish/WordPress-GitHub-Plugin-Updater
+ Requires: 3.0
+ Tested: 3.4
+ */
</pre>
-* In your Github repository, you will need to include the following line (formatted exactly like this) anywhere in your Readme file:
-
- `~Current Version:1.4~`
-
-* You will need to update the version number anytime you update the plugin, this will ultimately let the plugin know that a new version is available.
+* In your Github repository, you will need to tag releases with new version numbers. New commits will not trigger an update until they are tagged with a higher version number. Don't forget to push your tags: `git push origin --tags`
* **Note**: this class will unfortunately not work with a private repository, your repository needs to be publicly accessible. If anyone knows how to make this work for private repositories, please get in touch!
View
@@ -1,9 +1,8 @@
<?php
-
/*
-Plugin Name: WP Github Plugin Updater Test
+Plugin Name: WP Github Plugin Updater
Plugin URI: https://github.com/jkudish/WordPress-GitHub-Plugin-Updater
-Description: Semi-automated test for the Github Plugin Updater
+Description: Enable updates for all plugins with github.com in the header under Plugin URI.
Version: 0.1
Author: Joachim Kudish
Author URI: http://jkudish.com/
@@ -13,53 +12,15 @@
/**
* Note: the version # above is purposely low in order to be able to test the updater
* The real version # is below
+ *
* @package GithubUpdater
* @author Joachim Kudish @link http://jkudish.com
* @since 1.3
- * @version 1.3
-*/
-
-/*
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-
-add_action('init', 'github_plugin_updater_test_init');
-function github_plugin_updater_test_init() {
-
- include_once('updater.php');
-
- define('WP_GITHUB_FORCE_UPDATE', true);
-
- if (is_admin()) { // note the use of is_admin() to double check that this is happening in the admin
-
- $config = array(
- 'slug' => plugin_basename(__FILE__),
- 'proper_folder_name' => 'github-updater',
- 'api_url' => 'https://api.github.com/repos/jkudish/WordPress-GitHub-Plugin-Updater',
- 'raw_url' => 'https://raw.github.com/jkudish/WordPress-GitHub-Plugin-Updater/master',
- 'github_url' => 'https://github.com/jkudish/WordPress-GitHub-Plugin-Updater',
- 'zip_url' => 'https://github.com/jkudish/WordPress-GitHub-Plugin-Updater/zipball/master',
- 'sslverify' => true,
- 'requires' => '3.0',
- 'tested' => '3.3',
- 'readme' => 'readme.txt'
- );
-
- new WPGitHubUpdater($config);
+ * @version 1.4
+ * @author Joachim Kudish <info@jkudish.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @copyright Copyright (c) 2011, Joachim Kudish
+ */
- }
-}
+include_once dirname(__FILE__).'/updater.php';
Oops, something went wrong.

0 comments on commit 312a962

Please sign in to comment.