Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
narai420 committed Feb 27, 2020
0 parents commit a2083c5
Show file tree
Hide file tree
Showing 39 changed files with 1,991 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2016 Narayan Adhikary <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
Laravel Package Generator for WovoCMS
=========================

[![Build Status](https://travis-ci.org/wovosoft/crud.svg?branch=master)](https://travis-ci.org/wovosoft/crud) [![styleci](https://styleci.io/repos/96041272/shield)](https://styleci.io/repos/96041272) [![Packagist](https://img.shields.io/packagist/v/melihovv/laravel-package-generator.svg)](https://packagist.org/packages/wovosoft/crud) [![Packagist](https://poser.pugx.org/melihovv/laravel-package-generator/d/total.svg)](https://packagist.org/packages/wovosoft/crud) [![Packagist](https://img.shields.io/packagist/l/wovosoft/crud.svg)](https://packagist.org/packages/wovosoft/crud)

Simple package to quickly generate basic structure for other WovoCMS laravel packages.

## Install

Install via composer
```bash
composer require --dev wovosoft/crud
```

Publish package config if you want customize default values
```bash
php artisan vendor:publish --provider="Wovosoft\Crud\ServiceProvider" --tag="config"
```

## Available commands for Packages

### Make A New Package
`php artisan crud:make_package {vendor} {package}` \
or, with inraction\
`php artisan crud:make_package -i`


Example: `php artisan crud:make_package Wovosoft SomeAwesomePackage`

This command will:

* Create `packages/wovosoft/some-awesome-package` folder
* Register package in app composer.json
* Copy package skeleton from skeleton folder to created folder (you can provide
your custom skeleton path in config)
* Run `git init packages/wovosoft/some-awesome-package`
* Run `composer update wovosoft/some-awesome-package`
* Run `composer dump-autoload`

With interactive `-i` flag you will be prompted for every needed value from you.

### Remove A Package
`php artisan crud:remove_package {vendor} {package} `

Example: `php artisan crud:remove_package Wovosoft SomeAwesomePackage`

This command will:

* Run `composer remove wovosoft/some-awesome-package`
* Remove `packages/wovosoft/some-awesome-package` folder
* Unregister package in app composer.json
* Run `composer dump-autoload`

**Interactive mode also possible.**
## Available Commands For Controller Generation
### Make a Controller
`php artisan crud:make_controller {vendor} {package} {controller} {model}` \

#### With Interaction Mode
`php artisan crud:make_controller -i`

### Remove A Controller
`php artisan crud:remove_controller {vendor} {package} {controller}`
#### With Interaction Mode
`php artisan crud:remove_controller -i`

## Available Commands for Model Generation
### Make a Model
`php artisan crud:make_model {vendor} {package} {model}`
#### With Interaction Mode
`php artisan crud:make_model -i`
### Remove a Model
`php artisan crud:remove_model {vendor} {package} {model}`
#### With Interaction Model
`php artisan crud:remove_model -i`

## CRUD Console Application
> There is a Console Application available. To run all above Artisan Commands from a single terminal with less commands, please run `php artisan crud -i` or `php artisan crud`. Then you can see the all available commands in a multiple choice form. Just select an option and that command will start executing immediately in interaction mode. You can then follow the rest of the ongoing processes.
## Custom skeleton
> This package will copy all folders and files from specified skeleton path to package folder. You can use templates in your skeleton. All files with `tpl` extension will be provided with some variables available to use in them. `tpl` extension will be stripped.
### Available variables to use in templates:

* vendor (e.g. Wovosoft)
* package (e.g. SomeAwesomePackage)
* vendorFolderName (e.g. wovosoft)
* packageFolderName (e.g. some-awesome-package)
* packageHumanName (e.g. Some awesome package)
* composerName (e.g. wovosoft/some-awesome-package)
* composerDesc (e.g. A some awesome package)
* composerKeywords (e.g. some,awesome,package)
* licence (e.g. MIT)
* phpVersion (e.g. >=7.0)
* aliasName (e.g. some-awesome-package)
* configFileName (e.g. some-awesome-package)
* year (e.g. 2017)
* name (e.g. Narayan Adhikary)
* email (e.g. [email protected])
* githubPackageUrl (e.g. https://github.com/wovosoft/some-awesome-package)
* controller (Name of the Controller for Controller Generation)
* model (Name of the Model for Model Generation)

## Things you need to do manually:

* Service provider and alias registration (if you use laravel <5.5)
* In README.md:
* StyleCI repository identifier
* Package description
* Usage section

## Security

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

## Credits

- [Narayan Adhikary](https://github.com/narai420)
- [Wovo Soft](https://gitlab.com/wovosoft)
42 changes: 42 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "wovosoft/crud",
"description": "A laravel package generator for WovoCMS",
"license": "MIT",
"keywords": [
"laravel",
"package",
"generator"
],
"type": "library",
"authors": [
{
"name": "Narayan Adhikary",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.2",
"illuminate/container": "^6.0",
"illuminate/console": "^6.0",
"illuminate/filesystem": "^6.0",
"illuminate/support": "^6.0",
"illuminate/view": "^6.0"
},
"autoload": {
"psr-4": {
"Wovosoft\\Crud\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Wovosoft\\Crud\\ServiceProvider"
]
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
32 changes: 32 additions & 0 deletions config/wovosoft-crud.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Custom skeleton directory path
|--------------------------------------------------------------------------
|
| This value allows to override default package skeleton.
| Relative to base project path. Example: storage/skeleton.
|
*/

'skeleton_dir_path' => null,
'init_git_onCreate' => false,
'register_package_to_composer_dot_json' => true,
'composer_update_onCreate' => true,
'composer_dumpAutoload_onCreate' => true,
'directories_to_create' => [
"database/migrations",
"database/factories",
"database/seeds",
"src/Traits",
"src/Models",
"src/Http/Controllers",
"resources/js",
"resources/lang",
"resources/views",
]

];
3 changes: 3 additions & 0 deletions skeleton/.coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage_clover: tests/logs/clover.xml
json_path: tests/logs/coveralls-upload.json
service_name: travis-ci
15 changes: 15 additions & 0 deletions skeleton/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab

[*.php]
indent_size = 4
14 changes: 14 additions & 0 deletions skeleton/.gitattributes.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
* text=auto
/.github export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.styleci.yml export-ignore
/.sensiolabs.yml export-ignore
/.coveralls.yml export-ignore
/phpunit.xml export-ignore
/CHANGELOG-* export-ignore
/CONTRIBUTING.md export-ignore
/CODE_OF_CONDUCT.md export-ignore
5 changes: 5 additions & 0 deletions skeleton/.gitignore.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/vendor
/.idea
/node_modules
/composer.lock
/.phpunit.result.cache
1 change: 1 addition & 0 deletions skeleton/.styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: laravel
42 changes: 42 additions & 0 deletions skeleton/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
language: php

sudo: false

notifications:
email:
on_success: never
on_failure: always

matrix:
include:
- php: 7.2
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.3
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.4snapshot
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.4snapshot
env: LARAVEL='6.*' TESTBENCH='4.*' COMPOSER_FLAGS='--prefer-stable'
fast_finish: true
allow_failures:
- php: 7.4snapshot

before_install:
- composer config discard-changes true
- composer validate --no-check-all --strict
- travis_retry composer self-update
- travis_retry composer require "laravel/framework:${LARAVEL}" "orchestra/testbench:${TESTBENCH}" --no-interaction --no-update

install:
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction --no-suggest
- travis_retry composer require --dev satooshi/php-coveralls

script:
- composer run phpunit -- --coverage-clover ./tests/logs/clover.xml

after_script:
- php vendor/bin/php-coveralls -v
22 changes: 22 additions & 0 deletions skeleton/LICENSE.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) <?php echo $year; ?> <?php echo $name; ?> <<?php echo $email; ?>>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

41 changes: 41 additions & 0 deletions skeleton/README.md.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# <?php echo "$packageHumanName\n"; ?>

[![Build Status](https://travis-ci.org/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>.svg?branch=master)](https://travis-ci.org/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)
[![styleci](https://styleci.io/repos/CHANGEME/shield)](https://styleci.io/repos/CHANGEME)
[![Coverage Status](https://coveralls.io/repos/github/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>/badge.svg?branch=master)](https://coveralls.io/github/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>?branch=master)

[![Packagist](https://img.shields.io/packagist/v/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)
[![Packagist](https://poser.pugx.org/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>/d/total.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)
[![Packagist](https://img.shields.io/packagist/l/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)

Package description: CHANGE ME

## Installation

Install via composer
```bash
composer require <?php echo $vendorFolderName; ?>/<?php echo "$packageFolderName\n"; ?>
```

### Publish Configuration File

```bash
php artisan vendor:publish --provider="<?php echo $vendor; ?>\<?php echo $package; ?>\ServiceProvider" --tag="config"
```

## Usage

CHANGE ME

## Security

If you discover any security related issues, please email <?php echo "$email\n"; ?>
instead of using the issue tracker.

## Credits

- [<?php echo $name??'Narayan Adhikary'; ?>](<?php echo $githubPackageUrl; ?>)
- [All contributors](<?php echo $githubPackageUrl; ?>/graphs/contributors)

This package is bootstrapped with the help of
[wovosoft/crud](https://github.com/wovosoft/crud).
Loading

0 comments on commit a2083c5

Please sign in to comment.