Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Single entrypoint #215

Merged
merged 3 commits into from Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.dist
@@ -0,0 +1,2 @@
SOLIDINVOICE_ENV=dev
SOLIDINVOICE_DEBUG=1
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -24,3 +24,4 @@ app/config/parameters.yml
node_modules
.rules
.php_cs.cache
.env
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -6,7 +6,7 @@ dist: trusty

env:
global:
- SYMFONY_ENV=test
- SOLIDINVOICE_ENV=test

cache:
yarn: true
Expand Down
13 changes: 11 additions & 2 deletions bin/console
Expand Up @@ -4,6 +4,7 @@
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
Expand All @@ -16,9 +17,17 @@ set_time_limit(0);
*/
$loader = require __DIR__.'/../app/autoload.php';

if (!getenv('SOLIDINVOICE_ENV') && file_exists($file = dirname(__DIR__).'/.env')) {
(new Dotenv())->load($file);
}

if (!getenv('SOLIDINVOICE_ENV')) {
throw new \RuntimeException('Environment is not set up correctly. "SOLIDINVOICE_ENV" environment variable is missing.');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
$env = $input->getParameterOption(['--env', '-e'], getenv('SOLIDINVOICE_ENV'));
$debug = (bool) getenv('SOLIDINVOICE_DEBUG') && !$input->hasParameterOption(['--no-debug', '']);

if ($debug) {
Debug::enable();
Expand Down
3 changes: 0 additions & 3 deletions src/CoreBundle/Resources/config/requirejs.yml
Expand Up @@ -38,8 +38,6 @@ config:
material.ripples:
deps:
- jquery
fos_router:
exports: fos.Router
paths:
# External dependencies loaded through NPM/Yarn
backbone: ../assets/backbone.js
Expand Down Expand Up @@ -75,7 +73,6 @@ config:
core/view: solidinvoicecore/js/itemview.js
util/form/collection: solidinvoicecore/js/util/form/collection.js
template: ../js/hbs-templates.js
fos_routing_data: ../js/fos_js_routes.js
map:
'*':
translator: solidinvoicecore/js/extend/translator
Expand Down
4 changes: 2 additions & 2 deletions src/CoreBundle/Resources/public/js/extend/routing.js
@@ -1,8 +1,8 @@
define(['lodash', 'fos_router', 'fos_routing_data'], function(_, Router, data) {

if (!_.isUndefined(data)) {
Router.setData(data);
Router.setRoutingData(data);
}

return Routing;
return Router;
});
18 changes: 17 additions & 1 deletion web/app.php
Expand Up @@ -9,6 +9,8 @@
* with this source code in the file LICENSE.
*/

use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;

/*
Expand All @@ -17,7 +19,21 @@
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';

$kernel = new AppKernel('prod', false);
if (!getenv('SOLIDINVOICE_ENV') && file_exists($file = dirname(__DIR__).'/.env')) {
(new Dotenv())->load($file);
}

if (!getenv('SOLIDINVOICE_ENV')) {
throw new \RuntimeException('Environment is not set up correctly. "SOLIDINVOICE_ENV" environment variable is missing.');
}

$debug = (bool) getenv('SOLIDINVOICE_DEBUG');

if ($debug) {
Debug::enable();
}

$kernel = new AppKernel(getenv('SOLIDINVOICE_ENV'), $debug);
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
Expand Down
39 changes: 0 additions & 39 deletions web/app_dev.php

This file was deleted.