2017 © Pedro Peláez
 

library builder

Project builder.

image

deliverist/builder

Project builder.

  • Friday, May 25, 2018
  • by janpecha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Deliverist\Builder

Build Status Downloads this Month Latest Stable Version License, (*1)

Donate, (*2)

Installation

Download a latest package or use Composer:, (*3)

composer require deliverist/builder

Deliverist\Builder requires PHP 8.0 or later., (*4)

Usage

``` php <?php, (*5)

use Deliverist\Builder\Builder; use Deliverist\Builder\Commands; use Deliverist\Builder\Loggers;, (*6)

$builder = new Builder('/path/to/source/code', [ 'composer-install' => new Commands\ComposerInstall, 'rename' => new Commands\Rename, 'remove' => new Commands\Remove, ], new Loggers\TextLogger);, (*7)

$builder->make('composer-install') ->make('rename', ['from' => 'index.php', 'to' => 'www/index.php']) ->make('remove', ['file' => 'composer.lock']) ->make('composer-install');, (*8)



## Commands ### ApacheImports Expands clause `<!--#include file="file.txt" -->` in specified files. ``` php $builder->make('apache-imports', ['file' => 'file-to-expand.txt']); $builder->make('apache-imports', ['files' => [ 'admin.js', 'front.js', ]]);

ComposerInstall

Runs composer install in composer.json directory., (*9)

``` php $builder->make('composer-install'); $builder->make('composer-install', ['composerFile' => 'path/to/composer.json']);, (*10)



### Copy Copies specified files. ``` php $builder->make('copy', ['from' => 'old.txt', 'to' => 'new.txt']); $builder->make('copy', ['files' => [ 'old.txt' => 'new.txt', ]]); $builder->make('copy', ['paths' => [ 'old/dir' => 'new/dir', ]]);

CreateDirectory

Creates specified directories., (*11)

``` php $builder->make('create-directory', ['directory' => 'new-directory']); $builder->make('create-directory', ['directories' => [ 'new-directory', 'new-directory-2', ]]);, (*12)



### CssExpandImports Expands clause `@import 'file.css'` in specified files. ``` php $builder->make('css-expand-imports', ['file' => 'file-to-expand.txt']); $builder->make('css-expand-imports', ['files' => [ 'admin.css', 'front.css', ]]);

GoogleAnalytics

Replaces placeholder with Google Analytics script in file., (*13)

``` php $builder->make('google-analytics', [ 'file' => 'path/to/file.php', 'code' => 'UA-9876-5', 'placeholder' => '%% GA %%', ]); // replaces placeholder '%% GA %%' in file $builder->make('google-analytics', ['file' => 'path/to/file.html', 'code' => 'UA-9876-5']); // uses placeholder '' in file $builder->make('google-analytics', ['file' => 'path/to/file.latte', 'code' => 'UA-9876-5']); // uses placeholder {* GA *} in file, (*14)



### GoogleClosureCompiler Minifies files in online Google Closure Compiler. ``` php $builder->make('google-closure-compiler', ['file' => 'script.js']); $builder->make('google-closure-compiler', ['files' => [ 'script-1.js', 'script-2.js', ]]);

LessCompile

Runs lessc for compiling of LESS files., (*15)

``` php $builder->make('less-compile', ['file' => 'styles.less']); $builder->make('less-compile', ['files' => [ 'style-1.less', 'style-2.less', ]]);, (*16)



### MinifyContent Removes empty lines & whitespaces on start & end of lines. ``` php $builder->make('minify-content', ['file' => 'file.txt']); $builder->make('minify-content', ['files' => [ 'file-1.txt', 'file-2.txt', ]]);

Example:, (*17)

Input:, (*18)

{block content}


Homepage

<p> Lorem ipsum dolor sit amet. </p> {/block}

Output:, (*19)

{block content}
<h1>Homepage</h1>
<p>
Lorem ipsum dolor sit amet.
</p>
{/block}

PingUrl

Opens URL and shows content., (*20)

``` php $builder->make('ping-url', ['url' => 'https://example.com/migrations.php']); $builder->make('ping-url', ['url' => 'https://example.com/migrations.php', 'validateSsl' => FALSE]); // disable SSL validation, (*21)



### Remove Removes file or directory. ``` php $builder->make('remove', ['file' => 'path/to/file.txt']); $builder->make('remove', ['path' => 'path/to/directory']); $builder->make('remove', ['files' => [ 'path/to/file.txt', 'path/to/directory', ]]); $builder->make('remove', ['paths' => [ 'path/to/file.txt', 'path/to/directory', ]]);

Rename

Renames file or directory., (*22)

``` php $builder->make('rename', ['from' => 'old.txt', 'to' => 'new.txt']); $builder->make('rename', ['files' => [ 'old.txt' => 'new.txt', ]]);, (*23)



### ReplaceContent Replaces content in file. ``` php $builder->make('replace-content', [ 'file' => 'file.txt', 'replacements' => [ 'from' => 'to', 'old string' => 'new string', ], ]);

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/, (*24)

The Versions

25/05 2018

dev-master

9999999-dev

Project builder.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

25/05 2018

v1.0.0

1.0.0.0

Project builder.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires