diff --git a/README b/README index 7ea0bef..a7090eb 100644 --- a/README +++ b/README @@ -1,16 +1,28 @@ -Harmonious Code's internals are currently a complete mess. You have been warned. +(Harmonious Code's internals are currently a complete mess. You have been warned.) + +Harmonious Code is a static code analyzer for PHP, primarily geared toward +ensuring that the code you're writing will work on a particular base level +PHP installation. It will double-check each function and constant (and soon, +language constructs) that you're using and provide you with the minimum +version of PHP requires, as well as any necessary PECL modules, to run the +code that you've written. To build & use Harmonious Code on Unix-like operating systems: * Make sure you're running haXe 2. * Download the PHP documentation from CVS. -* Copy/symlink the phpdoc/phpbook/phpbook-xsl/version.xml file from the - PHP documentation into the data directory as version.xml. -* Run build/test.sh. This will take a while as functions_tokens_cache.hxd is +* Run the build/phpdoc_setup.sh script, passing either the relative or absolute + path to your phpdoc CVS folder: + + cd build + ./phpdoc_setup.sh /var/www/harmoniouscode/phpdoc + +* Run build/test.sh. This will take a short while as all_tokens.hxd is built in the data directory. It will also ensure everything's working correctly. * Run build/javascript.sh. The harmoniouscode.js file will be generated - in htdocs. + in htdocs. You'll also have a zip file with the entire Harmonious + Code bundle to pass off to others. * Open htdocs/index.html and try analyzing some PHP code. * Run build/command_line.sh and pass the path to a PHP file as the first parameter. A basic analysis should appear. diff --git a/htdocs/index.html b/htdocs/index.html index c599782..37a06b9 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -1,6 +1,6 @@ - Harmonious Code: Will my PHP code and Web hosting work together? + Harmonious Code: The PHP Static Code Version Checker
Loading... @@ -22,7 +23,7 @@

- +
diff --git a/htdocs/php_goes_here-crushed.png b/htdocs/php_goes_here-crushed.png new file mode 100644 index 0000000..3d37373 Binary files /dev/null and b/htdocs/php_goes_here-crushed.png differ diff --git a/htdocs/style.css b/htdocs/style.css index 3e77233..e70672d 100644 --- a/htdocs/style.css +++ b/htdocs/style.css @@ -7,7 +7,7 @@ body, td, div, li, p, span { font-size: 12px; } -h1 { +h1, h2 { text-align: center } @@ -71,6 +71,7 @@ th.is-filtering { textarea#source { width: 750px; height: 250px; + background: white url(php_goes_here-crushed.png) center center no-repeat; } div#footer { diff --git a/src/JavaScriptTarget.hx b/src/JavaScriptTarget.hx index ef7456f..248ddd9 100644 --- a/src/JavaScriptTarget.hx +++ b/src/JavaScriptTarget.hx @@ -27,6 +27,15 @@ class JavaScriptTarget { loading_div.style.display = "none"; form_div.style.display = ""; + + var source = js.Lib.document.getElementById("source"); + untyped { + if (source.value != "") { + source.style.backgroundImage = "none"; + } else { + source.onclick = function(e) { source.style.backgroundImage = "none"; } + } + } #end } diff --git a/src/TestCommandLineInterface.hx b/src/TestCommandLineInterface.hx new file mode 100644 index 0000000..e22d9d0 --- /dev/null +++ b/src/TestCommandLineInterface.hx @@ -0,0 +1,17 @@ +import CommandLineInterface; + +class TestCommandLineInterface extends haxe.unit.TestCase { + function testOptionParsing() { + var options = [ + [ [ "meow.php" ], "{file => meow.php}" ], + [ [ "--file", "meow.php" ], "{file => meow.php}" ], + [ [ "--php-version", "5.2.0", "meow.php" ], "{php-version => 5.2.0, file => meow.php}" ] + ]; + + for (option in options) { + var arguments : Array = option[0]; + var expected_result : String = option[1]; + assertEquals(expected_result.length, CommandLineInterface.parse_arguments(arguments).toString().length); + } + } +} \ No newline at end of file