For the test we'd like you to write a command-line tool that sets up a new, modern, PHP project.
Use PHP to execute commands in the user's shell.
The API should look something like, if not exactly:
php ~/scripts/create-project.php [project-name]
Running the script would produce:
cd ~/projects
php ~/scripts/create-project.php new-shortlist-project
// Script executes
"Project: new-shortlist-project created"
You script should do the following:
- Create a new folder with the supplied
project-name
argument - Create a new git repository
- Prompt the user for their github username, and then create a new repo on github, with the same
project-name
(Use Github API V3) - Create a new composer file in the root
- It should then add the following default files to the project
.gitignore
.github/PULL_REQUEST_TEMPLATE
.editorconfig
readme.md
- These basic files should then all be pushed to the remote repo in a commit called
"Init"
The resulting project directory structure should look like this:
new-shortlist-project
- .gitignore (This should include the _latest_ node, macOS, vim, subl, and composer references from gitignore.io)
- .git
- composer.json (This should include references to the name and repo)
- readme.md
- .github/PULL_REQUEST_TEMPLATE (this should include the _latest_ markdown from https://github.com/shortlist-digital/PULL_REQUEST_TEMPLATE/blob/master/pull-request-template.md
- .editorconfig Should include the _latest_ from the PHP Slim framework (https://github.com/slimphp)
Where possible template files should GET
requested from the web, rather than copied in blank.
You may assume that composer
, git
, curl
, and php
are installed globally on the developer's machine.
Commit your script work to a respository with a readme.md
file, and ensure that you "commit small and commit often."
You may spend upto 4 hours on your script.
If necessary, split the test into two sessions. Please email jon.sherrard@shortlist.com "Started technical test", when you start each session, and "Finished technical test" with a link to the repo. If you do not want to use a public repo, please feedback that you would like a private repo.