Skip to content

Commit

Permalink
Merged branch develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
prikril committed Jan 20, 2017
2 parents fb822bd + d1e6f4c commit e413308
Show file tree
Hide file tree
Showing 67 changed files with 2,196 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,11 @@ __pycache__/

### VisualStudio Patch ###
build/


### Meteor
node_modules/
.meteor/local
npm-debug.log
typings
.idea
16 changes: 16 additions & 0 deletions .meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.3.5-remove-old-dev-bundle-link
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
2 changes: 2 additions & 0 deletions .meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dev_bundle
local
7 changes: 7 additions & 0 deletions .meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

a4kqps1d5y31214lew0l
24 changes: 24 additions & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

meteor-base@1.0.4 # Packages every Meteor app needs to have
mobile-experience@1.0.4 # Packages for a great mobile UX
mongo@1.1.14 # The database Meteor supports right now
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.1.1 # Meteor's client-side reactive programming library

standard-minifier-css@1.3.2 # CSS minifier run for production mode
standard-minifier-js@1.2.1 # JS minifier run for production mode
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers.

autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
angular2-compilers
practicalmeteor:mocha
xolvio:cleaner
hwillson:stub-collections
dispatch:mocha-phantomjs
shell-server@0.2.1
2 changes: 2 additions & 0 deletions .meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server
browser
1 change: 1 addition & 0 deletions .meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
METEOR@1.4.2.3
90 changes: 90 additions & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
allow-deny@1.0.5
angular2-compilers@0.6.6
autopublish@1.0.7
autoupdate@1.3.12
babel-compiler@6.13.0
babel-runtime@1.0.1
barbatus:caching-compiler@1.1.9
barbatus:css-compiler@0.4.1
barbatus:scss-compiler@3.8.3
barbatus:typescript@0.6.2_3
barbatus:typescript-compiler@0.9.2_1
barbatus:typescript-runtime@1.0.0
base64@1.0.10
binary-heap@1.0.10
blaze@2.2.1
blaze-tools@1.0.10
boilerplate-generator@1.0.11
caching-compiler@1.1.9
caching-html-compiler@1.0.7
callback-hook@1.0.10
check@1.2.4
coffeescript@1.11.1_4
ddp@1.2.5
ddp-client@1.3.2
ddp-common@1.2.8
ddp-server@1.3.12
deps@1.0.12
diff-sequence@1.0.7
dispatch:mocha-phantomjs@0.1.9
dispatch:phantomjs-tests@0.0.7
ecmascript@0.6.1
ecmascript-runtime@0.3.15
ejson@1.0.13
es5-shim@4.6.15
fastclick@1.0.13
geojson-utils@1.0.10
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.2.10
hwillson:stub-collections@1.0.3
id-map@1.0.9
insecure@1.0.7
jquery@1.11.10
launch-screen@1.1.0
livedata@1.0.18
logging@1.1.16
meteor@1.6.0
meteor-base@1.0.4
minifier-css@1.2.15
minifier-js@1.2.15
minimongo@1.0.19
mobile-experience@1.0.4
mobile-status-bar@1.0.13
modules@0.7.7
modules-runtime@0.7.8
mongo@1.1.14
mongo-id@1.0.6
npm-mongo@2.2.16_1
observe-sequence@1.0.14
ordered-dict@1.0.9
practicalmeteor:chai@2.1.0_1
practicalmeteor:loglevel@1.2.0_2
practicalmeteor:mocha@2.4.5_6
practicalmeteor:mocha-core@1.0.1
practicalmeteor:sinon@1.14.1_2
promise@0.8.8
random@1.0.10
reactive-var@1.0.11
reload@1.1.11
retry@1.0.9
routepolicy@1.0.12
shell-server@0.2.1
spacebars@1.0.13
spacebars-compiler@1.0.13
standard-minifier-css@1.3.2
standard-minifier-js@1.2.1
templating@1.2.15
templating-compiler@1.2.15
templating-runtime@1.2.15
templating-tools@1.0.5
tmeasday:test-reporter-helpers@0.2.1
tracker@1.1.1
ui@1.0.12
underscore@1.0.10
urigo:static-html-compiler@0.1.8
url@1.0.11
webapp@1.3.12
webapp-hashing@1.0.9
xolvio:cleaner@0.3.1
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License
The MIT License (MIT)

Copyright (c) 2016 Dominik Prikril
Copyright (c) 2016 Uri Goldshtein

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
83 changes: 81 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
# ro-inf-sa
Software Architektur - Meteor
# Angular2-Meteor Boilerplate

[![bitHound Overall Score](https://www.bithound.io/github/bsliran/angular2-meteor-base/badges/score.svg)](https://www.bithound.io/github/bsliran/angular2-meteor-base) [![bitHound Dependencies](https://www.bithound.io/github/bsliran/angular2-meteor-base/badges/dependencies.svg)](https://www.bithound.io/github/bsliran/angular2-meteor-base/master/dependencies/npm)


## Usage

Since Meteor v1.4 you can use one command to create a working Angular2 app based on this boilerplate:

```
meteor create --example angular2-boilerplate
```

## NPM Scripts

This boilerplate comes with predefined NPM scripts, defined in `package.json`:

- `$ npm run start` - Run the Meteor application.
- `$ npm run start:prod` - Run the Meteor application in production mode.
- `$ npm run build` - Creates a Meteor build version under `./build/` directory.
- `$ npm run clear` - Resets Meteor's cache and clears the MongoDB collections.
- `$ npm run meteor:update` - Updates Meteor's version and it's dependencies.
- `$ npm run test` - Executes Meteor in test mode with Mocha.
- `$ npm run test:ci` - Executes Meteor in test mode with Mocha for CI (run once).

## Boilerplate Contents

This boilerplate contains the basics that requires to quick start with Angular2-Meteor application.

This package contains:

- TypeScript support (with `@types`) and Angular 2 compilers for Meteor
- Angular2-Meteor
- Angular 2 (core, common, compiler, platform, router, forms)
- SASS, LESS, CSS support (Also support styles encapsulation for Angular 2)
- Testing framework with Mocha and Chai
- [Meteor-RxJS](http://angular-meteor.com/meteor-rxjs/) support and usage

This application also contains demo code:

- Main Component (`/client/app.component`)
- Demo Child Component (`/client/imports/demo/demo.component`)
- Demo Service (`/client/imports/demo/demo-data.service`)
- Demo Mongo Collection (`/both/demo.collection.ts`) with a TypeScript interface as model.

The Main component loads the child component, which uses the demo service that gets it's data from the demo collection.

### Folder Structure

The folder structure is a mix between [Angular 2 recommendation](https://johnpapa.net/angular-2-styles/) and [Meteor 1.3 recommendation](https://guide.meteor.com/structure.html).

### Client

The `client` folder contains single TypeScript (`.ts`) file which is the main file (`/client/app.component.ts`), and bootstrap's the Angular 2 application.

The main component uses HTML template and SASS file.

The `index.html` file is the main HTML which loads the application by using the main component selector (`<app>`).

All the other client files are under `client/imports` and organized by the context of the components (in our example, the context is `demo`).


### Server

The `server` folder contain single TypeScript (`.ts`) file which is the main file (`/server/main.ts`), and creates the main server instance, and the starts it.

All other server files should be located under `/server/imports`.

### Common

Example for common files in our app, is the MongoDB collection we create - it located under `/both/demo-collection.ts` and it can be imported from both client and server code.

### Testing

The testing environment in this boilerplate based on [Meteor recommendation](https://guide.meteor.com/testing.html), and uses Mocha as testing framework along with Chai for assertion.

There is a main test file that initialize Angular 2 tests library, it located under `/client/init.test.ts`.

All other test files are located near the component/service it tests, with the `.test.ts` extension.

The `DemoComponent` contains example for Angular 2 tests for Component, and in the server side there is an example for testing Meteor collections and stub data.
4 changes: 4 additions & 0 deletions both/collections/game.collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MongoObservable } from "meteor-rxjs";
import {Game} from "../models/game.model";

export const GameCollection = new MongoObservable.Collection<Game>("game-collection");
4 changes: 4 additions & 0 deletions both/collections/gameResult.collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MongoObservable } from "meteor-rxjs";
import {GameResult} from "../models/gameResult.model";

export const GameResultCollection = new MongoObservable.Collection<GameResult>("gameResult-collection");
4 changes: 4 additions & 0 deletions both/collections/player.collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MongoObservable } from "meteor-rxjs";
import {Player} from "../models/player.model";

export const PlayerCollection = new MongoObservable.Collection<Player>("player-collection");
4 changes: 4 additions & 0 deletions both/collections/quiz.collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MongoObservable } from "meteor-rxjs";
import {Quiz} from "../models/quiz.model";

export const QuizCollection = new MongoObservable.Collection<Quiz>("quiz-collection");
5 changes: 5 additions & 0 deletions both/models/answer.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class Answer {
_id: string;
answer: string;
right: boolean;
}
17 changes: 17 additions & 0 deletions both/models/game.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {Player} from "./player.model";
import {Question} from "./question.model";
import {GivenAnswer} from "./givenAnswers.model";

export class Game {
_id: string;
quizId: string;
gameResultId : string;
gameNumber: string;
running: boolean;
showResult: boolean;
players: Player[];
currentQuestion : Question;
currentIndex : number;
timer : number;
questionStarted : number;
}
6 changes: 6 additions & 0 deletions both/models/gameResult.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {GivenAnswer} from "./givenAnswers.model";
export class GameResult{
_id : string;
quizId : string;
givenAnswers : {[questionNo : number] : GivenAnswer[]} = {};
}
6 changes: 6 additions & 0 deletions both/models/givenAnswers.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export class GivenAnswer {
playerId : string;
givenAnswer : number;
timeAnswered : number;
}
7 changes: 7 additions & 0 deletions both/models/player.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class Player {
_id: string;
gameId: string;
name: string;
playing: boolean;
score: number;
}
6 changes: 6 additions & 0 deletions both/models/question.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {Answer} from "./answer.model";

export class Question {
question: string;
answers: Answer[];
}
7 changes: 7 additions & 0 deletions both/models/quiz.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {Question} from "./question.model";

export class Quiz {
_id: string;
name: string;
questions: Question[];
}
27 changes: 27 additions & 0 deletions client/imports/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--<md-sidenav-layout>
<md-sidenav #sidenav mode="side" class="app-sidenav">
<md-list>
<md-list-item> <a routerLink="/list">List</a> </md-list-item>
<md-list-item> <a routerLink="/master/create">Create</a> </md-list-item>
<md-list-item> <a routerLink="/master/manage">Manage</a> </md-list-item>
<md-list-item> <a routerLink="/master/start">Start</a> </md-list-item>
</md-list>
</md-sidenav>-->


<md-toolbar color="primary">
<!--<button class="app-icon-button" (click)="sidenav.toggle()">
<i class="material-icons app-toolbar-menu">menu</i>
</button>-->
<ul>
<li><a routerLink="/" class="toolbar-title">Quizza</a></li>
</ul>
<span class="fill-remaining-space"></span>
</md-toolbar>


<div class="app-content">
<router-outlet></router-outlet>
</div>
</md-sidenav-layout>

Loading

0 comments on commit e413308

Please sign in to comment.