Sistema web para crear proyecto web nuevo
This commit is contained in:
16
setup/api/config.php
Normal file
16
setup/api/config.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'base_url' => DI\decorate(function($prev, Container $c) {
|
||||
return implode('/', [
|
||||
$prev,
|
||||
'api'
|
||||
]);
|
||||
}),
|
||||
'urls' => DI\decorate(function($prev, Container $c) {
|
||||
$arr = (array) $prev;
|
||||
$arr['gitea'] = $c->get('gitea');
|
||||
return (object) $arr;
|
||||
})
|
||||
];
|
60
setup/app.php
Normal file
60
setup/app.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
use DI\ContainerBuilder as Builder;
|
||||
use DI\Bridge\Slim\Bridge;
|
||||
|
||||
if (!isset($__environment)) {
|
||||
throw new Exception('Missing __environment variable');
|
||||
}
|
||||
|
||||
include_once 'composer.php';
|
||||
|
||||
$builder = new Builder();
|
||||
|
||||
$files = [
|
||||
'config',
|
||||
'setup'
|
||||
];
|
||||
$folders = [
|
||||
'common',
|
||||
$__environment
|
||||
];
|
||||
|
||||
foreach ($files as $file) {
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$folder,
|
||||
$file . '.php'
|
||||
]);
|
||||
if (file_exists($filename)) {
|
||||
$builder->addDefinitions($filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$container = $builder->build();
|
||||
$app = Bridge::create($container);
|
||||
try {
|
||||
$app->setBasePath($container->get('base_url'));
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
__DIR__,
|
||||
$folder,
|
||||
'middleware.php'
|
||||
]);
|
||||
if (file_exists($filename)) {
|
||||
include_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
$container->get('folders')->routes,
|
||||
'router.php'
|
||||
]);
|
||||
if (!file_exists($filename)) {
|
||||
throw new Exception('Missing router file.');
|
||||
}
|
||||
include_once $filename;
|
33
setup/common/config.php
Normal file
33
setup/common/config.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
return [
|
||||
'base_url' => '/provm/projects',
|
||||
'gitea' => function() {
|
||||
$arr = [];
|
||||
$arr['url'] = 'https://git.provm.cl/api/swagger';
|
||||
$arr['api_key'] = 'd877e5ce64352c914657fa491fa7ae1722ad734f';
|
||||
return (object) $arr;
|
||||
},
|
||||
'urls' => function() {
|
||||
$arr = [
|
||||
'base' => '/provm/projects'
|
||||
];
|
||||
$arr['api'] = implode('/', [
|
||||
$arr['base'],
|
||||
'api'
|
||||
]);
|
||||
return (object) $arr;
|
||||
},
|
||||
'folders' => function() {
|
||||
$arr = [];
|
||||
$arr['base'] = dirname(__DIR__, 2);
|
||||
$arr['resources'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['base'],
|
||||
'resources'
|
||||
]);
|
||||
$arr['routes'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$arr['resources'],
|
||||
'routes'
|
||||
]);
|
||||
return (object) $arr;
|
||||
}
|
||||
];
|
14
setup/common/setup.php
Normal file
14
setup/common/setup.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
ProVM\Common\Service\Composer::class => function(Container $c) {
|
||||
return new ProVM\Common\Service\Composer(implode(DIRECTORY_SEPARATOR, [
|
||||
$c->get('folders')->base,
|
||||
'composer.json'
|
||||
]));
|
||||
},
|
||||
ProVM\Projects\Common\Service\Projects::class => function(Container $c) {
|
||||
return new ProVM\Projects\Common\Service\Projects(implode(DIRECTORY_SEPARATOR, [dirname($c->get('folders')->base), 'demos']));
|
||||
}
|
||||
];
|
10
setup/composer.php
Normal file
10
setup/composer.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$filename = implode(DIRECTORY_SEPARATOR, [
|
||||
dirname(__DIR__),
|
||||
'vendor',
|
||||
'autoload.php'
|
||||
]);
|
||||
if (!file_exists($filename)) {
|
||||
throw new Exception('Missing composer install.');
|
||||
}
|
||||
include_once $filename;
|
34
setup/web/config.php
Normal file
34
setup/web/config.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
'folders' => DI\decorate(function($prev, Container $c) {
|
||||
$arr = (array) $prev;
|
||||
$arr['templates'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$prev->resources,
|
||||
'views'
|
||||
]);
|
||||
$arr['cache'] = implode(DIRECTORY_SEPARATOR, [
|
||||
$prev->base,
|
||||
'cache'
|
||||
]);
|
||||
return (object) $arr;
|
||||
}),
|
||||
'assets' => (object) [
|
||||
'styles' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/semantic.min.css'
|
||||
],
|
||||
'scripts' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/semantic.min.js'
|
||||
],
|
||||
'fonts' => [
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/brand-icons.woff',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/brand-icons.woff2',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/icons.woff',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/icons.woff2',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/outline-icons.woff',
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/fomantic-ui/2.8.6/themes/default/assets/fonts/outline-icons.woff2'
|
||||
]
|
||||
]
|
||||
];
|
16
setup/web/setup.php
Normal file
16
setup/web/setup.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
ProVM\Common\Alias\View::class => function(Container $c) {
|
||||
return new ProVM\Common\Define\View(
|
||||
$c->get('folders')->templates,
|
||||
$c->get('folders')->cache,
|
||||
null,
|
||||
[
|
||||
'urls' => $c->get('urls'),
|
||||
'assets' => $c->get('assets')
|
||||
]
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user