Skip to content

Commit

Permalink
Merge pull request #78 from LinkValue/feature/backoffice-v2
Browse files Browse the repository at this point in the history
Backoffice v2
  • Loading branch information
Oliboy50 committed Jun 27, 2017
2 parents 75a3c55 + 56b5c99 commit e38ab27
Show file tree
Hide file tree
Showing 152 changed files with 10,464 additions and 1,787 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ indent_style = tab
[*.md]
trim_trailing_whitespace = false

[*.{feature,json,js}]
[*.{feature,json,js,scss,sh}]
indent_size = 2
19 changes: 19 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"env": {
"node": true,
"es6": true
},
"rules": {
"comma-dangle": ["error", "always-multiline"],
"semi": ["error", "always"],
"quotes": ["error", "single", { "avoidEscape": true }],
"no-var": "error",
"eol-last": "error",
"prefer-arrow-callback": "error",
"no-new-require": "error",
"no-sync": "error"
},
"parserOptions": {
"sourceType": "module"
}
}
11 changes: 11 additions & 0 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
options:
merge-default-rules: false
files:
include: 'src/**/*.scss'
rules:
no-warn: 2
no-debug: 2
no-important: 2
indentation:
- 2
- size: 2
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
language: php

php:
- 5.6
- 7.0
- 5.6.19
- 7.0
- 7.1

before_script:
- nvm install "$(jq -r '.engines.node' package.json)"
- make test-prepare
- nvm install "$(jq -r '.engines.node' package.json)"
- make install-bin install-composer install-npm db-build clean

script:
- bin/phpunit --testsuite="majoraotastore_project" --coverage-clover="coverage.clover"
- bin/behat --no-interaction
- bin/behat --no-interaction --profile="nostream"
- npm run lint
- php bin/php-cs-fixer fix src/ --dry-run
- bin/phpunit --testsuite="majoraotastore_project" --coverage-clover="coverage.clover"
- bin/behat --no-interaction
- bin/behat --no-interaction --profile="nostream"
52 changes: 15 additions & 37 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ so please head to this link and fulfill the **Requirements** section for your OS
### Installation

#### 1. Clone project
```bash
```shell
git clone [email protected]:LinkValue/MajoraOTAStore.git
cd MajoraOTAStore
```

#### 2. Virtual machine provisioning
```bash
```shell
make provision
```

Note: If it fails at some point, don't hesitate to re-run this command several times.
Note: If it unluckily fails at some point, don't hesitate to re-run this command several times.

#### 3. Bootstrap project
```bash
#### 3. Install project
```shell
# connect to the VM
make ssh
# then install the project for development
# install the project for development (you'll have to press "Enter" several times to keep default parameters)
make install
# serve assets for development environment
npm start
```

#### 4. Enjoy
Expand All @@ -42,45 +44,21 @@ [email protected] => user

### Frontend development

All the assets (CSS/JS) are handled by Webpack.

By default, you'll have to run `npm run build` each time you edit an asset file to see the modification in your browser (after refreshing it).

But you can also use the webpack-dev-server to watch assets modification without needed to rebuild assets or even refreshing your browser.

First, activate the webpack-dev-server support in your `parameters.yml` file:
Front assets (css/js/images) are handled by [Webpack](https://webpack.js.org/).

```yml
# parameters.yml

...

use_webpack_dev_server: true

```
Then run the following command:
```bash
When you're in development environment (i.e. `http://majoraotastore.dev/app_dev.php/...`), the project is configured to use webpack dev server to serve assets, it means that the project will seems to be broken until you run the following command:
```shell
npm start
```

When you're in production environment (i.e. `http://majoraotastore.dev/...`), the project will use the assets found in `web/assets`, it means that you'll have to run `npm run build` each time you edit an asset file to see the modification in your browser (after refreshing it).

### Common tasks
```bash
```shell
# rebuild the whole database with clean fixtures
make db-rebuild
# update your database schema after adding/removing stuff in your data model
make db-rebuild db-update db-build
# run integration tests
# run functional tests
bin/behat
```


### Get a token
```bash
curl -X POST http://majoraotastore.dev/app_dev.php/api/login_check -d [email protected] -d _password=admin
```
output :
```
{"token":"eyJhbGciOiJSUzI1NiJ9.eyJyb2xlcyI6WyJS...2FcOf0m0juoxmorX_N9bNO0cucRJuLTf5-5PZCsohqAFMcXdPX50Qvn8"}
```
47 changes: 14 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,17 @@ vm-rebuild: vm-destroy vm-provision

# Clean
clean:
rm -rf var/cache/*
rm -rf var/logs/*
rm -rf vendor/composer/autoload*
rm var/bootstrap.php.cache
bin/composer dump-autoload
php bin/console cache:clear --no-warmup
php bin/console cache:warmup
npm run build

# Installation
install-bin:
mkdir -p bin
test -f bin/composer || curl -sS https://getcomposer.org/installer | php -- --install-dir=bin --filename=composer
bin/composer self-update
test -f bin/php-cs-fixer || wget http://get.sensiolabs.org/php-cs-fixer.phar -O bin/php-cs-fixer
php bin/php-cs-fixer self-update

install-git-hooks:
test -f .git/hooks/pre-commit || wget https://raw.githubusercontent.com/LinkValue/symfony-git-hooks/master/pre-commit -O .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit || true

install-composer:
bin/composer install
php bin/composer install

install-npm:
npm install
Expand All @@ -64,16 +53,13 @@ install-jwt:
test -f var/jwt/private.pem || openssl genrsa -out var/jwt/private.pem -passout pass:Majora -aes256 4096
test -f var/jwt/public.pem || openssl rsa -in var/jwt/private.pem -passin pass:Majora -pubout -out var/jwt/public.pem

install: install-bin install-git-hooks install-composer install-jwt install-npm db-build clean
install: install-bin install-composer install-jwt install-npm db-build assets-build clean

# Update
update: update-composer clean

update-composer:
bin/composer update

update-parameters:
bin/composer run-script set-parameters-yml -vv
php bin/composer update

# Database
db-build:
Expand All @@ -94,30 +80,25 @@ db-update:
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate -n

# Tests
test-prepare: test-install-bin install-composer install-npm db-build clean
# Assets
assets-build:
npm run build

test-install-bin:
test -d bin/ || mkdir bin/
test -f bin/composer || curl -sS https://getcomposer.org/installer | php -- --install-dir=bin --filename=composer
bin/composer self-update
assets-watch:
npm start

# Production
prod-install: install-bin
SYMFONY_ENV=prod bin/composer install --no-dev --optimize-autoloader --no-interaction
SYMFONY_ENV=prod php bin/composer install --no-dev --optimize-autoloader --no-interaction
npm install

prod-build:
php bin/console doctrine:database:create --if-not-exists --env=prod
php bin/console doctrine:migration:migrate -n --env=prod
php bin/console doctrine:database:create --env=prod --if-not-exists
php bin/console doctrine:migration:migrate --env=prod -n
npm run build

prod-clean:
rm -rf var/cache/*
rm -rf var/logs/*
rm -rf vendor/composer/autoload*
rm var/bootstrap.php.cache
bin/composer dump-autoload -o
php bin/console cache:clear --env=prod --no-warmup
php bin/console cache:warmup --env=prod
npm run build

prod-deploy: prod-install prod-build prod-clean
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ Allow to host iOS/Android application builds for an easy installation on allowed
## Contribute

[See our CONTRIBUTING guide](CONTRIBUTING.md)

## API Documentation

Before using the API, you must read [this documentation about how to be authenticated on the API side](doc/api/authentication.md).

- [/api/application](doc/api/application.md)
- [/api/build](doc/api/build.md)
2 changes: 1 addition & 1 deletion ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mysql:
databases:
- { name: 'majoraotastore' }

php_versions: ['5.6']
php_versions: ['7.0']
php_upload_max_filesize: '1024M'
php_post_max_size: '1024M'

Expand Down
12 changes: 5 additions & 7 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ public function registerContainerConfiguration(LoaderInterface $loader)
// Handle webpack-dev-server assets dynamically served
if ($this->getEnvironment() === 'dev') {
$loader->load(function (ContainerBuilder $container) {
if ($container->getParameter('use_webpack_dev_server')) {
$container->loadFromExtension('framework', [
'assets' => [
'base_url' => 'http://'.$container->getParameter('webpack_dev_server_host').':8080',
],
]);
}
$container->loadFromExtension('framework', [
'assets' => [
'base_url' => 'http://'.$container->getParameter('webpack_dev_server_host').':8080',
],
]);
});
}
}
Expand Down
34 changes: 34 additions & 0 deletions app/DoctrineMigrations/Version20170626235614.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20170626235614 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE majoraotastore_application ADD description LONGTEXT DEFAULT NULL');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE majoraotastore_application DROP description');
}
}
13 changes: 0 additions & 13 deletions app/Resources/views/base.html.twig

This file was deleted.

Loading

0 comments on commit e38ab27

Please sign in to comment.