Skip to content

Commit

Permalink
Merge pull request #144 from palantirnet/rector-0.10-minimal-changes
Browse files Browse the repository at this point in the history
Rector 0.10 with minimal changes.
  • Loading branch information
agentrickard authored Jun 7, 2021
2 parents 3f088dc + 0e3acf5 commit a2a0a38
Show file tree
Hide file tree
Showing 92 changed files with 792 additions and 638 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/functional_test__rector_examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: functional_test__rector_examples

# This test will run on every pull request, and on every commit on any branch
on: [push, pull_request]

jobs:
run_functional_test:
name: Run functional test
# START: SHARED SETUP
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: 7.3
coverage: none # disable xdebug, pcov
tools: composer:v2
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv
# Uncomment to enable SSH access to Github Actions - https://github.com/marketplace/actions/debugging-with-tmate#getting-started
# - name: Debugging with tmate
# uses: mxschmitt/action-tmate@v2
# END: SHARED SETUP
# START: SHARED DRUPAL INSTALL SETUP
- name: Setup Drupal
run: |
COMPOSER_MEMORY_LIMIT=-1 composer create-project drupal/recommended-project:~8 ../drupal --no-interaction
cd ..
mv drupal/* .
composer config minimum-stability dev
composer config prefer-stable true
composer config preferred-install dist
composer config repositories.drupal composer https://packages.drupal.org/8
COMPOSER_MEMORY_LIMIT=-1 composer require drupal/core-dev:~8 --with-all-dependencies
# We add a local repository `repositories.0` which takes precendence over the packagist repository that is automatically added.
- name: Install Drupal Rector
run: |
cd ..
composer config repositories.drupal-rector "{\"type\": \"path\", \"url\": \"$GITHUB_WORKSPACE\", \"options\": {\"symlink\": false}}"
composer require palantirnet/drupal-rector:@dev --no-progress
- name: Install Drupal Rector Config
run: |
cd ..
cp vendor/palantirnet/drupal-rector/rector.php .
# END: SHARED DRUPAL INSTALL SETUP
- name: Install PHPUnit in the Drupal site since it is required for some of the rules
run: |
cd ..
composer require phpunit/phpunit:~7.5 --no-progress
- name: Prepare rector_examples folder in the drupal modules directory
run: |
cd ..
mkdir -p web/modules/custom
cp -R vendor/palantirnet/drupal-rector/rector_examples web/modules/custom
- name: Install local dependencies, including Behat.
run: composer install
- name: Run Behat tests
run: vendor/bin/behat
59 changes: 0 additions & 59 deletions .github/workflows/local_package_functional_tests.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/local_package_run_rector.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/packagist_package_run_rector.yml

This file was deleted.

32 changes: 6 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ Automate fixing deprecated Drupal code.

## Status

![local_package_functional_tests](https://github.com/palantirnet/drupal-rector/workflows/local_package_functional_tests/badge.svg)
![local_package_run_rector](https://github.com/palantirnet/drupal-rector/workflows/local_package_run_rector/badge.svg)
![packagist_package_run_rector](https://github.com/palantirnet/drupal-rector/workflows/packagist_package_run_rector/badge.svg)
![Functional test: Rector examples](https://github.com/palantirnet/drupal-rector/workflows/functional_test__rector_examples/badge.svg)

## Introduction

Expand Down Expand Up @@ -58,34 +56,16 @@ $ composer require --dev palantirnet/drupal-rector

### Create a configuration file in your project

You will need to have a `rector.yml` configuration in the root of your repository. This should sit beside your document root such as `web` or `docroot`.
You will need to have a `rector.php` configuration in the root of your repository. This should sit beside your document root such as `web` or `docroot`.

This project provides starting files that should handle most use cases.
This project uses [`webflo/drupal-finder`](https://packagist.org/packages/webflo/drupal-finder) to find your document root that contains Drupal.

If your document root directory is `web`, you can copy the `rector-config-web-dir.yml`
To get started, copy the `rector.php` configuration file provided by this package:

```bash
cp vendor/palantirnet/drupal-rector/rector-config-web-dir.yml rector.yml
cp vendor/palantirnet/drupal-rector/rector.php .
```

If your document root directory is `docroot`, you can copy the `rector-config-docroot-dir.yml`

```bash
cp vendor/palantirnet/drupal-rector/rector-config-docroot-dir.yml rector.yml
```

If your document root directory is something else you will need to manually copy and edit `rector.yml`.

Replace the `web` in these paths with your document root.

```
parameters:
autoload_paths:
- 'web/core'
- 'web/core/modules'
- 'web/modules'
- 'web/profiles'
```

## Suggested workflow

Expand Down Expand Up @@ -140,7 +120,7 @@ If you are having these issues try running Rector from the environment that has

### Iconv error when running Rector in Alpine Docker

If you are getting errors like
If you are getting errors like

`iconv(): Wrong charset, conversion from UTF-8 to ASCII//TRANSLIT//IGNORE is not allowed`

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"ast"
],
"require": {
"rector/rector-prefixed": "0.7.29"
"rector/rector-prefixed": "~0.10.0",
"webflo/drupal-finder": "^1.2"
},
"license": "MIT",
"authors": [
Expand Down Expand Up @@ -45,6 +46,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"behat/behat": "^3.6"
"behat/behat": "^3.6",
"symfony/yaml": "^5"
}
}
16 changes: 16 additions & 0 deletions config/drupal-8/drupal-8-all-deprecations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/drupal-8.*');

$parameters = $containerConfigurator->parameters();

$parameters->set(Option::BOOTSTRAP_FILES, [
__DIR__ . '/../drupal-phpunit-bootstrap-file.php'
]);
};
16 changes: 0 additions & 16 deletions config/drupal-8/drupal-8-all-deprecations.yml

This file was deleted.

Loading

0 comments on commit a2a0a38

Please sign in to comment.