Permalink
Browse files

Using composer for dependencies

- Switched to composer version of phpunit and phpcs
- Add composer file and fix some things to work with composer erfurt
- Remove ARC2, whichis not used in OntoWiki
- Remove Copy of Mimeparser and use it from composer
- Use bitworking/mimeparse from composer
- Add Unit Test for Mimeparser
- Use phpunit from composer in Makefile
- composer now downloads rdfauthor and places it into libraries, removed git-submodule things from Makefile
- Remove libraries/ from classpath
- added getcomposer actualized deploy
- getcomposer -> get the composer.phar
- deploy-> now gets libraries through composer
- Makefile fixing little errors, creating phpunit.xml in src
- Add my phpunit.xml
- Add install target, equal to deploy
- Add extension tests
- Update ruleset to work with current code sniffer release
- cleaned makefile changed test-calls
- deleted old codesniffer things, added new in Makefile + phpcbf;getting weird make error after executing make codesniffer, though it works
- Fix cases for RDFauthor
  • Loading branch information...
white-gecko authored and pfrischmuth committed Oct 20, 2015
1 parent a8eb80e commit e03c0731c2580a5dc6fc5efcc7ada71fb963e549
Showing with 140 additions and 16,423 deletions.
  1. +2 −0 .gitignore
  2. +0 −3 .gitmodules
  3. +34 −207 Makefile
  4. +2 −4 application/classes/OntoWiki/Utils.php
  5. +1 −18 application/tests/Bootstrap.php
  6. +1 −20 application/tests/BootstrapExtensions.php
  7. +0 −70 application/tests/CodeSniffer/Makefile
  8. +1 −2 application/tests/CodeSniffer/Standards/Ontowiki/ruleset.xml
  9. +0 −13 application/tests/CodeSniffer/config
  10. +0 −228 application/tests/CodeSniffer/cs-scripts.sh
  11. +0 −168 application/tests/CodeSniffer/pre-commit
  12. +32 −0 application/tests/unit/OntoWiki/UtilsTest.php
  13. +0 −1 application/views/templates/layouts/layout.phtml
  14. +25 −0 composer.json
  15. +2 −48 index.php
  16. +0 −487 libraries/ARC2/ARC2.php
  17. +0 −485 libraries/ARC2/ARC2_Class.php
  18. +0 −419 libraries/ARC2/ARC2_Reader.php
  19. +0 −117 libraries/ARC2/ARC2_Resource.php
  20. +0 −68 libraries/ARC2/ARC2_getFormat.php
  21. +0 −50 libraries/ARC2/ARC2_getPreferredFormat.php
  22. +0 −80 libraries/ARC2/extractors/ARC2_DcExtractor.php
  23. +0 −284 libraries/ARC2/extractors/ARC2_ErdfExtractor.php
  24. +0 −178 libraries/ARC2/extractors/ARC2_MicroformatsExtractor.php
  25. +0 −62 libraries/ARC2/extractors/ARC2_OpenidExtractor.php
  26. +0 −254 libraries/ARC2/extractors/ARC2_PoshRdfExtractor.php
  27. +0 −237 libraries/ARC2/extractors/ARC2_RDFExtractor.php
  28. +0 −385 libraries/ARC2/extractors/ARC2_RdfaExtractor.php
  29. +0 −45 libraries/ARC2/extractors/ARC2_TwitterProfilePicExtractor.php
  30. +0 −245 libraries/ARC2/parsers/ARC2_AtomParser.php
  31. +0 −267 libraries/ARC2/parsers/ARC2_CBJSONParser.php
  32. +0 −165 libraries/ARC2/parsers/ARC2_JSONParser.php
  33. +0 −311 libraries/ARC2/parsers/ARC2_LegacyXMLParser.php
  34. +0 −139 libraries/ARC2/parsers/ARC2_RDFParser.php
  35. +0 −641 libraries/ARC2/parsers/ARC2_RDFXMLParser.php
  36. +0 −185 libraries/ARC2/parsers/ARC2_RSSParser.php
  37. +0 −63 libraries/ARC2/parsers/ARC2_SGAJSONParser.php
  38. +0 −777 libraries/ARC2/parsers/ARC2_SPARQLParser.php
  39. +0 −210 libraries/ARC2/parsers/ARC2_SPARQLPlusParser.php
  40. +0 −112 libraries/ARC2/parsers/ARC2_SPARQLXMLResultParser.php
  41. +0 −188 libraries/ARC2/parsers/ARC2_SPOGParser.php
  42. +0 −339 libraries/ARC2/parsers/ARC2_SemHTMLParser.php
  43. +0 −882 libraries/ARC2/parsers/ARC2_TurtleParser.php
  44. +0 −111 libraries/ARC2/serializers/ARC2_LegacyHTMLSerializer.php
  45. +0 −53 libraries/ARC2/serializers/ARC2_LegacyJSONSerializer.php
  46. +0 −66 libraries/ARC2/serializers/ARC2_LegacyXMLSerializer.php
  47. +0 −142 libraries/ARC2/serializers/ARC2_MicroRDFSerializer.php
  48. +0 −143 libraries/ARC2/serializers/ARC2_NTriplesSerializer.php
  49. +0 −105 libraries/ARC2/serializers/ARC2_POSHRDFSerializer.php
  50. +0 −88 libraries/ARC2/serializers/ARC2_RDFJSONSerializer.php
  51. +0 −53 libraries/ARC2/serializers/ARC2_RDFSerializer.php
  52. +0 −198 libraries/ARC2/serializers/ARC2_RDFXMLSerializer.php
  53. +0 −30 libraries/ARC2/serializers/ARC2_RSS10Serializer.php
  54. +0 −122 libraries/ARC2/serializers/ARC2_TurtleSerializer.php
  55. +0 −280 libraries/ARC2/sparqlscript/ARC2_SPARQLScriptParser.php
  56. +0 −592 libraries/ARC2/sparqlscript/ARC2_SPARQLScriptProcessor.php
  57. +0 −204 libraries/ARC2/store/ARC2_RemoteStore.php
  58. +0 −670 libraries/ARC2/store/ARC2_Store.php
  59. +0 −53 libraries/ARC2/store/ARC2_StoreAskQueryHandler.php
  60. +0 −32 libraries/ARC2/store/ARC2_StoreAtomLoader.php
  61. +0 −38 libraries/ARC2/store/ARC2_StoreCBJSONLoader.php
  62. +0 −115 libraries/ARC2/store/ARC2_StoreConstructQueryHandler.php
  63. +0 −233 libraries/ARC2/store/ARC2_StoreDeleteQueryHandler.php
  64. +0 −119 libraries/ARC2/store/ARC2_StoreDescribeQueryHandler.php
  65. +0 −37 libraries/ARC2/store/ARC2_StoreDumpQueryHandler.php
  66. +0 −222 libraries/ARC2/store/ARC2_StoreDumper.php
  67. +0 −1,080 libraries/ARC2/store/ARC2_StoreEndpoint.php
  68. +0 −66 libraries/ARC2/store/ARC2_StoreHelper.php
  69. +0 −47 libraries/ARC2/store/ARC2_StoreInsertQueryHandler.php
  70. +0 −459 libraries/ARC2/store/ARC2_StoreLoadQueryHandler.php
  71. +0 −94 libraries/ARC2/store/ARC2_StoreQueryHandler.php
  72. +0 −32 libraries/ARC2/store/ARC2_StoreRDFXMLLoader.php
  73. +0 −32 libraries/ARC2/store/ARC2_StoreRSSLoader.php
  74. +0 −36 libraries/ARC2/store/ARC2_StoreSGAJSONLoader.php
  75. +0 −38 libraries/ARC2/store/ARC2_StoreSPOGLoader.php
  76. +0 −1,824 libraries/ARC2/store/ARC2_StoreSelectQueryHandler.php
  77. +0 −36 libraries/ARC2/store/ARC2_StoreSemHTMLLoader.php
  78. +0 −290 libraries/ARC2/store/ARC2_StoreTableManager.php
  79. +0 −32 libraries/ARC2/store/ARC2_StoreTurtleLoader.php
  80. +0 −1 libraries/Erfurt
  81. +0 −192 libraries/Mimeparse.php
  82. +0 −1 libraries/RDFauthor
  83. +40 −0 phpunit.xml
View
@@ -37,3 +37,5 @@ build/
# vagrant stuff
Vagrantfile
.vagrant
/vendor/
View
@@ -1,6 +1,3 @@
[submodule "libraries/RDFauthor"]
path = libraries/RDFauthor
url = git://github.com/AKSW/RDFauthor.git
[submodule "libraries/Erfurt"]
path = libraries/Erfurt
url = git://github.com/AKSW/Erfurt.git
View
241 Makefile
@@ -1,6 +1,6 @@
ZENDVERSION=1.12.9
ZEND2VERSION=2.2.2
PHPUNIT = ./vendor/bin/phpunit
PHPCS = ./vendor/bin/phpcs
PHPCBF = ./vendor/bin/phpcbf
default:
@echo "Typical targets your could want to reach:"
@echo ""
@@ -19,72 +19,43 @@ default:
help:
@echo "Please use: (e.g. make deploy)"
@echo " deploy ..................... Runs everything which is needed for a deployment"
@echo " install .................... Make directories, zend and libraries"
@echo " install .................... Make directories and libraries"
@echo " help ....................... This help screen"
@echo " help-cs .................... Show help for code sniffing targets"
@echo " help-test .................. Show help for test related targets"
@echo " -------------------------------------------------------------------"
@echo " vagrant .................... Prepare environment to run with Vagrant (no zend)"
@echo " vagrant .................... Prepare environment to run with Vagrant"
@echo " vagrant-clean .............. Removes owdev box in order to ensure you have the latest version"
@echo " directories ................ Create cache/log dir and chmod environment"
@echo " zend ....................... Download and install Zend under libraries"
@echo " libraries .................. Zend, Erfurt and RDFauthor submodules (read-write)"
@echo " erfurt ..................... Clone under libraries"
@echo " rdfauthor .................. Clone under libraries"
@echo " pull ....................... 'git pull' for all repos"
@echo " fetch ...................... 'git fetch' for all repos"
@echo " fetch-all .................. 'git fetch --all', i.e. fetch all repos on all remotes"
@echo " add-upstream ............... Adds standard AKSW git repo as remote/upstream"
@echo " status ..................... 'git status' for all repos"
@echo " branch-check ............... 'git rev-parse' for all repos"
@echo " clean ...................... Deletes all log and cache files"
@echo " install-test-environment ... Install neccessary software (PHPUnit,...))"
@echo " odbctest ................... Executes some tests to check the Virtuoso connection"
help-cs:
@echo "Please use: (e.g. make cs-install)"
@echo " cs-install ............................ Install CodeSniffer"
@echo " cs-uninstall .......................... Uninstall CodeSniffer"
@echo " cs-install-submodule MPATH=<path> ..... Install CodeSniffer on a submodule,"
@echo " <path> must by the relative path to the submodule"
@echo " cs-uninstall-submodule MPATH=<path> ... Uninstall CodeSniffer on a submodule,"
@echo " <path> must by the relative path to the submodule"
@echo " cs-enable ............................. Enable CodeSniffer to check code before every commit"
@echo " cs-disable ............................ Disable CodeSniffer code checking"
@echo " cs-check-commit ....................... Run pre-commit code checking manually"
@echo " cs-check-commit-emacs ................. Same as cs-check-commit with emacs output"
@echo " cs-check-commit-intensive ............. Run pre-commit code checking"
@echo " manually with stricter coding standard"
@echo " cs-check .............................. Run complete code checking"
@echo " cs-check-full ......................... Run complete code checking with detailed output"
@echo " cs-check-emacs ........................ Run complete code checking with with emacs output"
@echo " cs-check-blame ........................ Run complete code checking with blame list output"
@echo " cs-check-intensive .................... Run complete code checking with"
@echo " stricter coding standard"
@echo " cs-check-intensive-full ............... Run complete code checking with"
@echo " stricter coding standard and detailed output"
@echo " possible Parameter:"
@echo " > CHECKPATH=<path> ................. Run code checking on specific relative path"
@echo " > SNIFFS=<sniff 1>,<sniff 2> ... Run code checking on specific sniffs"
@echo " > OPTIONS=<option> ............. Run code checking with specific CodeSniffer options"
@echo "Please use: (e.g. make codesniffer)"
@echo " codesniffer ............................ Run CodeSniffer"
@echo " codebeautifier ......................... Run CodeBeautifier"
help-test:
@echo " test ......................... Execute unit, integration and extension tests"
@echo " test-unit .................... Run OntoWiki unit tests"
@echo " test-unit-cc ................. Same as above plus code coverage report"
@echo " test-integration-virtuoso .... Run OntoWiki integration tests with virtuoso"
@echo " test-integration-virtuoso-cc . Same as above plus code coverage report"
@echo " test-integration-mysql ....... Run OntoWiki integration tests with mysql"
@echo " test-integration-mysql-cc .... Same as above plus code coverage report"
@echo " test-extensions .............. Run tests for extensions"
# top level target
deploy: directories clean zend submodules
getcomposer: #seems that there is no way to constantly get the newest version(install way outdates with new versions)
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === 'fd26ce67e3b237fffd5e5544b45b0d92c41a4afe3e3f778e942e43ce6be197b9cdc7c251dcde6e2a52297ea269370680') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); }"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar self-update
install: deploy
install: directories libraries
deploy: directories clean composer-install
vagrant: directories clean submodules-developer
vagrant: directories clean #add composer install
rm -rf libraries/Zend # vagrant has own zend
rm -f Vagrantfile
!(ls $(PWD)/application/scripts/Vagrantfile > /dev/null 2> /dev/null) || ln -s $(PWD)/application/scripts/Vagrantfile $(PWD)/Vagrantfile
@@ -98,108 +69,31 @@ vagrant-clean:
vagrant box remove owdev
clean:
rm -rf cache/* logs/*
rm -rf cache/* logs/* libraries/*
directories: clean
mkdir -p logs cache
chmod 777 logs cache extensions
libraries: zend submodules-developer
submodules: # read-only
git submodule init
git config submodule.libraries/Erfurt.url "https://github.com/AKSW/Erfurt.git"
git config submodule.libraries/RDFauthor.url "https://github.com/AKSW/RDFauthor.git"
git submodule update
submodules-developer: # read-write
git submodule init
git config submodule.libraries/Erfurt.url "git@github.com:AKSW/Erfurt.git"
git config submodule.libraries/RDFauthor.url "git@github.com:AKSW/RDFauthor.git"
git submodule update
# developer targets
pull:
git pull
git submodule foreach git pull
fetch:
git fetch
git submodule foreach git fetch
fetch-all:
# Remember to add the aprorpriate upstream sources frist
# e.g. by using `make add-upstream`
git fetch --all
git submodule foreach git fetch --all
add-upstream:
git remote add upstream git://github.com/AKSW/OntoWiki.git
info:
@git --no-pager log -1 --oneline --decorate
@git submodule foreach git --no-pager log -1 --oneline --decorate
status:
git status -sb
git submodule foreach git status -sb
branch-check:
@git rev-parse --abbrev-ref HEAD
@git submodule foreach git rev-parse --abbrev-ref HEAD
# libraries
ZENDFILEBASE="ZendFramework-${ZENDVERSION}-minimal"
ZENDURL="https://packages.zendframework.com/releases/ZendFramework-${ZENDVERSION}/${ZENDFILEBASE}.tar.gz"
zend:
rm -rf libraries/Zend
curl -L -# -O ${ZENDURL} || wget ${ZENDURL}
tar xzf ${ZENDFILEBASE}.tar.gz
mv ${ZENDFILEBASE}/library/Zend libraries
rm -rf ${ZENDFILEBASE}.tar.gz ${ZENDFILEBASE}
ZEND2FILEBASE="ZendFramework-minimal-${ZEND2VERSION}"
ZEND2URL="https://packages.zendframework.com/releases/ZendFramework-${ZEND2VERSION}/${ZEND2FILEBASE}.tgz"
zend2:
rm -rf libraries/Zend
curl -L -# -O ${ZEND2URL} || wget ${ZEND2URL}
tar xzf ${ZEND2FILEBASE}.tgz
mv ${ZEND2FILEBASE}/library/Zend libraries
rm -rf ${ZEND2FILEBASE}.tgz ${ZEND2FILEBASE}
rdfauthor:
rm -rf libraries/RDFauthor
@echo 'Cloning RDFauthor into libraries/RDFauthor ...'
git clone git@github.com:AKSW/RDFauthor.git libraries/RDFauthor
composer-install: #add difference for user and dev (with phpunit etc and without)
php composer.phar install
# test stuff
test-directories:
rm -rf application/tests/cache application/tests/unit/cache application/tests/integration/cache
mkdir -p application/tests/cache application/tests/unit/cache application/tests/integration/cache
test-unit: test-directories
@cd application/tests && phpunit --bootstrap Bootstrap.php unit/
test-unit-cc: test-directories
@cd application/tests/unit && phpunit
$(PHPUNIT) --testsuite "OntoWiki Unit Tests"
test-integration-virtuoso: test-directories
@cd application/tests && EF_STORE_ADAPTER=virtuoso phpunit --bootstrap Bootstrap.php integration/
test-integration-virtuoso-cc: test-directories
@cd application/tests/integration && EF_STORE_ADAPTER=virtuoso phpunit
EF_STORE_ADAPTER=virtuoso $(PHPUNIT) --testsuite "OntoWiki Virtuoso Integration Tests"
test-integration-mysql: test-directories
@cd application/tests && EF_STORE_ADAPTER=zenddb phpunit --bootstrap Bootstrap.php integration/
EF_STORE_ADAPTER=zenddb $(PHPUNIT) --testsuite "OntoWiki Virtuoso Integration Tests"
test-integration-mysql-cc: test-directories
@cd application/tests/integration && EF_STORE_ADAPTER=zenddb phpunit
test-extensions: directories
@phpunit --bootstrap application/tests/BootstrapExtensions.php extensions
test-extensions: #directories
$(PHPUNIT) --testsuite "OntoWiki Extensions Tests"
test:
make test-unit
@@ -217,20 +111,6 @@ test:
make test-extensions
install-test-environment:
sudo apt-get install php-pear
sudo pear config-set auto_discover 1
sudo pear channel-update pear.php.net
sudo pear upgrade pear
sudo pear install -a pear.phpunit.de/PHPUnit
sudo pear install phpunit/PHPUnit_Selenium
sudo pear install phpunit/DbUnit
erfurt@:
rm -rf libraries/Erfurt
@echo 'Cloning Erfurt into libraries/Erfurt ...'
git clone git@github.com:AKSW/Erfurt.git libraries/Erfurt
odbctest:
@application/scripts/odbctest.php
@@ -248,72 +128,19 @@ debianize:
# coding standard
STANDARD =application/tests/CodeSniffer/Standards/Ontowiki/ruleset.xml
# #### config ####
# cs-script path
CSSPATH = application/tests/CodeSniffer/
# ignore pattern
IGNOREPATTERN = libraries,extensions/exconf/pclzip.lib.php,extensions/exconf/Archive.php,application/scripts,extensions/markdown/parser/markdown.php,extensions/queries/lib,extensions/queries/old
# Parameter check
ifndef CHECKPATH
CHECKPATH = "./"
endif
ifdef SNIFFS
SNIFFSTR = "--sniffs="$(SNIFFS)
else
SNIFFSTR =
endif
REQUESTSTR = --ignore=$(IGNOREPATTERN) $(OPTIONS) $(SNIFFSTR) $(CHECKPATH)
cs-default:
chmod ugo+x "$(CSSPATH)cs-scripts.sh"
cs-install: cs-default
$(CSSPATH)cs-scripts.sh -i
cs-install-submodule: cs-submodule-check cs-default
$(CSSPATH)cs-scripts.sh -f $(CSSPATH) -m $(MPATH)
cs-uninstall-submodule: cs-submodule-check cs-default
$(CSSPATH)cs-scripts.sh -n $(MPATH)
cs-uninstall: cs-default
$(CSSPATH)cs-scripts.sh -u
cs-enable: cs-default
$(CSSPATH)cs-scripts.sh -f $(CSSPATH) -e
cs-disable: cs-default
$(CSSPATH)cs-scripts.sh -d
# ignore pattern
IGNOREPATTERN =libraries,extensions/exconf/pclzip.lib.php,extensions/exconf/Archive.php,application/scripts,extensions/markdown/parser/markdown.php,vendor
cs-check-commit:
$(CSSPATH)cs-scripts.sh -p ""
cs-check-commit-emacs:
$(CSSPATH)cs-scripts.sh -p "-remacs"
cs-check-commit-intensive:
$(CSSPATH)cs-scripts.sh -p "-s"
REQUESTSTR =-p --standard=$(STANDARD) --ignore=$(IGNOREPATTERN) --extensions=php */
cs-check:
@$(CSSPATH)cs-scripts.sh -c "-s --report=summary $(REQUESTSTR)"
cs-check-intensive:
@$(CSSPATH)cs-scripts.sh -s -c "-s --report=summary $(REQUESTSTR)"
cs-check-intensive-full:
@$(CSSPATH)cs-scripts.sh -s -c "-s --report=full $(REQUESTSTR)"
cs-check-full:
@$(CSSPATH)cs-scripts.sh -c "-s --report=full $(REQUESTSTR)"
cs-check-emacs:
@$(CSSPATH)cs-scripts.sh -c "--report=emacs $(REQUESTSTR)"
cs-check-blame:
@$(CSSPATH)cs-scripts.sh -c "--report=gitblame $(REQUESTSTR)"
codesniffer:
$(PHPCS) $(REQUESTSTR)
cs-submodule-check:
ifndef MPATH
@echo "You must Set a path to the submodule."
@echo "Example: MPATH=path/to/the/submodule/"
@exit 1
endif
codebeautifier:
$(PHPCBF) $(REQUESTSTR)
# other stuff
@@ -314,15 +314,14 @@ public static function getUriLocalPart($uri)
* @return string
*/
public static function matchMimetypeFromRequest(
Zend_Controller_Request_Abstract $request,
Zend_Controller_Request_Http $request,
array $supportedMimetypes
) {
// get accept header
$acceptHeader = strtolower($request->getHeader('Accept'));
require_once 'Mimeparse.php';
try {
$match = @Mimeparse::best_match($supportedMimetypes, $acceptHeader);
$match = \Bitworking\Mimeparse::bestMatch($supportedMimetypes, $acceptHeader);
} catch (Exception $e) {
$match = '';
}
@@ -437,4 +436,3 @@ static public function to_stdclass_recursive($o)
return $ret;
}
}
@@ -42,29 +42,12 @@
// path to OntoWiki
define('_OWROOT', ONTOWIKI_ROOT);
// add libraries to include path
$includePath = get_include_path() . PATH_SEPARATOR;
$includePath .= _TESTROOT . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'application/classes/' . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'libraries/' . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'libraries/Erfurt/library' . PATH_SEPARATOR;
$includePath .= ONTOWIKI_ROOT . 'libraries/Erfurt/tests/unit' . PATH_SEPARATOR; // for test base class
set_include_path($includePath);
require_once(ONTOWIKI_ROOT . '/vendor/autoload.php');
// start dummy session before any PHPUnit output
require_once 'Zend/Session/Namespace.php';
$session = new Zend_Session_Namespace('OntoWiki_Test');
// Zend_Loader for class autoloading
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->registerNamespace('OntoWiki_');
$loader->registerNamespace('Erfurt_');
//$loader->registerNamespace('PHPUnit_');
// Access Erfurt app for constant loading etc.
Erfurt_App::getInstance(false);
/** OntoWiki */
require_once 'OntoWiki.php';
Oops, something went wrong.

0 comments on commit e03c073

Please sign in to comment.