Prefilling info
This commit is contained in:
parent
9ebeb23068
commit
c24f5d635c
|
@ -1,6 +1,6 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to `:package_name` will be documented in this file.
|
||||
All notable changes to `PhpMatrixSdk` will be documented in this file.
|
||||
|
||||
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at `:author_email`. All
|
||||
reported by contacting the project team at `aryess@github.com`. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Contributions are **welcome** and will be fully **credited**.
|
||||
|
||||
We accept contributions via Pull Requests on [Github](https://github.com/:vendor/:package_name).
|
||||
We accept contributions via Pull Requests on [Github](https://github.com/Aryess/PhpMatrixSdk).
|
||||
|
||||
|
||||
## Pull Requests
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 :author_name <:author_email>
|
||||
Copyright (c) 2018 Yoann Celton <aryess@github.com>
|
||||
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
> of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
34
README.md
34
README.md
|
@ -1,4 +1,4 @@
|
|||
# :package_name
|
||||
# PhpMatrixSdk
|
||||
|
||||
[![Latest Version on Packagist][ico-version]][link-packagist]
|
||||
[![Software License][ico-license]](LICENSE.md)
|
||||
|
@ -7,7 +7,7 @@
|
|||
[![Quality Score][ico-code-quality]][link-code-quality]
|
||||
[![Total Downloads][ico-downloads]][link-downloads]
|
||||
|
||||
**Note:** Replace ```:author_name``` ```:author_username``` ```:author_website``` ```:author_email``` ```:vendor``` ```:package_name``` ```:package_description``` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md) and [composer.json](composer.json) files, then delete this line. You can run `$ php prefill.php` in the command line to make all replacements at once. Delete the file prefill.php as well.
|
||||
**Note:** Replace ```Yoann Celton``` ```aryess``` ```https://github.com/aryess``` ```aryess@github.com``` ```Aryess``` ```PhpMatrixSdk``` ```Later``` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md) and [composer.json](composer.json) files, then delete this line. You can run `$ php prefill.php` in the command line to make all replacements at once. Delete the file prefill.php as well.
|
||||
|
||||
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what
|
||||
PSRs you support to avoid any confusion with users and contributors.
|
||||
|
@ -30,13 +30,13 @@ vendor/
|
|||
Via Composer
|
||||
|
||||
``` bash
|
||||
$ composer require :vendor/:package_name
|
||||
$ composer require Aryess/PhpMatrixSdk
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
``` php
|
||||
$skeleton = new League\Skeleton();
|
||||
$skeleton = new Aryess\PhpMatrixSdk();
|
||||
echo $skeleton->echoPhrase('Hello, League!');
|
||||
```
|
||||
|
||||
|
@ -56,28 +56,28 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT
|
|||
|
||||
## Security
|
||||
|
||||
If you discover any security related issues, please email :author_email instead of using the issue tracker.
|
||||
If you discover any security related issues, please email aryess@github.com instead of using the issue tracker.
|
||||
|
||||
## Credits
|
||||
|
||||
- [:author_name][link-author]
|
||||
- [Yoann Celton][link-author]
|
||||
- [All Contributors][link-contributors]
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||
|
||||
[ico-version]: https://img.shields.io/packagist/v/:vendor/:package_name.svg?style=flat-square
|
||||
[ico-version]: https://img.shields.io/packagist/v/Aryess/PhpMatrixSdk.svg?style=flat-square
|
||||
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
|
||||
[ico-travis]: https://img.shields.io/travis/:vendor/:package_name/master.svg?style=flat-square
|
||||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/:vendor/:package_name.svg?style=flat-square
|
||||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/:vendor/:package_name.svg?style=flat-square
|
||||
[ico-downloads]: https://img.shields.io/packagist/dt/:vendor/:package_name.svg?style=flat-square
|
||||
[ico-travis]: https://img.shields.io/travis/Aryess/PhpMatrixSdk/master.svg?style=flat-square
|
||||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/Aryess/PhpMatrixSdk.svg?style=flat-square
|
||||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/Aryess/PhpMatrixSdk.svg?style=flat-square
|
||||
[ico-downloads]: https://img.shields.io/packagist/dt/Aryess/PhpMatrixSdk.svg?style=flat-square
|
||||
|
||||
[link-packagist]: https://packagist.org/packages/:vendor/:package_name
|
||||
[link-travis]: https://travis-ci.org/:vendor/:package_name
|
||||
[link-scrutinizer]: https://scrutinizer-ci.com/g/:vendor/:package_name/code-structure
|
||||
[link-code-quality]: https://scrutinizer-ci.com/g/:vendor/:package_name
|
||||
[link-downloads]: https://packagist.org/packages/:vendor/:package_name
|
||||
[link-author]: https://github.com/:author_username
|
||||
[link-packagist]: https://packagist.org/packages/Aryess/PhpMatrixSdk
|
||||
[link-travis]: https://travis-ci.org/Aryess/PhpMatrixSdk
|
||||
[link-scrutinizer]: https://scrutinizer-ci.com/g/Aryess/PhpMatrixSdk/code-structure
|
||||
[link-code-quality]: https://scrutinizer-ci.com/g/Aryess/PhpMatrixSdk
|
||||
[link-downloads]: https://packagist.org/packages/Aryess/PhpMatrixSdk
|
||||
[link-author]: https://github.com/aryess
|
||||
[link-contributors]: ../../contributors
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
{
|
||||
"name": ":vendor/:package_name",
|
||||
"name": "Aryess/PhpMatrixSdk",
|
||||
"type": "library",
|
||||
"description": ":package_description",
|
||||
"description": "Later",
|
||||
"keywords": [
|
||||
":vendor",
|
||||
":package_name"
|
||||
"Aryess",
|
||||
"PhpMatrixSdk"
|
||||
],
|
||||
"homepage": "https://github.com/:vendor/:package_name",
|
||||
"homepage": "https://github.com/Aryess/PhpMatrixSdk",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": ":author_name",
|
||||
"email": ":author_email",
|
||||
"homepage": ":author_website",
|
||||
"name": "Yoann Celton",
|
||||
"email": "aryess@github.com",
|
||||
"homepage": "https://github.com/aryess",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
|
@ -25,12 +25,12 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
":vendor\\:package_name\\": "src"
|
||||
"Aryess\\PhpMatrixSdk\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
":vendor\\:package_name\\": "tests"
|
||||
"Aryess\\PhpMatrixSdk\\": "tests"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name=":package_name">
|
||||
<description>The coding standard of :package_name package</description>
|
||||
<ruleset name="PhpMatrixSdk">
|
||||
<description>The coding standard of PhpMatrixSdk package</description>
|
||||
<arg value="p" />
|
||||
|
||||
<config name="ignore_warnings_on_exit" value="1" />
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name=":vendor Test Suite">
|
||||
<testsuite name="Aryess Test Suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
|
111
prefill.php
111
prefill.php
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
define('COL_DESCRIPTION', 0);
|
||||
define('COL_HELP', 1);
|
||||
define('COL_DEFAULT', 2);
|
||||
|
||||
$fields = [
|
||||
'author_name' => ['Your name', '', ''],
|
||||
'author_github_username' => ['Your Github username', '<username> in https://github.com/username', ''],
|
||||
'author_email' => ['Your email address', '', ''],
|
||||
'author_twitter' => ['Your twitter username', '', '@{author_github_username}'],
|
||||
'author_website' => ['Your website', '', 'https://github.com/{author_github_username}'],
|
||||
|
||||
'package_vendor' => ['Package vendor', '<vendor> in https://github.com/vendor/package', '{author_github_username}'],
|
||||
'package_name' => ['Package name', '<package> in https://github.com/vendor/package', ''],
|
||||
'package_description' => ['Package very short description', '', ''],
|
||||
|
||||
'psr4_namespace' => ['PSR-4 namespace', 'usually, Vendor\\Package', '{package_vendor}\\{package_name}'],
|
||||
];
|
||||
|
||||
$values = [];
|
||||
|
||||
$replacements = [
|
||||
':vendor\\\\:package_name\\\\' => function () use(&$values) { return str_replace('\\', '\\\\', $values['psr4_namespace']) . '\\\\'; },
|
||||
':author_name' => function () use(&$values) { return $values['author_name']; },
|
||||
':author_username' => function () use(&$values) { return $values['author_github_username']; },
|
||||
':author_website' => function () use(&$values) { return $values['author_website'] ?: ('https://github.com/' . $values['author_github_username']); },
|
||||
':author_email' => function () use(&$values) { return $values['author_email'] ?: ($values['author_github_username'] . '@example.com'); },
|
||||
':vendor' => function () use(&$values) { return $values['package_vendor']; },
|
||||
':package_name' => function () use(&$values) { return $values['package_name']; },
|
||||
':package_description' => function () use(&$values) { return $values['package_description']; },
|
||||
'League\\Skeleton' => function () use(&$values) { return $values['psr4_namespace']; },
|
||||
];
|
||||
|
||||
function read_from_console ($prompt) {
|
||||
if ( function_exists('readline') ) {
|
||||
$line = trim(readline($prompt));
|
||||
if (!empty($line)) {
|
||||
readline_add_history($line);
|
||||
}
|
||||
} else {
|
||||
echo $prompt;
|
||||
$line = trim(fgets(STDIN));
|
||||
}
|
||||
return $line;
|
||||
}
|
||||
|
||||
function interpolate($text, $values)
|
||||
{
|
||||
if (!preg_match_all('/\{(\w+)\}/', $text, $m)) {
|
||||
return $text;
|
||||
}
|
||||
foreach ($m[0] as $k => $str) {
|
||||
$f = $m[1][$k];
|
||||
$text = str_replace($str, $values[$f], $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
$modify = 'n';
|
||||
do {
|
||||
if ($modify == 'q') {
|
||||
exit;
|
||||
}
|
||||
|
||||
$values = [];
|
||||
|
||||
echo "----------------------------------------------------------------------\n";
|
||||
echo "Please, provide the following information:\n";
|
||||
echo "----------------------------------------------------------------------\n";
|
||||
foreach ($fields as $f => $field) {
|
||||
$default = isset($field[COL_DEFAULT]) ? interpolate($field[COL_DEFAULT], $values): '';
|
||||
$prompt = sprintf(
|
||||
'%s%s%s: ',
|
||||
$field[COL_DESCRIPTION],
|
||||
$field[COL_HELP] ? ' (' . $field[COL_HELP] . ')': '',
|
||||
$field[COL_DEFAULT] !== '' ? ' [' . $default . ']': ''
|
||||
);
|
||||
$values[$f] = read_from_console($prompt);
|
||||
if (empty($values[$f])) {
|
||||
$values[$f] = $default;
|
||||
}
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
echo "----------------------------------------------------------------------\n";
|
||||
echo "Please, check that everything is correct:\n";
|
||||
echo "----------------------------------------------------------------------\n";
|
||||
foreach ($fields as $f => $field) {
|
||||
echo $field[COL_DESCRIPTION] . ": $values[$f]\n";
|
||||
}
|
||||
echo "\n";
|
||||
} while (($modify = strtolower(read_from_console('Modify files with these values? [y/N/q] '))) != 'y');
|
||||
echo "\n";
|
||||
|
||||
$files = array_merge(
|
||||
glob(__DIR__ . '/*.md'),
|
||||
glob(__DIR__ . '/*.xml.dist'),
|
||||
glob(__DIR__ . '/composer.json'),
|
||||
glob(__DIR__ . '/src/*.php'),
|
||||
glob(__DIR__ . '/tests/*.php')
|
||||
);
|
||||
foreach ($files as $f) {
|
||||
$contents = file_get_contents($f);
|
||||
foreach ($replacements as $str => $func) {
|
||||
$contents = str_replace($str, $func(), $contents);
|
||||
}
|
||||
file_put_contents($f, $contents);
|
||||
}
|
||||
|
||||
echo "Done.\n";
|
||||
echo "Now you should remove the file '" . basename(__FILE__) . "'.\n";
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace League\Skeleton;
|
||||
namespace Aryess\PhpMatrixSdk;
|
||||
|
||||
class SkeletonClass
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace League\Skeleton;
|
||||
namespace Aryess\PhpMatrixSdk;
|
||||
|
||||
class ExampleTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue