diff --git a/.travis.yml b/.travis.yml index 326257944c..df68fef0da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ services: - redis before_script: - - rm -f config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old - node --version - npm --version - npm install bower-canary mocha-phantomjs@">=2.0 <3.0" recess@">=1.1.0 <1.1.7" uglify-js -g @@ -20,6 +19,7 @@ before_script: - echo 'extension="memcached.so"' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/memcached.ini - composer self-update - composer install --dev --prefer-source + - bin/developer system:uninstall - wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz - tar xzf sphinx-2.0.6-release.tar.gz - sh -c "cd sphinx-2.0.6-release && wget http://snowball.tartarus.org/dist/libstemmer_c.tgz && tar xzf libstemmer_c.tgz && ./configure --with-libstemmer --with-iconv --with-mysql --enable-id64 --quiet && make -j --quiet && sudo make install" diff --git a/bin/developer b/bin/developer index 38275b527c..c2fe0c8cbe 100755 --- a/bin/developer +++ b/bin/developer @@ -20,6 +20,7 @@ use Alchemy\Phrasea\Command\Developer\InstallAll; use Alchemy\Phrasea\Command\Developer\JavascriptBuilder; use Alchemy\Phrasea\Command\Developer\RegenerateSqliteDb; use Alchemy\Phrasea\Command\Developer\RoutesDumper; +use Alchemy\Phrasea\Command\Developer\Uninstaller; use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper; use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper; @@ -77,6 +78,7 @@ $cli->command(new RoutesDumper()); $cli->command(new Behat()); $cli->command(new LessCompiler()); $cli->command(new JavascriptBuilder()); +$cli->command(new Uninstaller()); $cli->command(new \module_console_systemTemplateGenerator('system:generate-templates')); $cli['console']->addCommands(array( diff --git a/build-env.sh b/build-env.sh index f62912c8fb..7cb2c77d19 100755 --- a/build-env.sh +++ b/build-env.sh @@ -1,7 +1,8 @@ -rm -f config/configuration.yml config/services.yml config/connexions.yml config/config.yml config/config.inc config/connexion.inc config/_GV.php config/_GV.php.old || exit 1 +composer install --dev +./bin/developer dependencies:all || exit 1 +./bin/developer system:uninstall || exit 1 cp -f hudson/connexion.inc config/ || exit 1 cp -f hudson/_GV.php config/ || exit 1 -./bin/developer dependencies:all || exit 1 sudo mysql -e 'drop database ab_test;drop database db_test; drop database ab_unitTests; drop database db_unitTests;' || exit 1 sudo mysql -e 'create database ab_test;create database db_test; create database ab_unitTests; create database db_unitTests;' || exit 1 sudo mysql -e "GRANT ALL PRIVILEGES ON ab_unitTests.* TO 'phraseaUnitTests'@'localhost' IDENTIFIED BY 'iWvGxPE8' WITH GRANT OPTION" || exit 1 diff --git a/lib/Alchemy/Phrasea/Command/Developer/Uninstaller.php b/lib/Alchemy/Phrasea/Command/Developer/Uninstaller.php new file mode 100644 index 0000000000..47e9fdab94 --- /dev/null +++ b/lib/Alchemy/Phrasea/Command/Developer/Uninstaller.php @@ -0,0 +1,71 @@ +setDescription('Uninstall Phraseanet'); + } + + /** + * {@inheritdoc} + */ + protected function doExecute(InputInterface $input, OutputInterface $output) + { + $root = $this->container['root.path']; + + foreach (array( + $root.'/tmp/configuration-compiled.php', + $root.'/config/configuration.yml', + $root.'/config/services.yml', + $root.'/config/connexions.yml', + $root.'/config/config.yml', + $root.'/config/config.inc', + $root.'/config/connexion.inc', + $root.'/config/_GV.php', + $root.'/config/_GV.php.old', + $root.'/tmp/cache_registry.php', + $root.'/tmp/cache_registry.yml', + ) as $file) { + if (is_file($file)) { + unlink($file); + } + } + + foreach (array( + $root.'/tmp/serializer', + $root.'/tmp/cache_twig', + $root.'/tmp/cache_minify', + $root.'/tmp/download', + $root.'/tmp/locks', + $root.'/tmp/cache', + ) as $dir) { + if (is_dir($dir)) { + $finder = new Finder(); + foreach ($finder->files()->in($dir) as $file) { + unlink($file); + } + } + } + + return 0; + } +}