2017 © Pedro Peláez
 

application composer-init

Initialize a composer package based on a template package

image

clippings/composer-init

Initialize a composer package based on a template package

  • Thursday, March 10, 2016
  • by hkdobrev
  • Repository
  • 12 Watchers
  • 4 Stars
  • 99 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Composer Init

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version, (*1)

Tired of creating the same directory structure every time you start a new project? Tired of constantly modifying files if you clone github template repo? This command line tool allows you to initialize a project based on a template, and fills in values in the template., (*2)

Installation

Install via composer, (*3)

$ composer global require clippings/composer-init

This will install it to your user's global composer. If you already have ~/.composer/vendor/bin/ in your PATH you can start using it with, (*4)

$ composer-init

otherwise you can do it by calling directly, (*5)

$ ~/.composer/vendor/bin/composer-init

Basic Usage

  • composer-init search to discover templates
  • composer-init use {template-package} in an empty folder to use a template
  • composer-init token {token} set a github token for downloading past the github rate limit

composer-init Gets a lot of defaults from github repo & organization, so it is best to create an empty repo in github, clone it locally and run "composer-init use ..." there., (*6)

Creating Templates

A composer-init template must be published to Packagist.org, (therefore have a composer.json file) and have a prompts.json file to describe which of the available prompts will be used. The package should be published as "type": "composer-init-template". All the code for the template is present in the "root" directory., (*7)

example composer.json file:, (*8)

``` json { "name": "clippings/package-template", "description": "Package Template", "license": "MIT", "type": "composer-init-template", "authors": [ { "name": "John Smith", "email": "john@example.com", "role": "Author" } ] }, (*9)


example prompts.json file: ``` json [ "package_name", "title", "description", "php_namespace", "author_name", "author_email", "copyright", "bugs" ]

This states that this package will use these prompts, gather their input and then fill in the placeholders inside all the files in the root folder., (*10)

Here's an example template: https://github.com/clippings/package-template/, (*11)

Prompts

All prompts try to guess a reasonable default, but ask the user to confirm/correct its value., (*12)

author_email

The email of the author, by default uses git config user.email. You can set it yourself with git config user.email {my email} or globally with git config --global user.email {my email}. As stated in first time git setup guide, (*13)

Adds {% author_email %} template variable, (*14)

author_name

The name of the author, by default uses git config user.name. You can set it yourself with git config user.name {my name} or globally with git config --global user.name {my name}. As stated in first time git setup guide, (*15)

Adds {% author_name %} template variable, (*16)

bugs

The url for submitting new issues. By default gets the repo's gitub issues url. e.g. https://github.com/clippings/composer-init/issues, (*17)

Adds {% bugs %} template variable, (*18)

Tries to guess the copyright holder by going through, (*19)

  • github organization
  • github user
  • git user
  • file owner

And exposes it as "{year}, {copyright_entity}" - where year is the current year and copyright_entity is the guessed value. You can also get to the copyright_entity value separately, (*20)

Adds {% copyright %} template variable
Adds {% copyright_entity %} template variable, (*21)

description

The description of the github repo., (*22)

Adds {% description %} template variable, (*23)

package_name

The github package name e.g. clippings/composer-init, (*24)

Adds {% package_name %} template variable, (*25)

php_namespace

Tires to guess the package name, using github's organization/username and repo name. So clippings/composer-init would be converted to Clippings\ComposerInit. It also tries to guess the name with initials, so in this case it would also give the option of CL\ComposerInit. These can be cycled with tab completion or auto-completed when entering, (*26)

Adds {% php_namespace %}
Adds {% php_namespace_escaped %} template variable where all "\" characters are converted to "\\", (*27)

slack_notification

Get a "secure slack notification token". basically asks for a value and returns "slack:\n secure: {value}\n", so you can easily add slack to your .travis.yml notifications, (*28)

title

The title of the github repo., (*29)

Adds template variable, (*30)

Credits

Inspired by grunt-init, (*31)

Copyright (c) 2014-2015, Clippings Ltd. Developed by Ivan Kerin as part of clippings.com, (*32)

Under BSD-3-Clause license, read LICENSE file., (*33)

The Versions

10/03 2016

dev-master

9999999-dev

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

28/11 2015

0.4.0

0.4.0.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

11/11 2015

0.3.4

0.3.4.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

11/11 2015

0.3.3

0.3.3.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

09/09 2015

0.3.2

0.3.2.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

02/04 2015

0.3.1

0.3.1.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

01/04 2015

0.3.0

0.3.0.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

17/07 2014

0.2.4

0.2.4.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

17/07 2014

0.2.3

0.2.3.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

30/04 2014

0.2.2

0.2.2.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

30/04 2014

0.2.1

0.2.1.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

26/03 2014

0.2.0

0.2.0.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

25/03 2014

0.1.0

0.1.0.0

Initialize a composer package based on a template package

  Sources   Download

BSD-3-Clause

The Requires