Permalink
Please
sign in to comment.
Showing
with
944 additions
and 0 deletions.
- +8 −0 .travis.yml
- +13 −0 tools/checksql.sh
- +31 −0 tools/php-sqllint/bin/php-sqllint
- +103 −0 tools/php-sqllint/build.xml
- +22 −0 tools/php-sqllint/composer.json
- +186 −0 tools/php-sqllint/composer.lock
- +57 −0 tools/php-sqllint/src/phpsqllint/Autoloader.php
- +280 −0 tools/php-sqllint/src/phpsqllint/Cli.php
- +54 −0 tools/php-sqllint/src/phpsqllint/Renderer.php
- +70 −0 tools/php-sqllint/src/phpsqllint/Renderer/Emacs.php
- +102 −0 tools/php-sqllint/src/phpsqllint/Renderer/Text.php
- +18 −0 tools/php-sqllint/src/stub-phar.php
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
function checkdir { | ||
for sql in $1/*.sql | ||
do | ||
echo "checking ${sql}" | ||
php -d memory_limit=4G ./tools/php-sqllint/bin/php-sqllint "${sql}" || exit 1 | ||
done | ||
} | ||
|
||
checkdir "sql-files" | ||
checkdir "sql-files/upgrades" | ||
checkdir "sql-files/tools" |
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* SQL linter (syntax checker) written in PHP | ||
* | ||
* PHP version 5 | ||
* | ||
* @category Tools | ||
* @package PHP-SQLlint | ||
* @author Christian Weiske <cweiske@cweiske.de> | ||
* @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3 | ||
* @link http://cweiske.de/php-sqllint.htm | ||
*/ | ||
namespace phpsqllint; | ||
if (file_exists(__DIR__ . '/../vendor/autoload.php')) { | ||
//local git checkout | ||
include_once __DIR__ . '/../vendor/autoload.php'; | ||
} else if (file_exists('vendor/autoload.php')) { | ||
//dependency composer installation | ||
include_once 'vendor/autoload.php'; | ||
} | ||
if (file_exists(__DIR__ . '/../src/phpsqllint/Autoloader.php')) { | ||
include_once __DIR__ . '/../src/phpsqllint/Autoloader.php'; | ||
Autoloader::register(); | ||
} | ||
$cli = new Cli(); | ||
$cli->run(); | ||
?> |
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<project name="php-sqllint" default="phar" basedir="."> | ||
|
||
<!--<property name="version" value="dev" />--> | ||
<loadfile property="version" file="VERSION"> | ||
<filterchain> | ||
<striplinebreaks /> | ||
</filterchain> | ||
</loadfile> | ||
|
||
<property name="pharfile" value="${phing.dir}/dist/${phing.project.name}-${version}.phar" /> | ||
<property name="pharfilebz2" value="${phing.dir}/dist/${phing.project.name}-${version}.bz2.phar" /> | ||
<property name="libdir" value="${phing.dir}/lib"/> | ||
|
||
<fileset id="fs.phar" dir="${phing.dir}"> | ||
<include name="bin/**"/> | ||
<include name="lib/**"/> | ||
<include name="src/**"/> | ||
|
||
<include name="README.rst"/> | ||
<include name="VERSION"/> | ||
|
||
<include name="vendor/autoload.php"/> | ||
<include name="vendor/composer/*.php"/> | ||
<include name="vendor/pear/console_commandline/Console/**"/> | ||
<include name="vendor/pear/pear_exception/PEAR/**"/> | ||
<include name="vendor/phpmyadmin/sql-parser/src/**"/> | ||
</fileset> | ||
|
||
|
||
<typedef name="pearPackageFileSet" classname="phing.types.PearPackageFileSet" /> | ||
|
||
<target name="phar" depends="collectdeps" | ||
description="Create zip file for release" | ||
> | ||
<!-- strip the shebang from bin script --> | ||
<copy file="${phing.dir}/bin/php-sqllint" tofile="${phing.dir}/bin/phar-php-sqllint.php"> | ||
<filterchain> | ||
<striplinecomments> | ||
<comment value="#" /> | ||
</striplinecomments> | ||
</filterchain> | ||
</copy> | ||
|
||
<mkdir dir="${phing.dir}/dist"/> | ||
<delete file="${pharfile}"/> | ||
<pharpackage basedir="${phing.dir}" | ||
destfile="${pharfile}" | ||
stub="${phing.dir}/src/stub-phar.php" | ||
alias="php-sqllint.phar" | ||
compression="none" | ||
> | ||
<fileset refid="fs.phar"/> | ||
</pharpackage> | ||
|
||
<pharpackage basedir="${phing.dir}" | ||
destfile="${pharfilebz2}" | ||
stub="${phing.dir}/src/stub-phar.php" | ||
alias="php-sqllint.phar" | ||
compression="bzip2" | ||
> | ||
<fileset refid="fs.phar"/> | ||
</pharpackage> | ||
|
||
<exec executable="chmod"> | ||
<arg value="+x"/> | ||
<arg value="${pharfile}"/> | ||
<arg value="${pharfilebz2}"/> | ||
</exec> | ||
</target> | ||
|
||
|
||
<target name="collectdeps" description="Copy package dependencies to lib/"> | ||
<exec command="composer install"/> | ||
<!-- | ||
<delete dir="${libdir}"/> | ||
<mkdir dir="${libdir}"/> | ||
<pearPackageFileset id="dep-Console_CommandLine" package="pear.php.net/Console_CommandLine"/> | ||
<pearPackageFileset id="dep-PEAR" package="pear.php.net/PEAR"> | ||
<include name="PEAR/Exception.php"/> | ||
</pearPackageFileset> | ||
<copy todir="${libdir}"> | ||
<fileset refid="dep-Console_CommandLine"/> | ||
<fileset refid="dep-PEAR"/> | ||
</copy> | ||
--> | ||
</target> | ||
|
||
|
||
<target name="docs" description="render documentation"> | ||
<rst file="README.rst"/> | ||
</target> | ||
|
||
<target name="update-website" depends="docs"> | ||
<exec command="xmlstarlet sel -t -c '/_:html/_:body/_:div' README.html | ||
| xmllint --format - | ||
|grep -v '?xml version' | ||
> ~/Dev/html/cweiske.de/www/php-sqllint.htm"/> | ||
</target> | ||
|
||
</project> |
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "cweiske/php-sqllint", | ||
"description": "Command line tool to validate (syntax check) SQL files", | ||
"type": "project", | ||
"bin": ["bin/php-sqllint"], | ||
"require": { | ||
"phpmyadmin/sql-parser": "^4.1.1", | ||
"pear/console_commandline": "^1.2" | ||
}, | ||
"homepage": "http://cweiske.de/php-sqllint.htm", | ||
"license": "AGPL-3.0", | ||
"authors": [ | ||
{ | ||
"name": "Christian Weiske", | ||
"email": "cweiske@cweiske.de", | ||
"homepage": "http://cweiske.de/" | ||
} | ||
], | ||
"support": { | ||
"issues": "https://github.com/cweiske/php-sqllint/issues" | ||
} | ||
} |

Oops, something went wrong.
0 comments on commit
05ea799