Skip to content

Commit

Permalink
Merge branch 'master' into feature/user-registration
Browse files Browse the repository at this point in the history
  • Loading branch information
artstorm committed Jul 20, 2015
2 parents 31518c4 + cc22d87 commit ee92f9e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 32 deletions.
18 changes: 0 additions & 18 deletions TODO.md
@@ -1,25 +1,7 @@
#TODO

## Project
* Extend readme
* Add apiary documentation for API

## Gulpfile
* Add file watchers to handle file changes \#13
* Add test runner watching for karma \#13
* Create docker container for running gulp commands, add rewrite to bashrc? and readme ie `docker-compose run gulp [gulp command]` \#14
* Add host-only gulp tasks (work out how to differentiate in gulpfile) \#14
** Add boot2docker tasks `gulp vm:[up|restart|down|init]` \#14
** Add docker-compose tasks `gulp containers:[up|restart|down|status|pull]` \#14
* Make php coverage reporting use docker container `docker-compose run --entrypoint /data/api/vendor/bin/phpunit php --coverage-clover=/data/reports/coverage/api/clover.xml --colors -c /data/api/phpunit.xml`

## API
* Code coverage generation
* Add JWT authentication
* Disable sessions (completely)

## Travis
* Make travis use docker deployment ([not yet possible](http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/))

## Docker
* Configure gulp task to have php cli so it can run phpunit tests
10 changes: 8 additions & 2 deletions app/src/app/guest/login/login.spec.ts
Expand Up @@ -18,6 +18,7 @@ describe('Login', () => {
let LoginController:ng.IControllerService,
$scope:ng.IScope,
$rootScope:ng.IRootScopeService,
$timeout:ng.ITimeoutService,
$mdDialog:ng.material.IDialogService,
authService:NgJwtAuth.NgJwtAuthService,
deferredCredentials:ng.IDeferred<any>,
Expand All @@ -32,9 +33,10 @@ describe('Login', () => {

beforeEach(()=> {

inject(($controller, _$rootScope_, _ngJwtAuthService_, _$mdDialog_, _$q_) => {
inject(($controller, _$rootScope_, _ngJwtAuthService_, _$mdDialog_, _$q_, _$timeout_) => {
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
$timeout = _$timeout_;
$mdDialog = _$mdDialog_;
authService = _ngJwtAuthService_;
deferredCredentials = _$q_.defer();
Expand Down Expand Up @@ -86,17 +88,21 @@ describe('Login', () => {

(<any>$scope).cancelLoginDialog();

$timeout.flush(); //flush timeout as the modal is delayed

expect($mdDialog.cancel).to.have.been.called;
expect(deferredCredentials.promise).eventually.to.be.rejected;

$scope.$apply();

});

it('should show the login dialog when prompted', () => {


authService.promptLogin();

$timeout.flush(); //flush timeout as the modal is delayed

expect($mdDialog.show).to.have.been.called;

});
Expand Down
10 changes: 5 additions & 5 deletions app/src/app/guest/login/login.ts
Expand Up @@ -26,10 +26,11 @@ module app.guest.login {

class LoginInit {

static $inject = ['ngJwtAuthService', '$mdDialog'];
static $inject = ['ngJwtAuthService', '$mdDialog', '$timeout'];
constructor(
private ngJwtAuthService:NgJwtAuth.NgJwtAuthService,
private $mdDialog:ng.material.IDialogService
private $mdDialog:ng.material.IDialogService,
private $timeout:ng.ITimeoutService
) {

ngJwtAuthService
Expand All @@ -47,9 +48,8 @@ module app.guest.login {
}
};

return $mdDialog.show(dialogConfig)
.catch(() => deferredCredentials.reject()) //if the dialog closes without resolving, reject the credentials request
;
return $timeout(_.noop) //first do an empty timeout to allow the controllers to init if login prompt is fired from within a .run() phase
.then(() => $mdDialog.show(dialogConfig));

})
.init(); //initialise the auth service (kicks off the timers etc)
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Expand Up @@ -3,6 +3,8 @@ data:
image: spira/docker-data
volumes:
- /data:/data
environment:
- DATA_ROOT=/data #default DATA_ROOT environment value for the other containers to inherit from
privileged: true

db:
Expand Down Expand Up @@ -56,7 +58,9 @@ web:
- "80:80"
- "8080:8080"
environment:
- NGINX_VHOSTS=vhosts/nginx/*.local.conf
- DATA_ROOT=/data
- API_PATH=/api
- NGINX_VHOSTS=vhosts/nginx/*.local.conf
privileged: true

devtools:
Expand Down Expand Up @@ -84,5 +88,6 @@ lumen:
- db:db
- web:web
environment:
- DATA_ROOT=/data
- API_PATH=/api
- API_DOTENV=.local.env
6 changes: 3 additions & 3 deletions vhosts/nginx/spira-api.local.conf
Expand Up @@ -3,11 +3,11 @@ server {
listen 8080;
server_name local.api.spira.io;

root /data/api/public;
root %data-root%/api/public;
index index.php index.html index.htm;

access_log /data/logs/access-api.log;
error_log /data/logs/error-api.log warn;
access_log %data-root%/logs/access-api.log;
error_log %data-root%/logs/error-api.log warn;

location / {
try_files $uri $uri/ /index.php?$query_string;
Expand Down
6 changes: 3 additions & 3 deletions vhosts/nginx/spira-app.local.conf
Expand Up @@ -3,11 +3,11 @@ server {
listen 80;
server_name local.app.spira.io;

access_log /data/logs/access-app.log;
error_log /data/logs/error-app.log warn;
access_log %data-root%/logs/access-app.log;
error_log %data-root%/logs/error-app.log warn;

location / {
root /data/app/build;
root %data-root%/app/build;
index index.html;
try_files $uri $uri/ /index.html =404;
}
Expand Down

0 comments on commit ee92f9e

Please sign in to comment.