An open API service indexing awesome lists of open source software.

https://github.com/vovayatsyuk/codemorph

Script that generates multiple versions on one file according to replacement rules inside of it
https://github.com/vovayatsyuk/codemorph

Last synced: 7 months ago
JSON representation

Script that generates multiple versions on one file according to replacement rules inside of it

Awesome Lists containing this project

README

          

CodeMorph
=========

Script that generates multiple versions on one file according to replacement rules inside of it.

### How to use
1. Prepare morph rules in source files
```php
...
// {{morph}}
// {{demo}}:{{'lifetime' => 3600}}
// {{trial}}:{{'lifetime' => $this->getTrialLifetime()}}
'lifetime' => $this->getLifetime()
// {{morph}}
...
```

```xml
...

Full Version

...
```

2. Run the command:
```
php -f path/to/morph.php "/source/folder" "/destination/folder" demo,trial
```

### Morph rules
1. Code to morph, should be wrapped into {{morph}} placeholders:
```
{{morph}}
original code
{{morph}}
```

2. Specify replacement rules
```
{{morph}}
{{demo}}:{{demo code}}
{{trial}}:{{
trial code
}}
original code
{{morph}}
```

3. Supported comments around the morph rules: #, /*, //,