diff --git a/SourceCgit/SourceCgit.php b/SourceCgit/SourceCgit.php index 518993a..834d008 100644 --- a/SourceCgit/SourceCgit.php +++ b/SourceCgit/SourceCgit.php @@ -28,7 +28,7 @@ $this->author = 'Alexander'; $this->contact = 'iam.asm89@gmail.com'; - $this->url = '-'; + $this->url = 'http://leetcode.net/'; } public $type = 'cgit'; diff --git a/SourceCgit/SourceCgitTest.php b/SourceCgit/SourceCgitTest.php index 325a767..887ed76 100644 --- a/SourceCgit/SourceCgitTest.php +++ b/SourceCgit/SourceCgitTest.php @@ -3,22 +3,47 @@ # Copyright (c) 2011 asm89 # Licensed under the MIT license -// A simple file for testing if the cgit plugin parses everything in the right way. +/** + * This simple test fetches the specified url and outputs the parsed content. + * This output can be compared with the content of the webpage to verify that + * the cgit parser works. + * + * Usage: php SourceCgitTest.php + */ -// define testing mode +// Url pointing to a commit on Cgit (default is a commit of the cgit project) +$url = 'http://hjemli.net/git/cgit/commit/?id=d885158f6ac29e04bd14dd132331c7e3a93e7490'; + +// Define testing mode define('testing', true); include 'SourceCgit.php'; -// Get a testpage -$testpage = file_get_contents('http://hjemli.net/git/cgit/commit/?id=d885158f6ac29e04bd14dd132331c7e3a93e7490'); +// Get the testpage +$testpage = file_get_contents($url); +// Initialize the plugin $plugin = new SourceCgitPlugin(); +// Sanatize the input $t_input = $plugin->clean_input( $testpage ); + +print_n( 'Revision:' ); print_c( $plugin->commit_revision( $t_input ) ); +print_n(); + +print_n( 'Author/commiter info:' ); print_c( $plugin->commit_author( $t_input ) ); +print_n(); + +print_n( 'Parent commits:' ); print_c( $plugin->commit_parents( $t_input ) ); +print_n(); + +print_n( 'Commit message:' ); print_c( $plugin->commit_message( $t_input ) ); +print_n(); + +print_n( 'Committed files:' ); print_c( $plugin->commit_files( $t_input ) ); /** @@ -32,6 +57,15 @@ } /** + * Print the text and a newline. + * + * @param string $text + */ +function print_n($text = '') { + echo $text . "\n"; +} + +/** * MantisSourcePlugin stub */ class MantisSourcePlugin {} diff --git a/SourceCgit/lang/strings_english.txt b/SourceCgit/lang/strings_english.txt index e315aef..9753d5f 100644 --- a/SourceCgit/lang/strings_english.txt +++ b/SourceCgit/lang/strings_english.txt @@ -8,6 +8,6 @@ $s_plugin_SourceCgit_title = 'Cgit Integration'; $s_plugin_SourceCgit_description = 'Adds Cgit integration to the Source Integration framework.'; -$s_plugin_SourceCgit_cgit_root = 'Cgit Root URL'; +$s_plugin_SourceCgit_cgit_root = 'Cgit Root URL
(including trailing /)'; $s_plugin_SourceCgit_cgit_project = 'Cgit Project'; $s_plugin_SourceCgit_master_branch = 'Primary Branches
(comma-separated list)'; diff --git a/SourceCgit/lang/strings_german.txt b/SourceCgit/lang/strings_german.txt index 752ffa5..9844263 100644 --- a/SourceCgit/lang/strings_german.txt +++ b/SourceCgit/lang/strings_german.txt @@ -8,6 +8,6 @@ $s_plugin_SourceCgit_title = 'Cgit Integration'; $s_plugin_SourceCgit_description = 'Integration für cgit über die VCS Basisintegration.'; -$s_plugin_SourceCgit_cgit_root = 'Cgit Basis-URL'; +$s_plugin_SourceCgit_cgit_root = 'Cgit Basis-URL
(inklusive nachgestellte /)'; $s_plugin_SourceCgit_cgit_project = 'Cgit Projekt'; $s_plugin_SourceCgit_master_branch = 'Hauptzweige
(kommaseparierte Liste)';