Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #59 from Naoray/byjujohn-add-credits
Browse files Browse the repository at this point in the history
add credits
  • Loading branch information
Naoray authored Oct 2, 2019
2 parents 3bcfea7 + 5bf36b2 commit a5d825b
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 17 deletions.
44 changes: 29 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@ I hate creating new controllers, middlewares, ... by copy & paste. Wouldn't it b
`composer require naoray/laravel-package-maker --dev`

## Usage
- [Create a package](#internals-create)
- [Create a nova tool](#internals-nova)
- [Add a package](#internals-add)
- [Save package credentials](#internals-save)
- [Delete package credentials](#internals-delete)
- [Clone a package](#internals-clone)
- [Replace content](#internals-replace)
- [Make Commands](#make-commands)
+ [Foundation](#make-commands-foundation)
+ [Database](#make-commands-database)
+ [Routing](#make-commands-routing)
- [Other Commands](#internals-stubs)
- [Example Usage](#make-commands-example-usage)
- [laravel-package-maker](#laravel-package-maker)
- [Install](#install)
- [Usage](#usage)
- [Create a package](#create-a-package)
- [Create a nova tool](#create-a-nova-tool)
- [Add a package](#add-a-package)
- [Save package credentials](#save-package-credentials)
- [Delete package credentials](#delete-package-credentials)
- [Clone a package](#clone-a-package)
- [Replace Content](#replace-content)
- [Make Commands](#make-commands)
- [Foundation](#foundation)
- [Database](#database)
- [Routing](#routing)
- [Standard Php](#standard-php)
- [Commands used for creating initial package stubs](#commands-used-for-creating-initial-package-stubs)
- [Example Usage](#example-usage)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Credits](#credits)
- [Security](#security)
- [License](#license)

<a name="internals-create"/>

Expand Down Expand Up @@ -163,12 +173,12 @@ All of the following routes only accept a `name` argument.
### Commands used for creating initial package stubs
- `package:basetest {provider : The package's provider name}` - creates `TestCase` in `tests` folder
- `package:codecov` - creates a `.codecov.yml` file
- `package:composer {author : The author of the package.} {email : The author's email.}` - creates `composer.json`
- `package:composer {--author : The author of the package.} {--email : The author's email.}` - creates `composer.json`
- `package:contribution` - creates `CONTRIBUTING.md`
- `package:gitignore` - creates `.gitignore` file
- `package:license {--copyright : The company or vendor name to place it int the license file}` - creates `LICENSE.md` file
- `package:phpunit` - creates `phpunit.xml`
- `package:readme` - creates `readme.md`
- `package:readme {--author : The author of the package.} {--email : The author's email.}` - creates `readme.md`
- `package:styleci` - creates `.styleci.yml`
- `package:travis` - creates `.travis.yml`

Expand All @@ -194,6 +204,10 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Credits
- [Krishan König](https://github.com/naoray)
- [All Contributors](https://github.com/naoray/laravel-package-maker/contributors)

## Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Expand Down
58 changes: 58 additions & 0 deletions src/Commands/Package/ReadmeMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Naoray\LaravelPackageMaker\Commands\Package;

use Symfony\Component\Console\Input\InputOption;
use Naoray\LaravelPackageMaker\Commands\GeneratorCommand;

class ReadmeMakeCommand extends GeneratorCommand
Expand All @@ -27,6 +28,26 @@ class ReadmeMakeCommand extends GeneratorCommand
*/
protected $type = 'readme';

/**
* Execute the console command.
*
* @return bool|null
*/
public function handle()
{
parent::handle();

$name = $this->qualifyClass($this->getNameInput());

$path = $this->getPath($name);

$this->callSilent('package:replace', [
'path' => $path,
'--old' => ['DummyAuthorEmail', 'DummyAuthor'],
'--new' => [$this->getEmailInput(), $this->getAuthorInput()],
]);
}

/**
* Get the stub file for the generator.
*
Expand Down Expand Up @@ -56,4 +77,41 @@ protected function getNameInput()
{
return 'readme';
}

/**
* Get the author name from the input.
*
* @return string
*/
protected function getAuthorInput()
{
return trim($this->option('author'));
}

/**
* Get the author name from the input.
*
* @return string
*/
protected function getEmailInput()
{
return trim($this->option('email'));
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array_merge(
parent::getOptions(),
[
['author', 'A', InputOption::VALUE_REQUIRED, 'The author of this package'],

['email', 'E', InputOption::VALUE_REQUIRED, 'The email of the package author'],
]
);
}
}
5 changes: 5 additions & 0 deletions src/Commands/Package/stubs/readme.stub
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Credits

- [DummyAuthor](https://github.com/DummyVendor)
- [All Contributors](https://github.com/DummyVendor/DummyPackageName/contributors)

## Security
If you discover any security-related issues, please email DummyAuthorEmail instead of using the issue tracker.

Expand Down
10 changes: 8 additions & 2 deletions src/Commands/PackageMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PackageMakeCommand extends Command
*
* @var string
*/
protected $signature = 'make:package
protected $signature = 'make:package
{name? : The name of the package}
{vendor? : Vendor name of the package}
{dir? : Directory where the package will be stored}
Expand Down Expand Up @@ -139,7 +139,13 @@ public function handle()
*/
protected function createCommonFiles()
{
$this->call('package:readme', $this->packageOptions());
$this->call('package:readme', array_merge(
$this->packageOptions(),
[
'--author' => $this->author,
'--email' => $this->email,
]
));
$this->call('package:license', array_merge(
$this->packageOptions(),
['--copyright' => $this->copyright]
Expand Down

0 comments on commit a5d825b

Please sign in to comment.