Bladeren bron

Merge pull request #1017 from jackbentley/feature/dev-setup

Improve steps for setup of a dev environment
Jordi Boggiano 5 jaren geleden
bovenliggende
commit
346a1965af
4 gewijzigde bestanden met toevoegingen van 90 en 22 verwijderingen
  1. 33 14
      README.md
  2. 13 6
      composer.json
  3. 43 1
      composer.lock
  4. 1 1
      src/Packagist/WebBundle/Resources/views/macros.html.twig

+ 33 - 14
README.md

@@ -3,25 +3,44 @@ Packagist
 
 Package Repository Website for Composer, see the [about page](https://packagist.org/about) on [packagist.org](https://packagist.org/) for more.
 
-**This project is not meant for re-use.** It is open source to make it easy to contribute but we provide no support if you want to run your own, and will do breaking changes without notice. Check out [Private Packagist](https://packagist.com/) if you want to host your own packages.
+**This project is not meant for re-use.**
 
-Requirements
-------------
+It is open source to make it easy to contribute. We provide no support if you want to run your own, and will do breaking changes without notice.
 
-- MySQL for the main data store
-- Redis for some functionality (favorites, download statistics)
-- git/svn/hg depending on which repositories you want to support
+Check out [Private Packagist](https://packagist.com/) if you want to host your own packages.
 
-Installation
+Development
 ------------
 
+These steps are provided for development purposes only.
+
+### Requirements
+
+- **PHP** for the web app
+- **[Symfony CLI](https://symfony.com/download)** to run the web server
+- **MySQL** for the main data store
+- **Redis** for some functionality (favorites, download statistics)
+- **git / svn / hg** depending on which repositories you want to support
+
+### Installation
+
 1. Clone the repository
-2. Edit `app/config/parameters.yml` and change the relevant values for your setup.
-3. Install dependencies: `php composer.phar install`
-4. Run `app/console doctrine:schema:create` to setup the DB
-5. Run `app/console assets:install web` to deploy the assets on the web dir.
-6. Run `app/console cache:warmup --env=prod` and `app/console cache:warmup --env=prod` to warmup cache
-7. Make a VirtualHost with DocumentRoot pointing to web/
-8. Run a CRON job `app/console packagist:run-workers`
+2. Create 2 databases:
+    - `packagist` - for the web app
+    - `packagist_test` - for running the tests
+3. Install dependencies:
+   ```bash
+   composer install
+   ```
+   The composer install will prompt you for the database connection details on first install.
+4. Setup the database:
+   ```bash
+   app/console doctrine:schema:create
+   ```
+5. Start the web server:
+   ```bash
+   symfony serve
+   ```
+6. Run a CRON job `app/console packagist:run-workers` to make sure packages update.
 
 You should now be able to access the site, create a user, etc.

+ 13 - 6
composer.json

@@ -57,27 +57,34 @@
         "php-http/httplug-bundle": "^1.11",
         "php-http/guzzle6-adapter": "^1.1",
         "zendframework/zenddiagnostics": "^1.4",
-        "graze/dog-statsd": "^0.4.2"
+        "graze/dog-statsd": "^0.4.2",
+        "incenteev/composer-parameter-handler": "^2.1"
     },
     "require-dev": {
         "symfony/phpunit-bridge": "^4.2",
         "phpunit/phpunit": "^8.0"
     },
     "scripts": {
-        "post-install-cmd": [
+        "symfony-scripts": [
+            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
             "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
         ],
+        "post-install-cmd": [
+            "@symfony-scripts"
+        ],
         "post-update-cmd": [
-            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
-            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
-            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets"
+            "@symfony-scripts"
         ]
     },
     "extra": {
         "symfony-app-dir": "app",
-        "symfony-web-dir": "web"
+        "symfony-web-dir": "web",
+        "symfony-assets-install": "relative",
+        "incenteev-parameters": {
+            "file": "app/config/parameters.yml"
+        }
     },
     "config": {
         "platform": {

+ 43 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "bb9e56d2f9c92be63842385864ff2290",
+    "content-hash": "e91f865b54abffebaf1fa3d1af9fff46",
     "packages": [
         {
             "name": "algolia/algoliasearch-client-php",
@@ -1937,6 +1937,48 @@
             ],
             "time": "2018-07-31T10:19:28+00:00"
         },
+        {
+            "name": "incenteev/composer-parameter-handler",
+            "version": "v2.1.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Incenteev/ParameterHandler.git",
+                "reference": "933c45a34814f27f2345c11c37d46b3ca7303550"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/933c45a34814f27f2345c11c37d46b3ca7303550",
+                "reference": "933c45a34814f27f2345c11c37d46b3ca7303550",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "symfony/yaml": "^2.3 || ^3.0 || ^4.0"
+            },
+            "require-dev": {
+                "composer/composer": "^1.0@dev",
+                "symfony/filesystem": "^2.3 || ^3 || ^4",
+                "symfony/phpunit-bridge": "^4.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Incenteev\\ParameterHandler\\": ""
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "Composer script handling your ignored parameter file",
+            "homepage": "https://github.com/Incenteev/ParameterHandler",
+            "time": "2018-02-13T18:05:56+00:00"
+        },
         {
             "name": "jdorn/sql-formatter",
             "version": "v1.2.17",

+ 1 - 1
src/Packagist/WebBundle/Resources/views/macros.html.twig

@@ -1,6 +1,6 @@
 {% macro listPackages(packages, paginate, showAutoUpdateWarning, meta) %}
     <ul class="packages list-unstyled">
-        {% for package in packages if package.replacementPackage|default('') != 'spam/spam' %}
+        {% for package in packages|filter(package => package.replacementPackage|default('') != 'spam/spam') %}
             {% if package.id is numeric %}
                 {% set packageUrl = path('view_package', { 'name' : package.name }) %}
             {% else %}