generated from laravel-appkit/package-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/laravel-appkit/lockable int…
…o main
- Loading branch information
Showing
17 changed files
with
232 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Documentation | ||
url: https://appkit.coutts.io/packages/lockable/docs | ||
url: https://appkit.coutts.io/packages/:package_name/docs | ||
about: View the documentation | ||
|
||
- name: Community | ||
url: https://appkit.coutts.io/packages/lockable/community | ||
url: https://appkit.coutts.io/packages/:package_name/community | ||
about: Ask the community for help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"php":"7.4.13","version":"2.17.3","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["const","method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"blank_line_after_opening_tag":true,"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true},"hashes":{"tests\/database\/migrations\/2021_01_01_000000_create_articles_table.php":1906224168}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* lockable configuration | ||
* :package_name configuration | ||
*/ | ||
return [ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash | ||
|
||
git_name=`git config user.name`; | ||
git_email=`git config user.email`; | ||
|
||
read -p "Author name ($git_name): " author_name | ||
author_name=${author_name:-$git_name} | ||
|
||
read -p "Author email ($git_email): " author_email | ||
author_email=${author_email:-$git_email} | ||
|
||
username_guess=${author_name//[[:blank:]]/} | ||
read -p "Author username ($username_guess): " author_username | ||
author_username=${author_username:-$username_guess} | ||
|
||
current_directory=`pwd` | ||
current_directory=`basename $current_directory` | ||
read -p "Package name ($current_directory): " package_name | ||
package_name=${package_name:-$current_directory} | ||
package_name_php=$(echo $package_name | sed -E 's/[^a-z]+([a-z])/\U\1/gi;s/^([A-Z])/\l\1/') | ||
|
||
read -p "Package description: " package_description | ||
|
||
echo | ||
echo -e "Author: $author_name ($author_username, $author_email)" | ||
echo -e "Package: $package_name <${package_name_php^}>" | ||
|
||
echo | ||
echo "This script will replace the above values in all files in the project directory and reset the git repository." | ||
read -p "Are you sure you wish to continue? (n/y) " -n 1 -r | ||
|
||
echo | ||
if [[ ! $REPLY =~ ^[Yy]$ ]] | ||
then | ||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 | ||
fi | ||
|
||
echo | ||
|
||
echo "Scaffolding package" | ||
|
||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:author_name/$author_name/g" {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:author_username/$author_username/g" {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:author_email/$author_email/g" {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:package_name_php/${package_name_php^}/g" {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:package_name/$package_name/g" {} \; | ||
find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./setup.sh" -exec sed -i -e "s/:package_description/$package_description/g" {} \; | ||
|
||
sed -i -e "/^\*\*Note:\*\* Replace/d" README.md | ||
|
||
echo "Renaming files" | ||
|
||
mv "./routes/package.php" "./routes/$package_name_php.php" | ||
mv "./src/Package.php" "./src/${package_name_php^}.php" | ||
mv "./src/PackageFacade.php" "./src/${package_name_php^}Facade.php" | ||
mv "./src/PackageServiceProvider.php" "./src/${package_name_php^}ServiceProvider.php" | ||
|
||
if [[ -d "vendor" ]] | ||
then | ||
echo "Composer dependencies already installed. Dumping autoload" | ||
composer dump-autoload | ||
else | ||
echo "Composer dependencies not installed. Installing them" | ||
composer install | ||
fi | ||
|
||
if [ "$current_directory" != "package-starter" ] | ||
then | ||
rm -- "$0" | ||
|
||
git add . | ||
git commit -m ":sparkles: Configure Package"; | ||
git pull | ||
git push | ||
|
||
echo "Replaced all values and commited, self destructing in 3... 2... 1..." | ||
else | ||
echo "Replaced all values" | ||
fi | ||
|
||
echo | ||
printf "\033[0;32mBuild something awesome!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace AppKit\:package_name_php\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* @see \AppKit\:package_name_php\:package_name_php | ||
*/ | ||
class :package_name_php extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return ':package_name'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace AppKit\:package_name_php; | ||
|
||
class :package_name_php | ||
{ | ||
private $app; | ||
|
||
public function __construct() | ||
{ | ||
$this->app = app(); | ||
} | ||
|
||
// Build your next great package. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace AppKit\:package_name_php; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class :package_name_phpServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
*/ | ||
public function boot() | ||
{ | ||
/* | ||
* Optional methods to load your package assets | ||
*/ | ||
// $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', ':package_name'); | ||
// $this->loadViewsFrom(__DIR__ . '/../resources/views', ':package_name'); | ||
// $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); | ||
// $this->loadRoutesFrom(__DIR__ . '/../routes/:package_name.php'); | ||
|
||
if ($this->app->runningInConsole()) { | ||
$this->publishes([ | ||
__DIR__ . '/../config/config.php' => config_path(':package_name.php'), | ||
], 'config'); | ||
|
||
// Publishing the views. | ||
/*$this->publishes([ | ||
__DIR__ . '/../resources/views' => resource_path('views/vendor/:package_name'), | ||
], 'views');*/ | ||
|
||
// Publishing assets. | ||
/*$this->publishes([ | ||
__DIR__ . '/../resources/assets' => public_path('vendor/:package_name'), | ||
], 'assets');*/ | ||
|
||
// Publishing the translation files. | ||
/*$this->publishes([ | ||
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/:package_name'), | ||
], 'lang');*/ | ||
|
||
// Registering package commands. | ||
// $this->commands([]); | ||
} | ||
} | ||
|
||
/** | ||
* Register the application services. | ||
*/ | ||
public function register() | ||
{ | ||
// Automatically apply the package configuration | ||
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', ':package_name'); | ||
|
||
// Register the main class to use with the facade | ||
$this->app->singleton(':package_name', function () { | ||
return new :package_name_php(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace AppKit\:package_name_php\Tests; | ||
|
||
use AppKit\:package_name_php\Tests\Models\Article; | ||
class ExampleTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function trueIsTrue() | ||
{ | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** @test */ | ||
public function artcilesCanBeLoaded() | ||
{ | ||
// create 5 articles | ||
factory(Article::class, 5)->create(); | ||
|
||
// check the database for 5 articles | ||
$this->assertEquals(5, Article::count()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.