Commit 08cac1fe authored by Andrei Ivnitskii's avatar Andrei Ivnitskii
Browse files

Issue #3305067 by ivnish: Update readme

parent 89b379c3
Loading
Loading
Loading
Loading
+5 −168
Original line number Diff line number Diff line
@@ -12,177 +12,14 @@ Alternatively it takes a path to a module/theme project and checks that.
The output is suitable for a comment in the Project Applications issue queue.


REQUIREMENTS
------------

### Local installation (recommended)

The local installation is running the script and its dependencies within
the current user's scope. It can be installed using `composer`:

  * A Bash shell environment (tested on Ubuntu, should also work on Macs)
  * Git
  * [Composer](https://getcomposer.org/download)
  * [Node.js 4.x+](https://nodejs.org/en/download) including `npm` 2+; we
    recommend using a Node Version Manager as
    [NVS](https://github.com/jasongin/nvs)
  * [Python 2.7+](https://www.python.org/downloads) including `pip`


### Global installation (deprecated)

The global installation needs you to install all required packages and
their dependencies manually in a global scope:

  * A Bash shell environment (tested on Ubuntu, should also work on Macs)
  * Git
  * [Composer](https://getcomposer.org/download)
  * [Node.js 4.x+](https://nodejs.org/en/download) including `npm` 2+
  * [Python 2.7+](https://www.python.org/downloads)
  * Coder 8.x-2.x
  * PHP_CodeSniffer
  * DrupalSecure
  * Codespell
  * ESLint


INSTALLATION
------------

### Local installation (recommended)

The local installation will run PAREview.sh within the scope of the
current user. Together with a Node Version Manager as
[NVS](https://github.com/jasongin/nvs), it allows to use PAReview.sh
without elevated user rights:

  * Make sure you have `git`, `composer`, `npm` and `pip` installed,
    so they are available to the current user.
  * Download PAReview.sh and extract it to a location outside of any
    Drupal root. You can also use git to checkout the latest version:
    ```
    cd ~
    git clone --branch 7.x-1.x http://git.drupal.org/project/pareviewsh.git
    cd pareviewsh
    ```
  * Install the dependencies using composer:
    ```
    composer install
    ```


### Installation within a Drupal composer project (experimental)

If you wish, you can also install PAReview.sh along your Drupal 7 project
when it is using `composer` and a Composer installer package as
`composer/installers` for its dependency management.

This way, the `pareview.sh` script will be available at your composer's
`bin` directory.

  * Add the `drupalsecure` package to your `composer.json` repositories
    section. This is necessary, as it is a sandbox project and therefore
    is not available within drupal.org's composer repositories. Assuming
    you also have drupal.org's repository installed, the `repositories`
    section may look like:
    ```
    "repositories": {
      "drupal": {
        "type": "composer",
        "url": "https://packages.drupal.org/7"
      },
      "drupalsecure": {
        "type": "package",
        "package": {
          "name": "drupal/drupalsecure",
          "version": "dev-1.x",
          "type": "phpcodesniffer-standard",
          "source": {
            "url": "https://git.drupal.org/sandbox/coltrane/1921926.git",
            "type": "git",
            "reference": "master"
          },
          "extra": {
            "branch-alias": {
              "1.x-dev": "master",
              "dev-1.x": "master"
            }
          }
        }
      }
    },
    ```
  * Add PAReview.sh to the required packages:
    ```
    composer require drupal/pareviewsh
    ```
  * If you are using `git` for versioning your Drupal 7 source code, you may
    also wish to add the PAReview.sh configuration file to `.gitignore`.
    This file provides the PAReview.sh script with environment information
    and will be (re-)created on every `composer install` and
    `composer update` run:
    ```
    /pareview.config
    ```


### Global installation (deprecated)

The global installation requires to install PHP CodeSniffer, Codespell and
ESLint in a global scope or within your user's environment binary paths, so
that the PAReview.sh script can find them by just calling `phpcs`, `codespell`
or `eslint` as you would do on your command line.

You can check, whether the commands are available by using
`command -v <commandname>`.

The following example will install PAReview.sh and its dependencies
in your user's `workspace` directory. You may change the destination to your
liking:

  * Make sure you have `git`, `composer`, `npm` and `pip` installed,
    so they are available to the current user.
  * Download PAReview.sh and extract it to a location outside of any
    Drupal root. You can also use git to checkout the latest version:
    ```
    mkdir -p ~/workspace
    cd ~/workspace
    git clone --branch 7.x-1.x http://git.drupal.org/project/pareviewsh.git
    ```
  * Get Coder coding standards:
    ```
    git clone --branch 8.x-2.x http://git.drupal.org/project/coder.git
    ```
  * Get drupalsecure coding standards:
    ```
    git clone --branch master http://git.drupal.org/sandbox/coltrane/1921926.git drupalsecure
    ```
  * Install PHP CodeSniffer (optional; required only, if you don't have it
    installed yet):
    ```
    cd coder
    composer install
    cd ..
    sudo ln -s "$(pwd)/coder/vendor/bin/phpcs" /usr/local/bin
    ```
  * Register coding standards with your `phpcs`:
    ```
    phpcs --config-set installed_paths "$(pwd)/coder/coder_sniffer,$(pwd)/drupalsecure"
    ```
  * Install ESLint:
    ```
    sudo npm i -g eslint
    ```
  * Install Codespell:
    ```
    pip install codespell
    ```

For convenience you can also add a link to `pareview.sh` in one of the
executable directories in your `$PATH`, e.g.:
```
sudo ln -s "$(pwd)/pareviewsh/pareview.sh" /usr/local/bin
```
### Tested on Ubuntu 22.04
  *  sudo apt install git python3-pip php8.1-cli php8.1-mbstring php8.1-simplexml php8.1-curl npm
  *  Install composer globally (https://getcomposer.org/download)
  *  Download and extract pareviewsh. Go to pareviewsh folder
  *  Run composer install


CONFIGURATION