Skip to content

Commit

Permalink
Introduce usage of composer! (also fixed failed tests)
Browse files Browse the repository at this point in the history
  • Loading branch information
stloyd committed Jun 19, 2012
1 parent a8f3f68 commit 2467212
Show file tree
Hide file tree
Showing 16 changed files with 535 additions and 442 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
/vendor/*
/app/config/parameters.yml
/app/config/parameters.*.yml
composer.phar
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ php:

before_script:
- cp app/config/parameters.yml.test app/config/parameters.yml
- php bin/vendors install
- curl -s http://getcomposer.org/installer | php
- php composer.phar --dev install
- ./bin/prepare-test-env.sh
- ./bin/prepare-test-solr.sh

Expand Down
9 changes: 3 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ to change the name due to [trademark issues](http://knplabs.com/blog/symfony2bun
### Configure

To configure your database in your development environment, copy
`/app/config/parameters.yml.dist` to `/app/config/parameters.yml` and
`/app/config/parameters.yml.dist` to `/app/config/parameters.yml` and
edit it according to your database settings.

If you want to use github connect locally, you'll need to
Expand All @@ -32,7 +32,8 @@ And update the parameters.yml with the Client ID and Secret.

### Install vendors

php bin/vendors install
curl -s http://getcomposer.org/installer | php
php composer.phar install

#### Create database and tables

Expand All @@ -49,10 +50,6 @@ And update the parameters.yml with the Client ID and Secret.
php app/console doctrine:fixtures:load
php app/console --env=test doctrine:fixtures:load

### Publish the assets

php app/console assets:install --symlink web

### Run the tests (requires PHPUnit >= 3.5)

phpunit -c app
Expand Down
77 changes: 24 additions & 53 deletions app/autoload.php
Original file line number Diff line number Diff line change
@@ -1,57 +1,28 @@
<?php

use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
'Knp\Bundle\KnpBundlesBundle' => __DIR__.'/../src',
'Knp\Bundle\SitemapBundle' => __DIR__.'/../src',
'Knp\Bundle' => __DIR__.'/../vendor/bundles',
'Knp\Menu' => __DIR__.'/../vendor/knp-menu/src',
'Knp\Component' => __DIR__.'/../vendor/knp-components/src',
'Ornicar\GravatarBundle' => __DIR__.'/../vendor/bundles',
'Doctrine\Bundle' => __DIR__.'/../vendor/bundles',
'Doctrine\DBAL\Migrations' => __DIR__.'/../vendor/doctrine-migrations/lib',
'Doctrine\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\Common\DataFixtures' => __DIR__.'/../vendor/doctrine-data-fixtures/lib',
'Doctrine\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
'JMS' => __DIR__.'/../vendor/bundles',
'Monolog' => __DIR__.'/../vendor/monolog/src',
'Goutte' => __DIR__.'/../vendor/goutte/src',
'Zend' => __DIR__.'/../vendor/zf/library',
'Etcpasswd' => __DIR__.'/../vendor/bundles',
'Buzz' => __DIR__.'/../vendor/buzz/lib',
'Inori' => __DIR__.'/../vendor/bundles',
'Behat\Gherkin' => __DIR__.'/../vendor/behat/gherkin/src',
'Behat\Behat' => __DIR__.'/../vendor/behat/behat/src',
'Behat\BehatBundle' => __DIR__.'/../vendor/bundles',
'Behat\Mink' => __DIR__.'/../vendor/behat/mink/src',
'Behat\MinkBundle' => __DIR__.'/../vendor/bundles',
'Behat\CommonContext' => __DIR__.'/../vendor/behat/CommonContexts',
'OldSound' => __DIR__.'/../vendor/bundles',
'PhpAmqpLib' => __DIR__.'/../vendor/videlalvaro/php-amqplib',
'Imagine' => __DIR__.'/../vendor/imagine/lib',
'Igorw' => __DIR__.'/../vendor/bundles',
'Nelmio' => __DIR__.'/../vendor/bundles',
'Github' => __DIR__.'/../vendor/php-github-api/lib',
));
if (!$loader = include __DIR__.'/../vendor/autoload.php') {
$nl = PHP_SAPI === 'cli' ? PHP_EOL : '<br />';
echo "$nl$nl";
if (is_writable(dirname(__DIR__)) && $installer = @file_get_contents('http://getcomposer.org/installer')) {
echo 'You must set up the project dependencies.'.$nl;
$installerPath = dirname(__DIR__).'/install-composer.php';
file_put_contents($installerPath, $installer);
echo 'The composer installer has been downloaded in '.$installerPath.$nl;
die('Run the following commands in '.dirname(__DIR__).':'.$nl.$nl.
'php install-composer.php'.$nl.
'php composer.phar install'.$nl);
}
die('You must set up the project dependencies.'.$nl.
'Run the following commands in '.dirname(__DIR__).':'.$nl.$nl.
'curl -s http://getcomposer.org/installer | php'.$nl.
'php composer.phar install'.$nl);
}

$loader->registerPrefixes(array(
'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
'Twig_' => __DIR__.'/../vendor/twig/lib',
'PHPGit_' => __DIR__.'/../vendor/php-git-repo/lib',
'Solarium_' => __DIR__.'/../vendor/solarium/library',
));
$loader->register();
use Doctrine\Common\Annotations\AnnotationRegistry;

// Registering the annotations
AnnotationRegistry::registerLoader(function($class) use ($loader) {
$loader->loadClass($class);
return class_exists($class, false);
});
AnnotationRegistry::registerFile(
__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
4 changes: 0 additions & 4 deletions app/bootstrap.php

This file was deleted.

4 changes: 2 additions & 2 deletions app/config/parameters.yml.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:

knp_bundles.github.client_id: b46912af13ee7cb7ecd3
knp_bundles.github.client_secret: 116f5427707fcc2a3f7c630dd356be61500b2e18

knp_bundles.twitter.consumer_key: your_twitter_consumer_key_here
knp_bundles.twitter.consumer_secret: your_twitter_consumer_secret_here
knp_bundles.twitter.oauth_token: your_twitter_oauth_token_here
Expand All @@ -35,4 +35,4 @@ parameters:
text: "Hello|[World]"
url: "http://knpbundles.com"

knp_bundles.finder.limit: 2000
knp_bundles.finder.limit: 2000
2 changes: 1 addition & 1 deletion app/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

require_once __DIR__.'/bootstrap.php';
require_once __DIR__.'/bootstrap.php.cache';
require_once __DIR__.'/AppKernel.php';

use Symfony\Bundle\FrameworkBundle\Console\Application;
Expand Down
2 changes: 1 addition & 1 deletion app/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="bootstrap.php"
bootstrap="bootstrap.php.cache"
>
<testsuites>
<testsuite name="Project Test Suite">
Expand Down
133 changes: 0 additions & 133 deletions bin/vendors

This file was deleted.

Loading

0 comments on commit 2467212

Please sign in to comment.