diff --git a/.travis.yml b/.travis.yml index 19553f1260..bf3a3b6140 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 @@ -21,6 +20,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 0e7eb83699..fce55e724a 100755 --- a/bin/developer +++ b/bin/developer @@ -19,6 +19,7 @@ use Alchemy\Phrasea\Command\Developer\InstallAll; use Alchemy\Phrasea\Command\Developer\LessCompiler; 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; @@ -75,6 +76,7 @@ $cli->command(new APIRoutesDumper()); $cli->command(new RoutesDumper()); $cli->command(new Behat()); $cli->command(new LessCompiler()); +$cli->command(new Uninstaller()); $cli->command(new \module_console_systemTemplateGenerator('system:generate-templates')); diff --git a/build-env.sh b/build-env.sh index 2c35800732..023caa380a 100755 --- a/build-env.sh +++ b/build-env.sh @@ -1,4 +1,6 @@ -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 npm install -g uglify-js recess grunt-cli jake 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; + } +}