Skip to content

Commit

Permalink
Wireframes
Browse files Browse the repository at this point in the history
  • Loading branch information
d13r committed Nov 24, 2018
0 parents commit 12e1c18
Show file tree
Hide file tree
Showing 37 changed files with 2,851 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# http://editorconfig.org/

root = true

# Defaults - Linux style, 4 spaces
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

# Markdown uses trailing whitespace to indicate continuation lines
[*.{markdown,md}]
trim_trailing_whitespace = false

# YAML
[*.yml]
indent_size = 2
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Exclude development files from exported zip files
# To test this, commit the changes then run:
# scripts/list-production-files.sh

/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore

/*.md export-ignore
/*.xml export-ignore

/scripts export-ignore
/tests export-ignore
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# PHP packages
/composer.lock
/vendor

# phpDocumentor
/api-docs/
/phpdoc.xml

# Test output
/build/
/test-coverage/
/tests/storage/

# Operating system files
.DS_Store
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Laravel Migrations UI

42 changes: 42 additions & 0 deletions classes/MigrationsUIServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace DaveJamesMiller\MigrationsUI;

use Illuminate\Support\ServiceProvider;

/**
* The Laravel service provider, which registers, configures and bootstraps the package.
*/
class MigrationsUIServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom($this->path('config/migrations-ui.php'), 'migrations-ui');
}

/**
* Bootstrap the application events.
*
* @return void
*/
public function boot(): void
{
$this->loadRoutesFrom($this->path('routes.php'));

$this->loadViewsFrom($this->path('views'), 'migrations-ui');

$this->publishes([
$this->path('config/migrations-ui.php') => config_path('migrations-ui.php'),
], 'config');
}

protected function path(string $path): string
{
return dirname(__DIR__) . "/$path";
}
}
45 changes: 45 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "davejamesmiller/laravel-migrations-ui",
"description": "A web-based GUI for creating and running migrations in Laravel.",
"keywords": [
"laravel"
],
"homepage": "https://github.com/davejamesmiller/laravel-migrations-ui",
"authors": [
{
"name": "Dave James Miller",
"email": "dave@davejamesmiller.com"
}
],
"license": "MIT",
"require": {
"php": ">=7.1.3",
"illuminate/support": "5.7.*",
"illuminate/view": "5.7.*"
},
"require-dev": {
"laravel/framework": "5.7.*",
"orchestra/testbench": "3.7.*",
"phpunit/phpunit": "7.*",
"php-coveralls/php-coveralls": "^1.0"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"DaveJamesMiller\\MigrationsUI\\": "classes/"
}
},
"autoload-dev": {
"psr-4": {
"MigrationsUITests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"DaveJamesMiller\\MigrationsUI\\MigrationsUIServiceProvider"
]
}
}
}
44 changes: 44 additions & 0 deletions config/migrations-ui.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Enabled?
|--------------------------------------------------------------------------
|
| By default this package is disabled in the production environment and
| when debugging is disabled), because it allows users to run arbitrary
| code.
|
*/

'enabled' => config('app.debug') && config('app.env') !== 'production',

/*
|--------------------------------------------------------------------------
| Path
|--------------------------------------------------------------------------
|
| You can change it if this conflicts with your own routes.
|
*/

'path' => '/migrations',

/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
|
| Optionally add middleware to the package routes.
|
| e.g. to allow access to certain users only:
|
| 'middleware' => ['web', 'can:access-migrations-ui']
|
*/

'middleware' => [],

];
13 changes: 13 additions & 0 deletions phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>Laravel Migrations UI API Documentation</title>
<parser>
<target>api-docs/cache/parser/</target>
</parser>
<transformer>
<target>api-docs/</target>
</transformer>
<files>
<directory>src/</directory>
</files>
</phpdoc>
32 changes: 32 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
bootstrap="vendor/autoload.php"
beStrictAboutCoversAnnotation="true"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>

<!-- List of files with tests inside -->
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">tests/</directory>
</testsuite>
</testsuites>

<!-- List of source files for code coverage checker -->
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

</phpunit>
21 changes: 21 additions & 0 deletions routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

$options = [
'middleware' => config('migrations-ui.middleware'),
'namespace' => 'DaveJamesMiller\MigrationsUI\Controllers',
'prefix' => config('migrations-ui.path'),
];

Route::group($options, function () {

Route::redirect('/', url('migrations/wireframes'));

Route::prefix('wireframes')->group(function () {
Route::view('/', 'migrations-ui::wireframes.index')->name('migrations-ui.wireframes.index');
Route::view('/create', 'migrations-ui::wireframes.create.step1')->name('migrations-ui.wireframes.create');
Route::view('/create/step2', 'migrations-ui::wireframes.create.step2')->name('migrations-ui.wireframes.create.step2');
Route::view('/create/step3', 'migrations-ui::wireframes.create.step3')->name('migrations-ui.wireframes.create.step3');
Route::view('/create/step4', 'migrations-ui::wireframes.create.step4')->name('migrations-ui.wireframes.create.step4');
});

});
10 changes: 10 additions & 0 deletions scripts/list-production-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/.."

################################################################################
# List files that will be included in a production install.
# All files must be committed before running this script.
################################################################################

git archive HEAD | tar -t
15 changes: 15 additions & 0 deletions scripts/phpdoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/.."

################################################################################
# Run phpDocumentor.
################################################################################

# Can't use Composer because there is a conflict between phpDocumentor and one
# of the other Laravel Breadcrumbs dependencies
[ -d api-docs/bin ] || mkdir -p api-docs/bin
[ -f api-docs/bin/phpdoc ] || curl https://www.phpdoc.org/phpDocumentor.phar > api-docs/bin/phpdoc
[ -x api-docs/bin/phpdoc ] || chmod +x api-docs/bin/phpdoc

exec api-docs/bin/phpdoc "$@"
24 changes: 24 additions & 0 deletions scripts/set-laravel-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/.."

################################################################################
# Install the specified version of Laravel for testing.
#
# Usage: `t set-laravel-version <version>`
# Example: `t set-laravel-version 5.7`
#
# This will update `project/composer.json` and install it.
# *Do not commit the changes.*
################################################################################

if [ $# -lt 1 ]; then
echo "Usage: set-laravel-version <version>"
exit 1
fi

version="${1:-}"

# Two separate steps because of: https://github.com/composer/composer/issues/7261
composer require --dev "laravel/framework:${version}.*" --no-update
composer update
21 changes: 21 additions & 0 deletions scripts/test-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/.."

################################################################################
# Run PHPUnit and generate code coverage report (requires Xdebug).
################################################################################

if [ ! -d vendor ]; then
composer install
fi

for executable in php7.2 php7.1; do
if command -v $executable >/dev/null 2>&1; then
exec $executable -d xdebug.coverage_enable=On vendor/bin/phpunit --coverage-html test-coverage/ "$@"
fi
done

if ! $has_run; then
exec php -d xdebug.coverage_enable=On vendor/bin/phpunit --coverage-html test-coverage/ "$@"
fi
24 changes: 24 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -o nounset -o pipefail -o errexit
cd "$(dirname "$0")/.."

################################################################################
# Run PHPUnit.
################################################################################

if [ ! -d vendor ]; then
composer install
fi

has_run=false

for executable in php7.2 php7.1; do
if command -v $executable >/dev/null 2>&1; then
$executable vendor/bin/phpunit "$@"
has_run=true
fi
done

if ! $has_run; then
php vendor/bin/phpunit "$@"
fi
16 changes: 16 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace MigrationsUITests;

use DaveJamesMiller\MigrationsUI\MigrationsUIServiceProvider;
use Orchestra\Testbench\TestCase as TestbenchTestCase;

abstract class TestCase extends TestbenchTestCase
{
protected function getPackageProviders($app)
{
return [
MigrationsUIServiceProvider::class,
];
}
}
Loading

0 comments on commit 12e1c18

Please sign in to comment.