diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index 29bd102d..00000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-# Java Gradle CircleCI 2.0 configuration file
-#
-# Check https://circleci.com/docs/2.0/language-java/ for more details
-#
-version: 2 jobs:
- build:
- docker:
- - image: circleci/openjdk:8-jdk
-
- # Specify service dependencies here if necessary CircleCI maintains a library of pre-built images documented at
- # https://circleci.com/docs/2.0/circleci-images/ - image: circleci/postgres:9.4
- working_directory: ~/repo
- environment:
- # Customize the JVM maximum heap limit
- JVM_OPTS: -Xmx3200m
- TERM: dumb
-
- steps:
- - checkout
- # Download and cache dependencies
- - restore_cache:
- keys:
- - v1-dependencies-{{ checksum "build.gradle" }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
- - run: gradle dependencies
- - save_cache:
- paths:
- - ~/.gradle
- key: v1-dependencies-{{ checksum "build.gradle" }}
- - run: gradle test
diff --git a/.teamcity/ghost/buildTypes/ghost_Build.xml b/.teamcity/ghost/buildTypes/ghost_Build.xml
deleted file mode 100644
index 393154fc..00000000
--- a/.teamcity/ghost/buildTypes/ghost_Build.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
- Build
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.teamcity/ghost/pluginData/plugin-settings.xml b/.teamcity/ghost/pluginData/plugin-settings.xml
deleted file mode 100644
index d878f5e3..00000000
--- a/.teamcity/ghost/pluginData/plugin-settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/.teamcity/ghost/project-config.xml b/.teamcity/ghost/project-config.xml
deleted file mode 100644
index 6a5150ce..00000000
--- a/.teamcity/ghost/project-config.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- Project Ghost
-
-
-
-
diff --git a/.teamcity/ghost/vcsRoots/ghost_GitGithubComHypereddieGhostShadowWarriorPhantomAssaultDxGit.xml b/.teamcity/ghost/vcsRoots/ghost_GitGithubComHypereddieGhostShadowWarriorPhantomAssaultDxGit.xml
deleted file mode 100644
index 2e8f2497..00000000
--- a/.teamcity/ghost/vcsRoots/ghost_GitGithubComHypereddieGhostShadowWarriorPhantomAssaultDxGit.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- git@github.com:hypereddie/Ghost-Shadow-Warrior-Phantom-Assault-DX.git
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 2e165782..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: java
-notifications:
- slack:
- rooms:
- - boxtrot:R4WyxWpMcn0II3WAdWNxnYVw#ghost
- on_success: change
- on_failure: always
diff --git a/admin-panel/README.md b/admin-panel/README.md
deleted file mode 100755
index 935f7bdc..00000000
--- a/admin-panel/README.md
+++ /dev/null
@@ -1,88 +0,0 @@
-# Project Ghost Admin Panel
-An admin panel to manage the matchmaking server live
-
-# Quick start
-
-The only development dependency of this project is Node.js. So just make sure you have it installed.
-
-1. Clone/download this repository.
-2. Install dependencies with `npm install` (it will also download NW.js runtime).
-3. Run `npm start` to launch the application.
-
-# Structure of the project
-
-### Project's folders
-
-- `app` - code of your admin panel.
-- `build` - compiled, runnable application.
-- `nw` - downloaded NW.js binaries.
-- `os` - files specific for particular operating system.
-- `releases` - ready to distribute installers will land here.
-- `tasks` - build and development environment scripts.
-
-
-# Development
-
-#### Installation
-
-```
-npm install
-```
-It will also download NW runtime, and install dependencies for `package.json` inside `app` folder.
-
-#### Starting the app
-
-```
-npm start
-```
-
-#### Module loader
-
-How about splitting your JavaScript code into modules? This project uses [es6-module-transpiler](https://github.com/esnext/es6-module-transpiler) for that. It translates new ES6 syntax (which is very cool) into AMD (RequireJS) modules. The main advantage of this setup is that we can use ES6/RequireJS for modules authored by us, and at the same time have normal access to node's `require()` to obtain stuff from npm.
-```javascript
-// Browser modules are required through new ES6 syntax.
-// It will be translated into AMD definition.
-import foo1 from './foo';
-// Node.js (npm) modules are required the same way as always.
-var foo2 = require('foo');
-```
-
-#### Helper scripts
-
-There are helper scripts in `app/vendor/nwbp` folder. Those are scripts with convenient hooks wou will need anyway (like window size and position preservation). Just browse this folder to see what you get.
-
-#### Unit tests
-
-Comes with a preconfigured unit test runner ([jasmine](http://jasmine.github.io/2.0/introduction.html)). To run it go with standard:
-```
-npm test
-```
-You don't have to declare paths to spec files in any particular place. The runner will search through the project for all `*.spec.js` files and include them automatically.
-
-
-# Making a release
-
-There are various icon and bitmap files in `os` directory. They are used in installers. Replace them with your own of the same size and file type (if bmp is used, it has to be bmp format).
-
-To make a release use command:
-```
-npm run release
-```
-It will start the packaging process for operating system you are running this command on. Ready for distribution file will be outputted to `releases` directory.
-
-You can create Windows installer only when running on Windows, the same is true for Linux and OSX. So to generate all three installers you need all three operating systems.
-
-
-# Precautions for particular operating system
-
-## Windows
-As installer [NSIS](http://nsis.sourceforge.net/Main_Page) is used. You have to install it (version 3.0), and add NSIS folder to PATH in Environment Variables (so it is reachable to scripts in this project). You know, path should look something like `C:/Program Files (x86)/NSIS`.
-
-## Linux
-This project requires for node.js to be reachable under `node` name in command line. For example by default in Ubuntu it is `nodejs`, so you should manually add alias to `node`.
-
-For now only deb packaging is supported. It should work on any Linux distribution from debian family (but was tested only on Ubuntu).
-
-## OSX
-This project uses [appdmg](https://github.com/LinusU/node-appdmg) for creating pretty dmg images. While installing this library it could ask you for some additional development libraries on what you have to agree.
-**BTW** installation of this library fails on other operating systems (Windows and Linux) when you type `npm install`. No worries, it's needed only on OSX.
\ No newline at end of file
diff --git a/admin-panel/app/index.html b/admin-panel/app/index.html
deleted file mode 100755
index 6c37a658..00000000
--- a/admin-panel/app/index.html
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Project Ghost Thing
-
-
-
-
-
-
-
-
-
Players Online
-
-
-
-
-
-
-
-
-
As they say in Latin: 'Carpe yolo'
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/admin-panel/app/package.json b/admin-panel/app/package.json
deleted file mode 100755
index 459ba0c0..00000000
--- a/admin-panel/app/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "Launcher",
- "prettyName": "Launcher for Game",
- "description": "Is a launcher for the game",
- "main": "index.html",
- "window": {
- "icon": "icon.png",
- "show": true,
- "toolbar": true,
- "frame": true,
- "width": 800,
- "height": 500,
- "position": "center",
- "resizable": false
- },
- "single-instance": false,
- "version": "0.0.1a",
- "dependencies": {
- }
-}
diff --git a/admin-panel/app/stylesheets/main.less b/admin-panel/app/stylesheets/main.less
deleted file mode 100755
index da9d2246..00000000
--- a/admin-panel/app/stylesheets/main.less
+++ /dev/null
@@ -1,155 +0,0 @@
-html, body {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
-
- -webkit-user-select: none;
-}
-
-ul {
- list-style: none;
-}
-
-h6 {
- background: #232323;
- color: white;
-}
-
-body {
- background: #232323;
- color: white;
- display: flex;
-}
-
-a {
- text-decoration: none;
-}
-
-.ghostBtn {
- border-radius: 8px;
- height: 38px;
- font-size: 15px;
- line-height: 5px;
-}
-
-.loginBtn {
- background-color: #579457;
- border-color: #366d36;
- color: #fff;
-}
-
-.loginBtn:hover, .loginBtn:focus {
- background-color: #459D45;
-}
-
-.spacer-95 {
- height: 95%;
-}
-
-.signupBtn {
- background-color: #3277A8;
- border-color: #225274;
- color: #fff;
-}
-
-.signupBtn:hover, .signupBtn:focus {
- background-color: #3783B8;
-}
-
-.ghostDialog {
- background-color: #232323;
- color: #fff;
- width: 100%;
- height: 25%;
- margin-top: 10%;
- max-width: initial;
-
- h1, h2, h3, h4, h5 {
- color: #fff;
- }
-
- p {
- color: #909090;
- }
-}
-
-.frame {
- .frame-heading {
- background: #576573;
- }
-
- .frame-footer {
- background: transparent;
- }
-}
-
-.reveal-modal-bg {
- background: rgba(255, 255, 255, 0.45);
-}
-
-input[type=text], input[type=password],
-input[type=text]:focus, input[type=password]:focus,
-input[type=email], input[type=email]:focus,
-textarea, textarea:focus {
- background-color: #232323;
- color: #fff;
-}
-
-.frame {
- width: 100%;
- height: 100%;
- overflow: hidden;
- position: relative;
-
- .frame-heading {
- position:absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 40px;
-
- -webkit-app-region: drag;
-
- .title {
- padding: 8px;
- display: inline-block;
- }
-
- .window-actions {
- display: inline-block;
- margin: 0 5px;
- height: 100%;
- padding: 8px;
- }
- }
-
- .frame-body {
- position: absolute;
- top: 40px;
- left: 0;
- right: 0;
- bottom: 30px;
-
- padding: 8px;
- }
-
- .frame-footer {
- padding: 3px 8px;
- height: 30px;
-
- z-index: 3;
- position:absolute;
- bottom: 0;
- left: 0;
- right: 0;
- }
-}
-
-/* We making our own font icon (sort of) */
-.fa-minimize {
- vertical-align: bottom;
- &::before {
- content: "\f068"; // fa-minus alias
- }
-}
\ No newline at end of file
diff --git a/admin-panel/app/stylesheets/menu.less b/admin-panel/app/stylesheets/menu.less
deleted file mode 100755
index 7dd1f0ef..00000000
--- a/admin-panel/app/stylesheets/menu.less
+++ /dev/null
@@ -1,151 +0,0 @@
-.tabs.vertical {
- top: 40px;
- width: 22%;
- right: 0;
- bottom: 0;
- position: fixed;
- max-width: 22%;
-
- .tab-title {
- position: relative;
-
- a, a:hover, a:focus {
- background-color: #1f1f1f;
- color: #fff;
- border: 1px solid #393939;
- height: 80px;
- line-height: 48px;
- font-size: 24px;
- font-family: Segoe UI Semibold;
- -webkit-transition: margin-left 0.2s, height 0.2s, font-size 0.2s, line-height 0.2s, -webkit-transform 0.2s;
- transition: margin-left 0.2s, height 0.2s, font-size 0.2s, line-height 0.2s, transform 0.2s
- }
- }
-
- .tab-title.active {
- a, a:hover, a:focus {
- margin-left: -55px;
- background-color: #1f1f1f;
- color: #fff;
- height: 100px;
- line-height: 60px;
- font-size: 28px;
- }
- }
-}
-
-h1 {
- color: white;
- font-size: 26px;
-}
-
-.tabs-content {
- width: 79%;
-}
-
-.playBtn {
- background-color: #579457;
- border-color: #366d36;
- color: #fff;
- margin-top: 30%;
-}
-
-.playBtn:hover, .playBtn:focus {
- background-color: #459D45;
-}
-
-.loginLoading {
- background-color: #232323;
- color: #fff;
- width: 100%;
- height: 50%;
-
- h2 {
- color: #fff;
- }
-
- .loginLoader {
- position: absolute;
- left: 45%;
-
- .spinner1 {
- width: 80px;
- height: 80px;
- border: 2px solid #4876A5;
- border-bottom-color: transparent;
- border-top-color: transparent;
- }
-
- .spinner2 {
- width: 34px;
- height: 34px;
- left: 22px;
- top: 22px;
- border: 2px solid #4876A5;
- border-bottom-color: transparent;
- border-top-color: transparent;
- }
- }
-}
-
-#server-list {
- width: 615px;
- height: 399px;
- overflow: auto;
-}
-
-.server {
- padding-right: 150px;
- padding-top: 6px;
- background-color: rgba(27, 27, 27, 1);;
- box-shadow: 0 2px 5px 0 #121212;
- margin-bottom: 30px;
-
- .power {
- font-size: 48px;
- text-align: center;
- display: inline-block;
- width: 100%;
- padding-top: 31px;
-
- &.offline {
- color: #A3A3A3;
- }
-
- &.test {
- color: #673AB7;
- }
-
- &.alpha {
- color: #2196F3;
- }
-
- &.beta {
- color: #009688;
- }
-
- &.buffered {
- color: #FFEB3B;
- }
-
- &.live {
- color: #4CAF50;
- }
- }
-
- .more {
- font-size: 20px;
- padding-top: 0;
- margin-left: 60px;
- text-align: center;
- display: inline;
- width: 100%;
- }
-
- p {
- margin-bottom: 4px;
- width: 180px;
- }
-}
-
-
diff --git a/admin-panel/app/vendor/jasmine/boot.js b/admin-panel/app/vendor/jasmine/boot.js
deleted file mode 100755
index e8ddd551..00000000
--- a/admin-panel/app/vendor/jasmine/boot.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
-
- If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
-
- The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
-
- [jasmine-gem]: http://github.com/pivotal/jasmine-gem
- */
-
-(function() {
-
- /**
- * ## Require & Instantiate
- *
- * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
- */
- window.jasmine = jasmineRequire.core(jasmineRequire);
-
- /**
- * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
- */
- jasmineRequire.html(jasmine);
-
- /**
- * Create the Jasmine environment. This is used to run all specs in a project.
- */
- var env = jasmine.getEnv();
-
- /**
- * ## The Global Interface
- *
- * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
- */
- var jasmineInterface = jasmineRequire.interface(jasmine, env);
-
- /**
- * Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
- */
- if (typeof window == "undefined" && typeof exports == "object") {
- extend(exports, jasmineInterface);
- } else {
- extend(window, jasmineInterface);
- }
-
- /**
- * ## Runner Parameters
- *
- * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
- */
-
- var queryString = new jasmine.QueryString({
- getWindowLocation: function() { return window.location; }
- });
-
- var catchingExceptions = queryString.getParam("catch");
- env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
-
- /**
- * ## Reporters
- * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
- */
- var htmlReporter = new jasmine.HtmlReporter({
- env: env,
- onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
- addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
- getContainer: function() { return document.body; },
- createElement: function() { return document.createElement.apply(document, arguments); },
- createTextNode: function() { return document.createTextNode.apply(document, arguments); },
- timer: new jasmine.Timer()
- });
-
- /**
- * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
- */
- env.addReporter(jasmineInterface.jsApiReporter);
- env.addReporter(htmlReporter);
-
- /**
- * Filter which specs will be run by matching the start of the full name against the `spec` query param.
- */
- var specFilter = new jasmine.HtmlSpecFilter({
- filterString: function() { return queryString.getParam("spec"); }
- });
-
- env.specFilter = function(spec) {
- return specFilter.matches(spec.getFullName());
- };
-
- /**
- * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
- */
- window.setTimeout = window.setTimeout;
- window.setInterval = window.setInterval;
- window.clearTimeout = window.clearTimeout;
- window.clearInterval = window.clearInterval;
-
- /**
- * ## Execution
- *
- * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
- */
- var currentWindowOnload = window.onload;
-
- window.onload = function() {
- if (currentWindowOnload) {
- currentWindowOnload();
- }
- htmlReporter.initialize();
- env.execute();
- };
-
- /**
- * Helper function for readability above.
- */
- function extend(destination, source) {
- for (var property in source) destination[property] = source[property];
- return destination;
- }
-
-}());
diff --git a/admin-panel/app/vendor/jasmine/jasmine-html.js b/admin-panel/app/vendor/jasmine/jasmine-html.js
deleted file mode 100755
index bee5a04f..00000000
--- a/admin-panel/app/vendor/jasmine/jasmine-html.js
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
-Copyright (c) 2008-2015 Pivotal Labs
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-jasmineRequire.html = function(j$) {
- j$.ResultsNode = jasmineRequire.ResultsNode();
- j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
- j$.QueryString = jasmineRequire.QueryString();
- j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
-};
-
-jasmineRequire.HtmlReporter = function(j$) {
-
- var noopTimer = {
- start: function() {},
- elapsed: function() { return 0; }
- };
-
- function HtmlReporter(options) {
- var env = options.env || {},
- getContainer = options.getContainer,
- createElement = options.createElement,
- createTextNode = options.createTextNode,
- onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
- addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
- timer = options.timer || noopTimer,
- results = [],
- specsExecuted = 0,
- failureCount = 0,
- pendingSpecCount = 0,
- htmlReporterMain,
- symbols,
- failedSuites = [];
-
- this.initialize = function() {
- clearPrior();
- htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
- createDom('div', {className: 'banner'},
- createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
- createDom('span', {className: 'version'}, j$.version)
- ),
- createDom('ul', {className: 'symbol-summary'}),
- createDom('div', {className: 'alert'}),
- createDom('div', {className: 'results'},
- createDom('div', {className: 'failures'})
- )
- );
- getContainer().appendChild(htmlReporterMain);
-
- symbols = find('.symbol-summary');
- };
-
- var totalSpecsDefined;
- this.jasmineStarted = function(options) {
- totalSpecsDefined = options.totalSpecsDefined || 0;
- timer.start();
- };
-
- var summary = createDom('div', {className: 'summary'});
-
- var topResults = new j$.ResultsNode({}, '', null),
- currentParent = topResults;
-
- this.suiteStarted = function(result) {
- currentParent.addChild(result, 'suite');
- currentParent = currentParent.last();
- };
-
- this.suiteDone = function(result) {
- if (result.status == 'failed') {
- failedSuites.push(result);
- }
-
- if (currentParent == topResults) {
- return;
- }
-
- currentParent = currentParent.parent;
- };
-
- this.specStarted = function(result) {
- currentParent.addChild(result, 'spec');
- };
-
- var failures = [];
- this.specDone = function(result) {
- if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
- console.error('Spec \'' + result.fullName + '\' has no expectations.');
- }
-
- if (result.status != 'disabled') {
- specsExecuted++;
- }
-
- symbols.appendChild(createDom('li', {
- className: noExpectations(result) ? 'empty' : result.status,
- id: 'spec_' + result.id,
- title: result.fullName
- }
- ));
-
- if (result.status == 'failed') {
- failureCount++;
-
- var failure =
- createDom('div', {className: 'spec-detail failed'},
- createDom('div', {className: 'description'},
- createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
- ),
- createDom('div', {className: 'messages'})
- );
- var messages = failure.childNodes[1];
-
- for (var i = 0; i < result.failedExpectations.length; i++) {
- var expectation = result.failedExpectations[i];
- messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
- messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
- }
-
- failures.push(failure);
- }
-
- if (result.status == 'pending') {
- pendingSpecCount++;
- }
- };
-
- this.jasmineDone = function() {
- var banner = find('.banner');
- banner.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
-
- var alert = find('.alert');
-
- alert.appendChild(createDom('span', { className: 'exceptions' },
- createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
- createDom('input', {
- className: 'raise',
- id: 'raise-exceptions',
- type: 'checkbox'
- })
- ));
- var checkbox = find('#raise-exceptions');
-
- checkbox.checked = !env.catchingExceptions();
- checkbox.onclick = onRaiseExceptionsClick;
-
- if (specsExecuted < totalSpecsDefined) {
- var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
- alert.appendChild(
- createDom('span', {className: 'bar skipped'},
- createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
- )
- );
- }
- var statusBarMessage = '';
- var statusBarClassName = 'bar ';
-
- if (totalSpecsDefined > 0) {
- statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
- if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
- statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
- } else {
- statusBarClassName += 'skipped';
- statusBarMessage += 'No specs found';
- }
-
- alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
-
- for(i = 0; i < failedSuites.length; i++) {
- var failedSuite = failedSuites[i];
- for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
- var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
- var errorBarClassName = 'bar errored';
- alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
- }
- }
-
- var results = find('.results');
- results.appendChild(summary);
-
- summaryList(topResults, summary);
-
- function summaryList(resultsTree, domParent) {
- var specListNode;
- for (var i = 0; i < resultsTree.children.length; i++) {
- var resultNode = resultsTree.children[i];
- if (resultNode.type == 'suite') {
- var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
- createDom('li', {className: 'suite-detail'},
- createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
- )
- );
-
- summaryList(resultNode, suiteListNode);
- domParent.appendChild(suiteListNode);
- }
- if (resultNode.type == 'spec') {
- if (domParent.getAttribute('class') != 'specs') {
- specListNode = createDom('ul', {className: 'specs'});
- domParent.appendChild(specListNode);
- }
- var specDescription = resultNode.result.description;
- if(noExpectations(resultNode.result)) {
- specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
- }
- if(resultNode.result.status === 'pending' && resultNode.result.pendingReason !== '') {
- specDescription = specDescription + ' PENDING WITH MESSAGE: ' + resultNode.result.pendingReason;
- }
- specListNode.appendChild(
- createDom('li', {
- className: resultNode.result.status,
- id: 'spec-' + resultNode.result.id
- },
- createDom('a', {href: specHref(resultNode.result)}, specDescription)
- )
- );
- }
- }
- }
-
- if (failures.length) {
- alert.appendChild(
- createDom('span', {className: 'menu bar spec-list'},
- createDom('span', {}, 'Spec List | '),
- createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
- alert.appendChild(
- createDom('span', {className: 'menu bar failure-list'},
- createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
- createDom('span', {}, ' | Failures ')));
-
- find('.failures-menu').onclick = function() {
- setMenuModeTo('failure-list');
- };
- find('.spec-list-menu').onclick = function() {
- setMenuModeTo('spec-list');
- };
-
- setMenuModeTo('failure-list');
-
- var failureNode = find('.failures');
- for (var i = 0; i < failures.length; i++) {
- failureNode.appendChild(failures[i]);
- }
- }
- };
-
- return this;
-
- function find(selector) {
- return getContainer().querySelector('.jasmine_html-reporter ' + selector);
- }
-
- function clearPrior() {
- // return the reporter
- var oldReporter = find('');
-
- if(oldReporter) {
- getContainer().removeChild(oldReporter);
- }
- }
-
- function createDom(type, attrs, childrenVarArgs) {
- var el = createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(createTextNode(child));
- } else {
- if (child) {
- el.appendChild(child);
- }
- }
- }
-
- for (var attr in attrs) {
- if (attr == 'className') {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
- }
-
- function pluralize(singular, count) {
- var word = (count == 1 ? singular : singular + 's');
-
- return '' + count + ' ' + word;
- }
-
- function specHref(result) {
- return addToExistingQueryString('spec', result.fullName);
- }
-
- function defaultQueryString(key, value) {
- return '?' + key + '=' + value;
- }
-
- function setMenuModeTo(mode) {
- htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
- }
-
- function noExpectations(result) {
- return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
- result.status === 'passed';
- }
- }
-
- return HtmlReporter;
-};
-
-jasmineRequire.HtmlSpecFilter = function() {
- function HtmlSpecFilter(options) {
- var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
- var filterPattern = new RegExp(filterString);
-
- this.matches = function(specName) {
- return filterPattern.test(specName);
- };
- }
-
- return HtmlSpecFilter;
-};
-
-jasmineRequire.ResultsNode = function() {
- function ResultsNode(result, type, parent) {
- this.result = result;
- this.type = type;
- this.parent = parent;
-
- this.children = [];
-
- this.addChild = function(result, type) {
- this.children.push(new ResultsNode(result, type, this));
- };
-
- this.last = function() {
- return this.children[this.children.length - 1];
- };
- }
-
- return ResultsNode;
-};
-
-jasmineRequire.QueryString = function() {
- function QueryString(options) {
-
- this.navigateWithNewParam = function(key, value) {
- options.getWindowLocation().search = this.fullStringWithNewParam(key, value);
- };
-
- this.fullStringWithNewParam = function(key, value) {
- var paramMap = queryStringToParamMap();
- paramMap[key] = value;
- return toQueryString(paramMap);
- };
-
- this.getParam = function(key) {
- return queryStringToParamMap()[key];
- };
-
- return this;
-
- function toQueryString(paramMap) {
- var qStrPairs = [];
- for (var prop in paramMap) {
- qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
- }
- return '?' + qStrPairs.join('&');
- }
-
- function queryStringToParamMap() {
- var paramStr = options.getWindowLocation().search.substring(1),
- params = [],
- paramMap = {};
-
- if (paramStr.length > 0) {
- params = paramStr.split('&');
- for (var i = 0; i < params.length; i++) {
- var p = params[i].split('=');
- var value = decodeURIComponent(p[1]);
- if (value === 'true' || value === 'false') {
- value = JSON.parse(value);
- }
- paramMap[decodeURIComponent(p[0])] = value;
- }
- }
-
- return paramMap;
- }
-
- }
-
- return QueryString;
-};
diff --git a/admin-panel/app/vendor/jasmine/jasmine.css b/admin-panel/app/vendor/jasmine/jasmine.css
deleted file mode 100755
index ecc5f5e7..00000000
--- a/admin-panel/app/vendor/jasmine/jasmine.css
+++ /dev/null
@@ -1,62 +0,0 @@
-body { overflow-y: scroll; }
-
-.jasmine_html-reporter { background-color: #eee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333; }
-.jasmine_html-reporter a { text-decoration: none; }
-.jasmine_html-reporter a:hover { text-decoration: underline; }
-.jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; }
-.jasmine_html-reporter .banner, .jasmine_html-reporter .symbol-summary, .jasmine_html-reporter .summary, .jasmine_html-reporter .result-message, .jasmine_html-reporter .spec .description, .jasmine_html-reporter .spec-detail .description, .jasmine_html-reporter .alert .bar, .jasmine_html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; }
-.jasmine_html-reporter .banner { position: relative; }
-.jasmine_html-reporter .banner .title { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAZCAMAAACGusnyAAACdlBMVEX/////AP+AgICqVaqAQICZM5mAVYCSSZKAQICOOY6ATYCLRouAQICJO4mSSYCIRIiPQICHPIeOR4CGQ4aMQICGPYaLRoCFQ4WKQICPPYWJRYCOQoSJQICNPoSIRICMQoSHQICHRICKQoOHQICKPoOJO4OJQYOMQICMQ4CIQYKLQICIPoKLQ4CKQICNPoKJQISMQ4KJQoSLQYKJQISLQ4KIQoSKQYKIQICIQISMQoSKQYKLQIOLQoOJQYGLQIOKQIOMQoGKQYOLQYGKQIOLQoGJQYOJQIOKQYGJQIOKQoGKQIGLQIKLQ4KKQoGLQYKJQIGKQYKJQIGKQIKJQoGKQYKLQIGKQYKLQIOJQoKKQoOJQYKKQIOJQoKKQoOKQIOLQoKKQYOLQYKJQIOKQoKKQYKKQoKJQYOKQYKLQIOKQoKLQYOKQYKLQIOJQoGKQYKJQYGJQoGKQYKLQoGLQYGKQoGJQYKKQYGJQIKKQoGJQYKLQIKKQYGLQYKKQYGKQYGKQYKJQYOKQoKJQYOKQYKLQYOLQYOKQYKLQYOKQoKKQYKKQYOKQYOJQYKKQYKLQYKKQIKKQoKKQYKKQYKKQoKJQIKKQYKLQYKKQYKKQIKKQYKKQYKKQYKKQIKKQYKJQYGLQYGKQYKKQYKKQYGKQIKKQYGKQYOJQoKKQYOLQYKKQYOKQoKKQYKKQoKKQYKKQYKJQYKLQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKJQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKLQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKKQYKmIDpEAAAA0XRSTlMAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAiIyQlJycoKissLS4wMTQ1Njc4OTo7PDw+P0BCQ0RISUpLTE1OUFNUVVdYWFlaW15fYGFiY2ZnaGlqa2xtb3BxcnN0dnh5ent8fX5/gIGChIWIioyNjo+QkZOUlZaYmZqbnJ2eoKGio6WmqKmsra6vsLGztre4ubq7vL2+wMHDxMjJysvNzs/Q0dLU1tfY2dvc3t/g4eLj5ebn6Onq6+zt7u/w8vP09fb3+Pn6+/z9/vkVQXAAAAMaSURBVHhe5dXxV1N1GMfxz2ABbDgIAm5VDJOyVDIJLUMaVpBWUZUaGbmqoGpZRSiGiRWp6KoZ5AB0ZY50RImZQIlahKkMYXv/R90dBvET/rJfOr3Ouc8v99zPec59zvf56j+vYKlViSf7250X4Mr3O29Tgq08BdGB4DhcekEJ5YkQKFsgWZdtj9JpV+I8xPjLFqkrsEIqO8PHSpis36jWazcqjEsfJjkvRssVU37SdIOu4XCf5vEJPsnwJpnRNU9JmxhMk8l1gehIrq7hTFjzOD+Vf88629qKMJVNltInFeRexRQyJlNeqd1iGDlSzrIUIyXbyFfm3RYprcQRe7lqtWyGYbfc6dT0R2vmdOOkX3u55C1rP37ftiH+tDby4r/RBT0w8TyEkr+epB9XgPDmSYYWbrhCuFYaIyw3fDQAXTnSkh+ANofiHmWf9l+FY1I90FdQTetstO00o23novzVsJ7uB3/C5TkbjRwZ5JerwV4iRWq9HFbFMaK/d0TYqayRiQPuIxxS3Bu8JWU90/60tKi7vkhaznez0a/TbVOKj5CaOZh6fWG6/Lyv9B/ZLR1gw/S/fpbeVD3MCW1li6SvWDOn65tr99/uvWtBS0XDm4s1t+sOHpG0kpBKx/l77wOSnxLpcx6TXmXLTPQOKYOf9Q1dfr8/SJ2mFdCvl1Yl93DiHUZvXeLJbGSzYu5gVJ2slbSakOR8dxCq5adQ2oFLqsE9Ex3L4qQO0eOPeU5x56bypXp4onSEb5OkICX6lDat55TeoztNKQcJaakrz9KCb95oD69IKq+yKW4XPjknaS52V0TZqE2cTtXjcHSCRmUO88e+85hj3EP74i9p8pylw7lxgMDyyl6OV7ZejnjNMfatu87LxRbH0IS35gt2a4ZjmGpVBdKK3Wr6INk8jWWSGqbA55CKgjBRC6E9w78ydTg3ABS3AFV1QN0Y4Aa2pgEjWnQURj9L0ayK6R2ysEqxHUKzYnLvvyU+i9KM2JHJzE4vyZOyDcOwOsySajeLPc8sNvPJkFlyJd20wpqAzZeAfZ3oWybxd+P/3j+SG3uSBdf2VQAAAABJRU5ErkJggg==') no-repeat; background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICB3aWR0aD0iNjgxLjk2MjUyIgogICBoZWlnaHQ9IjE4Ny41IgogICBpZD0ic3ZnMiIKICAgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhOCI+PHJkZjpSREY+PGNjOldvcmsKICAgICAgICAgcmRmOmFib3V0PSIiPjxkYzpmb3JtYXQ+aW1hZ2Uvc3ZnK3htbDwvZGM6Zm9ybWF0PjxkYzp0eXBlCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz48L2NjOldvcms+PC9yZGY6UkRGPjwvbWV0YWRhdGE+PGRlZnMKICAgICBpZD0iZGVmczYiPjxjbGlwUGF0aAogICAgICAgaWQ9ImNsaXBQYXRoMTgiPjxwYXRoCiAgICAgICAgIGQ9Ik0gMCwxNTAwIDAsMCBsIDU0NTUuNzQsMCAwLDE1MDAgTCAwLDE1MDAgeiIKICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgaWQ9InBhdGgyMCIgLz48L2NsaXBQYXRoPjwvZGVmcz48ZwogICAgIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUsMCwwLC0xLjI1LDAsMTg3LjUpIgogICAgIGlkPSJnMTAiPjxnCiAgICAgICB0cmFuc2Zvcm09InNjYWxlKDAuMSwwLjEpIgogICAgICAgaWQ9ImcxMiI+PGcKICAgICAgICAgaWQ9ImcxNCI+PGcKICAgICAgICAgICBjbGlwLXBhdGg9InVybCgjY2xpcFBhdGgxOCkiCiAgICAgICAgICAgaWQ9ImcxNiI+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMTU0NCw1OTkuNDM0IGMgMC45MiwtNDAuMzUyIDI1LjY4LC04MS42MDIgNzEuNTMsLTgxLjYwMiAyNy41MSwwIDQ3LjY4LDEyLjgzMiA2MS40NCwzNS43NTQgMTIuODMsMjIuOTMgMTIuODMsNTYuODUyIDEyLjgzLDgyLjUyNyBsIDAsMzI5LjE4NCAtNzEuNTIsMCAwLDEwNC41NDMgMjY2LjgzLDAgMCwtMTA0LjU0MyAtNzAuNiwwIDAsLTM0NC43NyBjIDAsLTU4LjY5MSAtMy42OCwtMTA0LjUzMSAtNDQuOTMsLTE1Mi4yMTggLTM2LjY4LC00Mi4xOCAtOTYuMjgsLTY2LjAyIC0xNTMuMTQsLTY2LjAyIC0xMTcuMzcsMCAtMjA3LjI0LDc3Ljk0MSAtMjAyLjY0LDE5Ny4xNDUgbCAxMzAuMiwwIgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMjIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDIzMDEuNCw2NjIuNjk1IGMgMCw4MC43MDMgLTY2Ljk0LDE0NS44MTMgLTE0Ny42MywxNDUuODEzIC04My40NCwwIC0xNDcuNjMsLTY4Ljc4MSAtMTQ3LjYzLC0xNTEuMzAxIDAsLTc5Ljc4NSA2Ni45NCwtMTQ1LjgwMSAxNDUuOCwtMTQ1LjgwMSA4NC4zNSwwIDE0OS40Niw2Ny44NTIgMTQ5LjQ2LDE1MS4yODkgeiBtIC0xLjgzLC0xODEuNTQ3IGMgLTM1Ljc3LC01NC4wOTcgLTkzLjUzLC03OC44NTkgLTE1Ny43MiwtNzguODU5IC0xNDAuMywwIC0yNTEuMjQsMTE2LjQ0OSAtMjUxLjI0LDI1NC45MTggMCwxNDIuMTI5IDExMy43LDI2MC40MSAyNTYuNzQsMjYwLjQxIDYzLjI3LDAgMTE4LjI5LC0yOS4zMzYgMTUyLjIyLC04Mi41MjMgbCAwLDY5LjY4NyAxNzUuMTQsMCAwLC0xMDQuNTI3IC02MS40NCwwIDAsLTI4MC41OTggNjEuNDQsMCAwLC0xMDQuNTI3IC0xNzUuMTQsMCAwLDY2LjAxOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDI0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSAyNjIyLjMzLDU1Ny4yNTggYyAzLjY3LC00NC4wMTYgMzMuMDEsLTczLjM0OCA3OC44NiwtNzMuMzQ4IDMzLjkzLDAgNjYuOTMsMjMuODI0IDY2LjkzLDYwLjUwNCAwLDQ4LjYwNiAtNDUuODQsNTYuODU2IC04My40NCw2Ni45NDEgLTg1LjI4LDIyLjAwNCAtMTc4LjgxLDQ4LjYwNiAtMTc4LjgxLDE1NS44NzkgMCw5My41MzYgNzguODYsMTQ3LjYzMyAxNjUuOTgsMTQ3LjYzMyA0NCwwIDgzLjQzLC05LjE3NiAxMTAuOTQsLTQ0LjAwOCBsIDAsMzMuOTIyIDgyLjUzLDAgMCwtMTMyLjk2NSAtMTA4LjIxLDAgYyAtMS44MywzNC44NTYgLTI4LjQyLDU3Ljc3NCAtNjMuMjYsNTcuNzc0IC0zMC4yNiwwIC02Mi4zNSwtMTcuNDIyIC02Mi4zNSwtNTEuMzQ4IDAsLTQ1Ljg0NyA0NC45MywtNTUuOTMgODAuNjksLTY0LjE4IDg4LjAyLC0yMC4xNzUgMTgyLjQ3LC00Ny42OTUgMTgyLjQ3LC0xNTcuNzM0IDAsLTk5LjAyNyAtODMuNDQsLTE1NC4wMzkgLTE3NS4xMywtMTU0LjAzOSAtNDkuNTMsMCAtOTQuNDYsMTUuNTgyIC0xMjYuNTUsNTMuMTggbCAwLC00MC4zNCAtODUuMjcsMCAwLDE0Mi4xMjkgMTE0LjYyLDAiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGgyNiIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMjk4OC4xOCw4MDAuMjU0IC02My4yNiwwIDAsMTA0LjUyNyAxNjUuMDUsMCAwLC03My4zNTUgYyAzMS4xOCw1MS4zNDcgNzguODYsODUuMjc3IDE0MS4yMSw4NS4yNzcgNjcuODUsMCAxMjQuNzEsLTQxLjI1OCAxNTIuMjEsLTEwMi42OTkgMjYuNiw2Mi4zNTEgOTIuNjIsMTAyLjY5OSAxNjAuNDcsMTAyLjY5OSA1My4xOSwwIDEwNS40NiwtMjIgMTQxLjIxLC02Mi4zNTEgMzguNTIsLTQ0LjkzOCAzOC41MiwtOTMuNTMyIDM4LjUyLC0xNDkuNDU3IGwgMCwtMTg1LjIzOSA2My4yNywwIDAsLTEwNC41MjcgLTIzOC40MiwwIDAsMTA0LjUyNyA2My4yOCwwIDAsMTU3LjcxNSBjIDAsMzIuMTAyIDAsNjAuNTI3IC0xNC42Nyw4OC45NTcgLTE4LjM0LDI2LjU4MiAtNDguNjEsNDAuMzQ0IC03OS43Nyw0MC4zNDQgLTMwLjI2LDAgLTYzLjI4LC0xMi44NDQgLTgyLjUzLC0zNi42NzIgLTIyLjkzLC0yOS4zNTUgLTIyLjkzLC01Ni44NjMgLTIyLjkzLC05Mi42MjkgbCAwLC0xNTcuNzE1IDYzLjI3LDAgMCwtMTA0LjUyNyAtMjM4LjQxLDAgMCwxMDQuNTI3IDYzLjI4LDAgMCwxNTAuMzgzIGMgMCwyOS4zNDggMCw2Ni4wMjMgLTE0LjY3LDkxLjY5OSAtMTUuNTksMjkuMzM2IC00Ny42OSw0NC45MzQgLTgwLjcsNDQuOTM0IC0zMS4xOCwwIC01Ny43NywtMTEuMDA4IC03Ny45NCwtMzUuNzc0IC0yNC43NywtMzAuMjUzIC0yNi42LC02Mi4zNDMgLTI2LjYsLTk5Ljk0MSBsIDAsLTE1MS4zMDEgNjMuMjcsMCAwLC0xMDQuNTI3IC0yMzguNCwwIDAsMTA0LjUyNyA2My4yNiwwIDAsMjgwLjU5OCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDI4IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSAzOTk4LjY2LDk1MS41NDcgLTExMS44NywwIDAsMTE4LjI5MyAxMTEuODcsMCAwLC0xMTguMjkzIHogbSAwLC00MzEuODkxIDYzLjI3LDAgMCwtMTA0LjUyNyAtMjM5LjMzLDAgMCwxMDQuNTI3IDY0LjE5LDAgMCwyODAuNTk4IC02My4yNywwIDAsMTA0LjUyNyAxNzUuMTQsMCAwLC0zODUuMTI1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzAiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDQxNTkuMTIsODAwLjI1NCAtNjMuMjcsMCAwLDEwNC41MjcgMTc1LjE0LDAgMCwtNjkuNjg3IGMgMjkuMzUsNTQuMTAxIDg0LjM2LDgwLjY5OSAxNDQuODcsODAuNjk5IDUzLjE5LDAgMTA1LjQ1LC0yMi4wMTYgMTQxLjIyLC02MC41MjcgNDAuMzQsLTQ0LjkzNCA0MS4yNiwtODguMDMyIDQxLjI2LC0xNDMuOTU3IGwgMCwtMTkxLjY1MyA2My4yNywwIDAsLTEwNC41MjcgLTIzOC40LDAgMCwxMDQuNTI3IDYzLjI2LDAgMCwxNTguNjM3IGMgMCwzMC4yNjIgMCw2MS40MzQgLTE5LjI2LDg4LjAzNSAtMjAuMTcsMjYuNTgyIC01My4xOCwzOS40MTQgLTg2LjE5LDM5LjQxNCAtMzMuOTMsMCAtNjguNzcsLTEzLjc1IC04OC45NCwtNDEuMjUgLTIxLjA5LC0yNy41IC0yMS4wOSwtNjkuNjg3IC0yMS4wOSwtMTAyLjcwNyBsIDAsLTE0Mi4xMjkgNjMuMjYsMCAwLC0xMDQuNTI3IC0yMzguNCwwIDAsMTA0LjUyNyA2My4yNywwIDAsMjgwLjU5OCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDMyIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA1MDgyLjQ4LDcwMy45NjUgYyAtMTkuMjQsNzAuNjA1IC04MS42LDExNS41NDcgLTE1NC4wNCwxMTUuNTQ3IC02Ni4wNCwwIC0xMjkuMywtNTEuMzQ4IC0xNDMuMDUsLTExNS41NDcgbCAyOTcuMDksMCB6IG0gODUuMjcsLTE0NC44ODMgYyAtMzguNTEsLTkzLjUyMyAtMTI5LjI3LC0xNTYuNzkzIC0yMzEuMDUsLTE1Ni43OTMgLTE0My4wNywwIC0yNTcuNjgsMTExLjg3MSAtMjU3LjY4LDI1NS44MzYgMCwxNDQuODgzIDEwOS4xMiwyNjEuMzI4IDI1NC45MSwyNjEuMzI4IDY3Ljg3LDAgMTM1LjcyLC0zMC4yNTggMTgzLjM5LC03OC44NjMgNDguNjIsLTUxLjM0NCA2OC43OSwtMTEzLjY5NSA2OC43OSwtMTgzLjM4MyBsIC0zLjY3LC0zOS40MzQgLTM5Ni4xMywwIGMgMTQuNjcsLTY3Ljg2MyA3Ny4wMywtMTE3LjM2MyAxNDYuNzIsLTExNy4zNjMgNDguNTksMCA5MC43NiwxOC4zMjggMTE4LjI4LDU4LjY3MiBsIDExNi40NCwwIgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzQiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDY5MC44OTUsODUwLjcwMyA5MC43NSwwIDIyLjU0MywzMS4wMzUgMCwyNDMuMTIyIC0xMzUuODI5LDAgMCwtMjQzLjE0MSAyMi41MzYsLTMxLjAxNiIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDM2IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA2MzIuMzk1LDc0Mi4yNTggMjguMDM5LDg2LjMwNCAtMjIuNTUxLDMxLjA0IC0yMzEuMjIzLDc1LjEyOCAtNDEuOTc2LC0xMjkuMTgzIDIzMS4yNTcsLTc1LjEzNyAzNi40NTQsMTEuODQ4IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoMzgiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDcxNy40NDksNjUzLjEwNSAtNzMuNDEsNTMuMzYgLTM2LjQ4OCwtMTEuODc1IC0xNDIuOTAzLC0xOTYuNjkyIDEwOS44ODMsLTc5LjgyOCAxNDIuOTE4LDE5Ni43MDMgMCwzOC4zMzIiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGg0MCIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gODI4LjUyLDcwNi40NjUgLTczLjQyNiwtNTMuMzQgMC4wMTEsLTM4LjM1OSBMIDg5OC4wMDQsNDE4LjA3IDEwMDcuOSw0OTcuODk4IDg2NC45NzMsNjk0LjYwOSA4MjguNTIsNzA2LjQ2NSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDQyIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA4MTIuMDg2LDgyOC41ODYgMjguMDU1LC04Ni4zMiAzNi40ODQsLTExLjgzNiAyMzEuMjI1LDc1LjExNyAtNDEuOTcsMTI5LjE4MyAtMjMxLjIzOSwtNzUuMTQgLTIyLjU1NSwtMzEuMDA0IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNDQiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDczNi4zMDEsMTMzNS44OCBjIC0zMjMuMDQ3LDAgLTU4NS44NzUsLTI2Mi43OCAtNTg1Ljg3NSwtNTg1Ljc4MiAwLC0zMjMuMTE4IDI2Mi44MjgsLTU4NS45NzcgNTg1Ljg3NSwtNTg1Ljk3NyAzMjMuMDE5LDAgNTg1LjgwOSwyNjIuODU5IDU4NS44MDksNTg1Ljk3NyAwLDMyMy4wMDIgLTI2Mi43OSw1ODUuNzgyIC01ODUuODA5LDU4NS43ODIgbCAwLDAgeiBtIDAsLTExOC42MSBjIDI1Ny45NzIsMCA0NjcuMTg5LC0yMDkuMTMgNDY3LjE4OSwtNDY3LjE3MiAwLC0yNTguMTI5IC0yMDkuMjE3LC00NjcuMzQ4IC00NjcuMTg5LC00NjcuMzQ4IC0yNTguMDc0LDAgLTQ2Ny4yNTQsMjA5LjIxOSAtNDY3LjI1NCw0NjcuMzQ4IDAsMjU4LjA0MiAyMDkuMTgsNDY3LjE3MiA0NjcuMjU0LDQ2Ny4xNzIiCiAgICAgICAgICAgICBpbmtzY2FwZTpjb25uZWN0b3ItY3VydmF0dXJlPSIwIgogICAgICAgICAgICAgaWQ9InBhdGg0NiIKICAgICAgICAgICAgIHN0eWxlPSJmaWxsOiM4YTQxODI7ZmlsbC1vcGFjaXR5OjE7ZmlsbC1ydWxlOm5vbnplcm87c3Ryb2tlOm5vbmUiIC8+PHBhdGgKICAgICAgICAgICAgIGQ9Im0gMTA5MS4xMyw2MTkuODgzIC0xNzUuNzcxLDU3LjEyMSAxMS42MjksMzUuODA4IDE3NS43NjIsLTU3LjEyMSAtMTEuNjIsLTM1LjgwOCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDQ4IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0iTSA4NjYuOTU3LDkwMi4wNzQgODM2LjUsOTI0LjE5OSA5NDUuMTIxLDEwNzMuNzMgOTc1LjU4NiwxMDUxLjYxIDg2Ni45NTcsOTAyLjA3NCIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDUwIgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0iTSA2MDcuNDY1LDkwMy40NDUgNDk4Ljg1NSwxMDUyLjk3IDUyOS4zMiwxMDc1LjEgNjM3LjkzLDkyNS41NjYgNjA3LjQ2NSw5MDMuNDQ1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDM4MC42ODgsNjIyLjEyOSAtMTEuNjI2LDM1LjgwMSAxNzUuNzU4LDU3LjA5IDExLjYyMSwtMzUuODAxIC0xNzUuNzUzLC01Ny4wOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDU0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA3MTYuMjg5LDM3Ni41OSAzNy42NDA2LDAgMCwxODQuODE2IC0zNy42NDA2LDAgMCwtMTg0LjgxNiB6IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTYiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=') no-repeat, none; -moz-background-size: 100%; -o-background-size: 100%; -webkit-background-size: 100%; background-size: 100%; display: block; float: left; width: 90px; height: 25px; }
-.jasmine_html-reporter .banner .version { margin-left: 14px; position: relative; top: 6px; }
-.jasmine_html-reporter .banner .duration { position: absolute; right: 14px; top: 6px; }
-.jasmine_html-reporter #jasmine_content { position: fixed; right: 100%; }
-.jasmine_html-reporter .version { color: #aaa; }
-.jasmine_html-reporter .banner { margin-top: 14px; }
-.jasmine_html-reporter .duration { color: #aaa; float: right; }
-.jasmine_html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; }
-.jasmine_html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; }
-.jasmine_html-reporter .symbol-summary li.passed { font-size: 14px; }
-.jasmine_html-reporter .symbol-summary li.passed:before { color: #007069; content: "\02022"; }
-.jasmine_html-reporter .symbol-summary li.failed { line-height: 9px; }
-.jasmine_html-reporter .symbol-summary li.failed:before { color: #ca3a11; content: "\d7"; font-weight: bold; margin-left: -1px; }
-.jasmine_html-reporter .symbol-summary li.disabled { font-size: 14px; }
-.jasmine_html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; }
-.jasmine_html-reporter .symbol-summary li.pending { line-height: 17px; }
-.jasmine_html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; }
-.jasmine_html-reporter .symbol-summary li.empty { font-size: 14px; }
-.jasmine_html-reporter .symbol-summary li.empty:before { color: #ba9d37; content: "\02022"; }
-.jasmine_html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
-.jasmine_html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
-.jasmine_html-reporter .bar.failed { background-color: #ca3a11; }
-.jasmine_html-reporter .bar.passed { background-color: #007069; }
-.jasmine_html-reporter .bar.skipped { background-color: #bababa; }
-.jasmine_html-reporter .bar.errored { background-color: #ca3a11; }
-.jasmine_html-reporter .bar.menu { background-color: #fff; color: #aaa; }
-.jasmine_html-reporter .bar.menu a { color: #333; }
-.jasmine_html-reporter .bar a { color: white; }
-.jasmine_html-reporter.spec-list .bar.menu.failure-list, .jasmine_html-reporter.spec-list .results .failures { display: none; }
-.jasmine_html-reporter.failure-list .bar.menu.spec-list, .jasmine_html-reporter.failure-list .summary { display: none; }
-.jasmine_html-reporter .running-alert { background-color: #666; }
-.jasmine_html-reporter .results { margin-top: 14px; }
-.jasmine_html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
-.jasmine_html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
-.jasmine_html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
-.jasmine_html-reporter.showDetails .summary { display: none; }
-.jasmine_html-reporter.showDetails #details { display: block; }
-.jasmine_html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
-.jasmine_html-reporter .summary { margin-top: 14px; }
-.jasmine_html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; }
-.jasmine_html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; }
-.jasmine_html-reporter .summary li.passed a { color: #007069; }
-.jasmine_html-reporter .summary li.failed a { color: #ca3a11; }
-.jasmine_html-reporter .summary li.empty a { color: #ba9d37; }
-.jasmine_html-reporter .summary li.pending a { color: #ba9d37; }
-.jasmine_html-reporter .description + .suite { margin-top: 0; }
-.jasmine_html-reporter .suite { margin-top: 14px; }
-.jasmine_html-reporter .suite a { color: #333; }
-.jasmine_html-reporter .failures .spec-detail { margin-bottom: 28px; }
-.jasmine_html-reporter .failures .spec-detail .description { background-color: #ca3a11; }
-.jasmine_html-reporter .failures .spec-detail .description a { color: white; }
-.jasmine_html-reporter .result-message { padding-top: 14px; color: #333; white-space: pre; }
-.jasmine_html-reporter .result-message span.result { display: block; }
-.jasmine_html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666; border: 1px solid #ddd; background: white; white-space: pre; }
diff --git a/admin-panel/app/vendor/jasmine/jasmine.js b/admin-panel/app/vendor/jasmine/jasmine.js
deleted file mode 100755
index c7709969..00000000
--- a/admin-panel/app/vendor/jasmine/jasmine.js
+++ /dev/null
@@ -1,3048 +0,0 @@
-/*
-Copyright (c) 2008-2015 Pivotal Labs
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-var getJasmineRequireObj = (function (jasmineGlobal) {
- var jasmineRequire;
-
- if (typeof module !== 'undefined' && module.exports) {
- jasmineGlobal = global;
- jasmineRequire = exports;
- } else {
- if (typeof window !== 'undefined' && typeof window.toString === 'function' && window.toString() === '[object GjsGlobal]') {
- jasmineGlobal = window;
- }
- jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {};
- }
-
- function getJasmineRequire() {
- return jasmineRequire;
- }
-
- getJasmineRequire().core = function(jRequire) {
- var j$ = {};
-
- jRequire.base(j$, jasmineGlobal);
- j$.util = jRequire.util();
- j$.Any = jRequire.Any();
- j$.Anything = jRequire.Anything(j$);
- j$.CallTracker = jRequire.CallTracker();
- j$.MockDate = jRequire.MockDate();
- j$.Clock = jRequire.Clock();
- j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
- j$.Env = jRequire.Env(j$);
- j$.ExceptionFormatter = jRequire.ExceptionFormatter();
- j$.Expectation = jRequire.Expectation();
- j$.buildExpectationResult = jRequire.buildExpectationResult();
- j$.JsApiReporter = jRequire.JsApiReporter();
- j$.matchersUtil = jRequire.matchersUtil(j$);
- j$.ObjectContaining = jRequire.ObjectContaining(j$);
- j$.ArrayContaining = jRequire.ArrayContaining(j$);
- j$.pp = jRequire.pp(j$);
- j$.QueueRunner = jRequire.QueueRunner(j$);
- j$.ReportDispatcher = jRequire.ReportDispatcher();
- j$.Spec = jRequire.Spec(j$);
- j$.SpyRegistry = jRequire.SpyRegistry(j$);
- j$.SpyStrategy = jRequire.SpyStrategy();
- j$.StringMatching = jRequire.StringMatching(j$);
- j$.Suite = jRequire.Suite();
- j$.Timer = jRequire.Timer();
- j$.version = jRequire.version();
-
- j$.matchers = jRequire.requireMatchers(jRequire, j$);
-
- return j$;
- };
-
- return getJasmineRequire;
-})(this);
-
-getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
- var availableMatchers = [
- 'toBe',
- 'toBeCloseTo',
- 'toBeDefined',
- 'toBeFalsy',
- 'toBeGreaterThan',
- 'toBeLessThan',
- 'toBeNaN',
- 'toBeNull',
- 'toBeTruthy',
- 'toBeUndefined',
- 'toContain',
- 'toEqual',
- 'toHaveBeenCalled',
- 'toHaveBeenCalledWith',
- 'toMatch',
- 'toThrow',
- 'toThrowError'
- ],
- matchers = {};
-
- for (var i = 0; i < availableMatchers.length; i++) {
- var name = availableMatchers[i];
- matchers[name] = jRequire[name](j$);
- }
-
- return matchers;
-};
-
-getJasmineRequireObj().base = function(j$, jasmineGlobal) {
- j$.unimplementedMethod_ = function() {
- throw new Error('unimplemented method');
- };
-
- j$.MAX_PRETTY_PRINT_DEPTH = 40;
- j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
- j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
-
- j$.getGlobal = function() {
- return jasmineGlobal;
- };
-
- j$.getEnv = function(options) {
- var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
- //jasmine. singletons in here (setTimeout blah blah).
- return env;
- };
-
- j$.isArray_ = function(value) {
- return j$.isA_('Array', value);
- };
-
- j$.isString_ = function(value) {
- return j$.isA_('String', value);
- };
-
- j$.isNumber_ = function(value) {
- return j$.isA_('Number', value);
- };
-
- j$.isA_ = function(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
- };
-
- j$.isDomNode = function(obj) {
- return obj.nodeType > 0;
- };
-
- j$.fnNameFor = function(func) {
- return func.name || func.toString().match(/^\s*function\s*(\w*)\s*\(/)[1];
- };
-
- j$.any = function(clazz) {
- return new j$.Any(clazz);
- };
-
- j$.anything = function() {
- return new j$.Anything();
- };
-
- j$.objectContaining = function(sample) {
- return new j$.ObjectContaining(sample);
- };
-
- j$.stringMatching = function(expected) {
- return new j$.StringMatching(expected);
- };
-
- j$.arrayContaining = function(sample) {
- return new j$.ArrayContaining(sample);
- };
-
- j$.createSpy = function(name, originalFn) {
-
- var spyStrategy = new j$.SpyStrategy({
- name: name,
- fn: originalFn,
- getSpy: function() { return spy; }
- }),
- callTracker = new j$.CallTracker(),
- spy = function() {
- var callData = {
- object: this,
- args: Array.prototype.slice.apply(arguments)
- };
-
- callTracker.track(callData);
- var returnValue = spyStrategy.exec.apply(this, arguments);
- callData.returnValue = returnValue;
-
- return returnValue;
- };
-
- for (var prop in originalFn) {
- if (prop === 'and' || prop === 'calls') {
- throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
- }
-
- spy[prop] = originalFn[prop];
- }
-
- spy.and = spyStrategy;
- spy.calls = callTracker;
-
- return spy;
- };
-
- j$.isSpy = function(putativeSpy) {
- if (!putativeSpy) {
- return false;
- }
- return putativeSpy.and instanceof j$.SpyStrategy &&
- putativeSpy.calls instanceof j$.CallTracker;
- };
-
- j$.createSpyObj = function(baseName, methodNames) {
- if (j$.isArray_(baseName) && j$.util.isUndefined(methodNames)) {
- methodNames = baseName;
- baseName = 'unknown';
- }
-
- if (!j$.isArray_(methodNames) || methodNames.length === 0) {
- throw 'createSpyObj requires a non-empty array of method names to create spies for';
- }
- var obj = {};
- for (var i = 0; i < methodNames.length; i++) {
- obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
- }
- return obj;
- };
-};
-
-getJasmineRequireObj().util = function() {
-
- var util = {};
-
- util.inherit = function(childClass, parentClass) {
- var Subclass = function() {
- };
- Subclass.prototype = parentClass.prototype;
- childClass.prototype = new Subclass();
- };
-
- util.htmlEscape = function(str) {
- if (!str) {
- return str;
- }
- return str.replace(/&/g, '&')
- .replace(//g, '>');
- };
-
- util.argsToArray = function(args) {
- var arrayOfArgs = [];
- for (var i = 0; i < args.length; i++) {
- arrayOfArgs.push(args[i]);
- }
- return arrayOfArgs;
- };
-
- util.isUndefined = function(obj) {
- return obj === void 0;
- };
-
- util.arrayContains = function(array, search) {
- var i = array.length;
- while (i--) {
- if (array[i] === search) {
- return true;
- }
- }
- return false;
- };
-
- util.clone = function(obj) {
- if (Object.prototype.toString.apply(obj) === '[object Array]') {
- return obj.slice();
- }
-
- var cloned = {};
- for (var prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- cloned[prop] = obj[prop];
- }
- }
-
- return cloned;
- };
-
- return util;
-};
-
-getJasmineRequireObj().Spec = function(j$) {
- function Spec(attrs) {
- this.expectationFactory = attrs.expectationFactory;
- this.resultCallback = attrs.resultCallback || function() {};
- this.id = attrs.id;
- this.description = attrs.description || '';
- this.queueableFn = attrs.queueableFn;
- this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
- this.userContext = attrs.userContext || function() { return {}; };
- this.onStart = attrs.onStart || function() {};
- this.getSpecName = attrs.getSpecName || function() { return ''; };
- this.expectationResultFactory = attrs.expectationResultFactory || function() { };
- this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
- this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
-
- if (!this.queueableFn.fn) {
- this.pend();
- }
-
- this.result = {
- id: this.id,
- description: this.description,
- fullName: this.getFullName(),
- failedExpectations: [],
- passedExpectations: [],
- pendingReason: ''
- };
- }
-
- Spec.prototype.addExpectationResult = function(passed, data) {
- var expectationResult = this.expectationResultFactory(data);
- if (passed) {
- this.result.passedExpectations.push(expectationResult);
- } else {
- this.result.failedExpectations.push(expectationResult);
- }
- };
-
- Spec.prototype.expect = function(actual) {
- return this.expectationFactory(actual, this);
- };
-
- Spec.prototype.execute = function(onComplete) {
- var self = this;
-
- this.onStart(this);
-
- if (this.markedPending || this.disabled) {
- complete();
- return;
- }
-
- var fns = this.beforeAndAfterFns();
- var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
-
- this.queueRunnerFactory({
- queueableFns: allFns,
- onException: function() { self.onException.apply(self, arguments); },
- onComplete: complete,
- userContext: this.userContext()
- });
-
- function complete() {
- self.result.status = self.status();
- self.resultCallback(self.result);
-
- if (onComplete) {
- onComplete();
- }
- }
- };
-
- Spec.prototype.onException = function onException(e) {
- if (Spec.isPendingSpecException(e)) {
- this.pend(extractCustomPendingMessage(e));
- return;
- }
-
- this.addExpectationResult(false, {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- error: e
- });
- };
-
- Spec.prototype.disable = function() {
- this.disabled = true;
- };
-
- Spec.prototype.pend = function(message) {
- this.markedPending = true;
- if (message) {
- this.result.pendingReason = message;
- }
- };
-
- Spec.prototype.status = function() {
- if (this.disabled) {
- return 'disabled';
- }
-
- if (this.markedPending) {
- return 'pending';
- }
-
- if (this.result.failedExpectations.length > 0) {
- return 'failed';
- } else {
- return 'passed';
- }
- };
-
- Spec.prototype.isExecutable = function() {
- return !this.disabled && !this.markedPending;
- };
-
- Spec.prototype.getFullName = function() {
- return this.getSpecName(this);
- };
-
- var extractCustomPendingMessage = function(e) {
- var fullMessage = e.toString(),
- boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
- boilerplateEnd = boilerplateStart + Spec.pendingSpecExceptionMessage.length;
-
- return fullMessage.substr(boilerplateEnd);
- };
-
- Spec.pendingSpecExceptionMessage = '=> marked Pending';
-
- Spec.isPendingSpecException = function(e) {
- return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
- };
-
- return Spec;
-};
-
-if (typeof window == void 0 && typeof exports == 'object') {
- exports.Spec = jasmineRequire.Spec;
-}
-
-getJasmineRequireObj().Env = function(j$) {
- function Env(options) {
- options = options || {};
-
- var self = this;
- var global = options.global || j$.getGlobal();
-
- var totalSpecsDefined = 0;
-
- var catchExceptions = true;
-
- var realSetTimeout = j$.getGlobal().setTimeout;
- var realClearTimeout = j$.getGlobal().clearTimeout;
- this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler(), new j$.MockDate(global));
-
- var runnableLookupTable = {};
- var runnableResources = {};
-
- var currentSpec = null;
- var currentlyExecutingSuites = [];
- var currentDeclarationSuite = null;
-
- var currentSuite = function() {
- return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
- };
-
- var currentRunnable = function() {
- return currentSpec || currentSuite();
- };
-
- var reporter = new j$.ReportDispatcher([
- 'jasmineStarted',
- 'jasmineDone',
- 'suiteStarted',
- 'suiteDone',
- 'specStarted',
- 'specDone'
- ]);
-
- this.specFilter = function() {
- return true;
- };
-
- this.addCustomEqualityTester = function(tester) {
- if(!currentRunnable()) {
- throw new Error('Custom Equalities must be added in a before function or a spec');
- }
- runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
- };
-
- this.addMatchers = function(matchersToAdd) {
- if(!currentRunnable()) {
- throw new Error('Matchers must be added in a before function or a spec');
- }
- var customMatchers = runnableResources[currentRunnable().id].customMatchers;
- for (var matcherName in matchersToAdd) {
- customMatchers[matcherName] = matchersToAdd[matcherName];
- }
- };
-
- j$.Expectation.addCoreMatchers(j$.matchers);
-
- var nextSpecId = 0;
- var getNextSpecId = function() {
- return 'spec' + nextSpecId++;
- };
-
- var nextSuiteId = 0;
- var getNextSuiteId = function() {
- return 'suite' + nextSuiteId++;
- };
-
- var expectationFactory = function(actual, spec) {
- return j$.Expectation.Factory({
- util: j$.matchersUtil,
- customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
- customMatchers: runnableResources[spec.id].customMatchers,
- actual: actual,
- addExpectationResult: addExpectationResult
- });
-
- function addExpectationResult(passed, result) {
- return spec.addExpectationResult(passed, result);
- }
- };
-
- var defaultResourcesForRunnable = function(id, parentRunnableId) {
- var resources = {spies: [], customEqualityTesters: [], customMatchers: {}};
-
- if(runnableResources[parentRunnableId]){
- resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
- resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
- }
-
- runnableResources[id] = resources;
- };
-
- var clearResourcesForRunnable = function(id) {
- spyRegistry.clearSpies();
- delete runnableResources[id];
- };
-
- var beforeAndAfterFns = function(suite, runnablesExplictlySet) {
- return function() {
- var befores = [],
- afters = [],
- beforeAlls = [],
- afterAlls = [];
-
- while(suite) {
- befores = befores.concat(suite.beforeFns);
- afters = afters.concat(suite.afterFns);
-
- if (runnablesExplictlySet()) {
- beforeAlls = beforeAlls.concat(suite.beforeAllFns);
- afterAlls = afterAlls.concat(suite.afterAllFns);
- }
-
- suite = suite.parentSuite;
- }
- return {
- befores: beforeAlls.reverse().concat(befores.reverse()),
- afters: afters.concat(afterAlls)
- };
- };
- };
-
- var getSpecName = function(spec, suite) {
- return suite.getFullName() + ' ' + spec.description;
- };
-
- // TODO: we may just be able to pass in the fn instead of wrapping here
- var buildExpectationResult = j$.buildExpectationResult,
- exceptionFormatter = new j$.ExceptionFormatter(),
- expectationResultFactory = function(attrs) {
- attrs.messageFormatter = exceptionFormatter.message;
- attrs.stackFormatter = exceptionFormatter.stack;
-
- return buildExpectationResult(attrs);
- };
-
- // TODO: fix this naming, and here's where the value comes in
- this.catchExceptions = function(value) {
- catchExceptions = !!value;
- return catchExceptions;
- };
-
- this.catchingExceptions = function() {
- return catchExceptions;
- };
-
- var maximumSpecCallbackDepth = 20;
- var currentSpecCallbackDepth = 0;
-
- function clearStack(fn) {
- currentSpecCallbackDepth++;
- if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) {
- currentSpecCallbackDepth = 0;
- realSetTimeout(fn, 0);
- } else {
- fn();
- }
- }
-
- var catchException = function(e) {
- return j$.Spec.isPendingSpecException(e) || catchExceptions;
- };
-
- var queueRunnerFactory = function(options) {
- options.catchException = catchException;
- options.clearStack = options.clearStack || clearStack;
- options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
- options.fail = self.fail;
-
- new j$.QueueRunner(options).execute();
- };
-
- var topSuite = new j$.Suite({
- env: this,
- id: getNextSuiteId(),
- description: 'Jasmine__TopLevel__Suite',
- queueRunner: queueRunnerFactory
- });
- runnableLookupTable[topSuite.id] = topSuite;
- defaultResourcesForRunnable(topSuite.id);
- currentDeclarationSuite = topSuite;
-
- this.topSuite = function() {
- return topSuite;
- };
-
- this.execute = function(runnablesToRun) {
- if(runnablesToRun) {
- runnablesExplictlySet = true;
- } else if (focusedRunnables.length) {
- runnablesExplictlySet = true;
- runnablesToRun = focusedRunnables;
- } else {
- runnablesToRun = [topSuite.id];
- }
-
- var allFns = [];
- for(var i = 0; i < runnablesToRun.length; i++) {
- var runnable = runnableLookupTable[runnablesToRun[i]];
- allFns.push((function(runnable) { return { fn: function(done) { runnable.execute(done); } }; })(runnable));
- }
-
- reporter.jasmineStarted({
- totalSpecsDefined: totalSpecsDefined
- });
-
- queueRunnerFactory({queueableFns: allFns, onComplete: reporter.jasmineDone});
- };
-
- this.addReporter = function(reporterToAdd) {
- reporter.addReporter(reporterToAdd);
- };
-
- var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
- if(!currentRunnable()) {
- throw new Error('Spies must be created in a before function or a spec');
- }
- return runnableResources[currentRunnable().id].spies;
- }});
-
- this.spyOn = function() {
- return spyRegistry.spyOn.apply(spyRegistry, arguments);
- };
-
- var suiteFactory = function(description) {
- var suite = new j$.Suite({
- env: self,
- id: getNextSuiteId(),
- description: description,
- parentSuite: currentDeclarationSuite,
- queueRunner: queueRunnerFactory,
- onStart: suiteStarted,
- expectationFactory: expectationFactory,
- expectationResultFactory: expectationResultFactory,
- runnablesExplictlySetGetter: runnablesExplictlySetGetter,
- resultCallback: function(attrs) {
- if (!suite.disabled) {
- clearResourcesForRunnable(suite.id);
- }
- currentlyExecutingSuites.pop();
- reporter.suiteDone(attrs);
- }
- });
-
- runnableLookupTable[suite.id] = suite;
- return suite;
-
- function suiteStarted(suite) {
- currentlyExecutingSuites.push(suite);
- defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
- reporter.suiteStarted(suite.result);
- }
- };
-
- this.describe = function(description, specDefinitions) {
- var suite = suiteFactory(description);
- addSpecsToSuite(suite, specDefinitions);
- return suite;
- };
-
- this.xdescribe = function(description, specDefinitions) {
- var suite = this.describe(description, specDefinitions);
- suite.disable();
- return suite;
- };
-
- var focusedRunnables = [];
-
- this.fdescribe = function(description, specDefinitions) {
- var suite = suiteFactory(description);
- suite.isFocused = true;
-
- focusedRunnables.push(suite.id);
- unfocusAncestor();
- addSpecsToSuite(suite, specDefinitions);
-
- return suite;
- };
-
- function addSpecsToSuite(suite, specDefinitions) {
- var parentSuite = currentDeclarationSuite;
- parentSuite.addChild(suite);
- currentDeclarationSuite = suite;
-
- var declarationError = null;
- try {
- specDefinitions.call(suite);
- } catch (e) {
- declarationError = e;
- }
-
- if (declarationError) {
- self.it('encountered a declaration exception', function() {
- throw declarationError;
- });
- }
-
- currentDeclarationSuite = parentSuite;
- }
-
- function findFocusedAncestor(suite) {
- while (suite) {
- if (suite.isFocused) {
- return suite.id;
- }
- suite = suite.parentSuite;
- }
-
- return null;
- }
-
- function unfocusAncestor() {
- var focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
- if (focusedAncestor) {
- for (var i = 0; i < focusedRunnables.length; i++) {
- if (focusedRunnables[i] === focusedAncestor) {
- focusedRunnables.splice(i, 1);
- break;
- }
- }
- }
- }
-
- var runnablesExplictlySet = false;
-
- var runnablesExplictlySetGetter = function(){
- return runnablesExplictlySet;
- };
-
- var specFactory = function(description, fn, suite, timeout) {
- totalSpecsDefined++;
- var spec = new j$.Spec({
- id: getNextSpecId(),
- beforeAndAfterFns: beforeAndAfterFns(suite, runnablesExplictlySetGetter),
- expectationFactory: expectationFactory,
- resultCallback: specResultCallback,
- getSpecName: function(spec) {
- return getSpecName(spec, suite);
- },
- onStart: specStarted,
- description: description,
- expectationResultFactory: expectationResultFactory,
- queueRunnerFactory: queueRunnerFactory,
- userContext: function() { return suite.clonedSharedUserContext(); },
- queueableFn: {
- fn: fn,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- }
- });
-
- runnableLookupTable[spec.id] = spec;
-
- if (!self.specFilter(spec)) {
- spec.disable();
- }
-
- return spec;
-
- function specResultCallback(result) {
- clearResourcesForRunnable(spec.id);
- currentSpec = null;
- reporter.specDone(result);
- }
-
- function specStarted(spec) {
- currentSpec = spec;
- defaultResourcesForRunnable(spec.id, suite.id);
- reporter.specStarted(spec.result);
- }
- };
-
- this.it = function(description, fn, timeout) {
- var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
- currentDeclarationSuite.addChild(spec);
- return spec;
- };
-
- this.xit = function() {
- var spec = this.it.apply(this, arguments);
- spec.pend();
- return spec;
- };
-
- this.fit = function(){
- var spec = this.it.apply(this, arguments);
-
- focusedRunnables.push(spec.id);
- unfocusAncestor();
- return spec;
- };
-
- this.expect = function(actual) {
- if (!currentRunnable()) {
- throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
- }
-
- return currentRunnable().expect(actual);
- };
-
- this.beforeEach = function(beforeEachFunction, timeout) {
- currentDeclarationSuite.beforeEach({
- fn: beforeEachFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.beforeAll = function(beforeAllFunction, timeout) {
- currentDeclarationSuite.beforeAll({
- fn: beforeAllFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.afterEach = function(afterEachFunction, timeout) {
- currentDeclarationSuite.afterEach({
- fn: afterEachFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.afterAll = function(afterAllFunction, timeout) {
- currentDeclarationSuite.afterAll({
- fn: afterAllFunction,
- timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
- });
- };
-
- this.pending = function(message) {
- var fullMessage = j$.Spec.pendingSpecExceptionMessage;
- if(message) {
- fullMessage += message;
- }
- throw fullMessage;
- };
-
- this.fail = function(error) {
- var message = 'Failed';
- if (error) {
- message += ': ';
- message += error.message || error;
- }
-
- currentRunnable().addExpectationResult(false, {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- message: message,
- error: error && error.message ? error : null
- });
- };
- }
-
- return Env;
-};
-
-getJasmineRequireObj().JsApiReporter = function() {
-
- var noopTimer = {
- start: function(){},
- elapsed: function(){ return 0; }
- };
-
- function JsApiReporter(options) {
- var timer = options.timer || noopTimer,
- status = 'loaded';
-
- this.started = false;
- this.finished = false;
-
- this.jasmineStarted = function() {
- this.started = true;
- status = 'started';
- timer.start();
- };
-
- var executionTime;
-
- this.jasmineDone = function() {
- this.finished = true;
- executionTime = timer.elapsed();
- status = 'done';
- };
-
- this.status = function() {
- return status;
- };
-
- var suites = [],
- suites_hash = {};
-
- this.suiteStarted = function(result) {
- suites_hash[result.id] = result;
- };
-
- this.suiteDone = function(result) {
- storeSuite(result);
- };
-
- this.suiteResults = function(index, length) {
- return suites.slice(index, index + length);
- };
-
- function storeSuite(result) {
- suites.push(result);
- suites_hash[result.id] = result;
- }
-
- this.suites = function() {
- return suites_hash;
- };
-
- var specs = [];
-
- this.specDone = function(result) {
- specs.push(result);
- };
-
- this.specResults = function(index, length) {
- return specs.slice(index, index + length);
- };
-
- this.specs = function() {
- return specs;
- };
-
- this.executionTime = function() {
- return executionTime;
- };
-
- }
-
- return JsApiReporter;
-};
-
-getJasmineRequireObj().CallTracker = function() {
-
- function CallTracker() {
- var calls = [];
-
- this.track = function(context) {
- calls.push(context);
- };
-
- this.any = function() {
- return !!calls.length;
- };
-
- this.count = function() {
- return calls.length;
- };
-
- this.argsFor = function(index) {
- var call = calls[index];
- return call ? call.args : [];
- };
-
- this.all = function() {
- return calls;
- };
-
- this.allArgs = function() {
- var callArgs = [];
- for(var i = 0; i < calls.length; i++){
- callArgs.push(calls[i].args);
- }
-
- return callArgs;
- };
-
- this.first = function() {
- return calls[0];
- };
-
- this.mostRecent = function() {
- return calls[calls.length - 1];
- };
-
- this.reset = function() {
- calls = [];
- };
- }
-
- return CallTracker;
-};
-
-getJasmineRequireObj().Clock = function() {
- function Clock(global, delayedFunctionScheduler, mockDate) {
- var self = this,
- realTimingFunctions = {
- setTimeout: global.setTimeout,
- clearTimeout: global.clearTimeout,
- setInterval: global.setInterval,
- clearInterval: global.clearInterval
- },
- fakeTimingFunctions = {
- setTimeout: setTimeout,
- clearTimeout: clearTimeout,
- setInterval: setInterval,
- clearInterval: clearInterval
- },
- installed = false,
- timer;
-
-
- self.install = function() {
- replace(global, fakeTimingFunctions);
- timer = fakeTimingFunctions;
- installed = true;
-
- return self;
- };
-
- self.uninstall = function() {
- delayedFunctionScheduler.reset();
- mockDate.uninstall();
- replace(global, realTimingFunctions);
-
- timer = realTimingFunctions;
- installed = false;
- };
-
- self.mockDate = function(initialDate) {
- mockDate.install(initialDate);
- };
-
- self.setTimeout = function(fn, delay, params) {
- if (legacyIE()) {
- if (arguments.length > 2) {
- throw new Error('IE < 9 cannot support extra params to setTimeout without a polyfill');
- }
- return timer.setTimeout(fn, delay);
- }
- return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
- };
-
- self.setInterval = function(fn, delay, params) {
- if (legacyIE()) {
- if (arguments.length > 2) {
- throw new Error('IE < 9 cannot support extra params to setInterval without a polyfill');
- }
- return timer.setInterval(fn, delay);
- }
- return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
- };
-
- self.clearTimeout = function(id) {
- return Function.prototype.call.apply(timer.clearTimeout, [global, id]);
- };
-
- self.clearInterval = function(id) {
- return Function.prototype.call.apply(timer.clearInterval, [global, id]);
- };
-
- self.tick = function(millis) {
- if (installed) {
- mockDate.tick(millis);
- delayedFunctionScheduler.tick(millis);
- } else {
- throw new Error('Mock clock is not installed, use jasmine.clock().install()');
- }
- };
-
- return self;
-
- function legacyIE() {
- //if these methods are polyfilled, apply will be present
- return !(realTimingFunctions.setTimeout || realTimingFunctions.setInterval).apply;
- }
-
- function replace(dest, source) {
- for (var prop in source) {
- dest[prop] = source[prop];
- }
- }
-
- function setTimeout(fn, delay) {
- return delayedFunctionScheduler.scheduleFunction(fn, delay, argSlice(arguments, 2));
- }
-
- function clearTimeout(id) {
- return delayedFunctionScheduler.removeFunctionWithId(id);
- }
-
- function setInterval(fn, interval) {
- return delayedFunctionScheduler.scheduleFunction(fn, interval, argSlice(arguments, 2), true);
- }
-
- function clearInterval(id) {
- return delayedFunctionScheduler.removeFunctionWithId(id);
- }
-
- function argSlice(argsObj, n) {
- return Array.prototype.slice.call(argsObj, n);
- }
- }
-
- return Clock;
-};
-
-getJasmineRequireObj().DelayedFunctionScheduler = function() {
- function DelayedFunctionScheduler() {
- var self = this;
- var scheduledLookup = [];
- var scheduledFunctions = {};
- var currentTime = 0;
- var delayedFnCount = 0;
-
- self.tick = function(millis) {
- millis = millis || 0;
- var endTime = currentTime + millis;
-
- runScheduledFunctions(endTime);
- currentTime = endTime;
- };
-
- self.scheduleFunction = function(funcToCall, millis, params, recurring, timeoutKey, runAtMillis) {
- var f;
- if (typeof(funcToCall) === 'string') {
- /* jshint evil: true */
- f = function() { return eval(funcToCall); };
- /* jshint evil: false */
- } else {
- f = funcToCall;
- }
-
- millis = millis || 0;
- timeoutKey = timeoutKey || ++delayedFnCount;
- runAtMillis = runAtMillis || (currentTime + millis);
-
- var funcToSchedule = {
- runAtMillis: runAtMillis,
- funcToCall: f,
- recurring: recurring,
- params: params,
- timeoutKey: timeoutKey,
- millis: millis
- };
-
- if (runAtMillis in scheduledFunctions) {
- scheduledFunctions[runAtMillis].push(funcToSchedule);
- } else {
- scheduledFunctions[runAtMillis] = [funcToSchedule];
- scheduledLookup.push(runAtMillis);
- scheduledLookup.sort(function (a, b) {
- return a - b;
- });
- }
-
- return timeoutKey;
- };
-
- self.removeFunctionWithId = function(timeoutKey) {
- for (var runAtMillis in scheduledFunctions) {
- var funcs = scheduledFunctions[runAtMillis];
- var i = indexOfFirstToPass(funcs, function (func) {
- return func.timeoutKey === timeoutKey;
- });
-
- if (i > -1) {
- if (funcs.length === 1) {
- delete scheduledFunctions[runAtMillis];
- deleteFromLookup(runAtMillis);
- } else {
- funcs.splice(i, 1);
- }
-
- // intervals get rescheduled when executed, so there's never more
- // than a single scheduled function with a given timeoutKey
- break;
- }
- }
- };
-
- self.reset = function() {
- currentTime = 0;
- scheduledLookup = [];
- scheduledFunctions = {};
- delayedFnCount = 0;
- };
-
- return self;
-
- function indexOfFirstToPass(array, testFn) {
- var index = -1;
-
- for (var i = 0; i < array.length; ++i) {
- if (testFn(array[i])) {
- index = i;
- break;
- }
- }
-
- return index;
- }
-
- function deleteFromLookup(key) {
- var value = Number(key);
- var i = indexOfFirstToPass(scheduledLookup, function (millis) {
- return millis === value;
- });
-
- if (i > -1) {
- scheduledLookup.splice(i, 1);
- }
- }
-
- function reschedule(scheduledFn) {
- self.scheduleFunction(scheduledFn.funcToCall,
- scheduledFn.millis,
- scheduledFn.params,
- true,
- scheduledFn.timeoutKey,
- scheduledFn.runAtMillis + scheduledFn.millis);
- }
-
- function forEachFunction(funcsToRun, callback) {
- for (var i = 0; i < funcsToRun.length; ++i) {
- callback(funcsToRun[i]);
- }
- }
-
- function runScheduledFunctions(endTime) {
- if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
- return;
- }
-
- do {
- currentTime = scheduledLookup.shift();
-
- var funcsToRun = scheduledFunctions[currentTime];
- delete scheduledFunctions[currentTime];
-
- forEachFunction(funcsToRun, function(funcToRun) {
- if (funcToRun.recurring) {
- reschedule(funcToRun);
- }
- });
-
- forEachFunction(funcsToRun, function(funcToRun) {
- funcToRun.funcToCall.apply(null, funcToRun.params || []);
- });
- } while (scheduledLookup.length > 0 &&
- // checking first if we're out of time prevents setTimeout(0)
- // scheduled in a funcToRun from forcing an extra iteration
- currentTime !== endTime &&
- scheduledLookup[0] <= endTime);
- }
- }
-
- return DelayedFunctionScheduler;
-};
-
-getJasmineRequireObj().ExceptionFormatter = function() {
- function ExceptionFormatter() {
- this.message = function(error) {
- var message = '';
-
- if (error.name && error.message) {
- message += error.name + ': ' + error.message;
- } else {
- message += error.toString() + ' thrown';
- }
-
- if (error.fileName || error.sourceURL) {
- message += ' in ' + (error.fileName || error.sourceURL);
- }
-
- if (error.line || error.lineNumber) {
- message += ' (line ' + (error.line || error.lineNumber) + ')';
- }
-
- return message;
- };
-
- this.stack = function(error) {
- return error ? error.stack : null;
- };
- }
-
- return ExceptionFormatter;
-};
-
-getJasmineRequireObj().Expectation = function() {
-
- function Expectation(options) {
- this.util = options.util || { buildFailureMessage: function() {} };
- this.customEqualityTesters = options.customEqualityTesters || [];
- this.actual = options.actual;
- this.addExpectationResult = options.addExpectationResult || function(){};
- this.isNot = options.isNot;
-
- var customMatchers = options.customMatchers || {};
- for (var matcherName in customMatchers) {
- this[matcherName] = Expectation.prototype.wrapCompare(matcherName, customMatchers[matcherName]);
- }
- }
-
- Expectation.prototype.wrapCompare = function(name, matcherFactory) {
- return function() {
- var args = Array.prototype.slice.call(arguments, 0),
- expected = args.slice(0),
- message = '';
-
- args.unshift(this.actual);
-
- var matcher = matcherFactory(this.util, this.customEqualityTesters),
- matcherCompare = matcher.compare;
-
- function defaultNegativeCompare() {
- var result = matcher.compare.apply(null, args);
- result.pass = !result.pass;
- return result;
- }
-
- if (this.isNot) {
- matcherCompare = matcher.negativeCompare || defaultNegativeCompare;
- }
-
- var result = matcherCompare.apply(null, args);
-
- if (!result.pass) {
- if (!result.message) {
- args.unshift(this.isNot);
- args.unshift(name);
- message = this.util.buildFailureMessage.apply(null, args);
- } else {
- if (Object.prototype.toString.apply(result.message) === '[object Function]') {
- message = result.message();
- } else {
- message = result.message;
- }
- }
- }
-
- if (expected.length == 1) {
- expected = expected[0];
- }
-
- // TODO: how many of these params are needed?
- this.addExpectationResult(
- result.pass,
- {
- matcherName: name,
- passed: result.pass,
- message: message,
- actual: this.actual,
- expected: expected // TODO: this may need to be arrayified/sliced
- }
- );
- };
- };
-
- Expectation.addCoreMatchers = function(matchers) {
- var prototype = Expectation.prototype;
- for (var matcherName in matchers) {
- var matcher = matchers[matcherName];
- prototype[matcherName] = prototype.wrapCompare(matcherName, matcher);
- }
- };
-
- Expectation.Factory = function(options) {
- options = options || {};
-
- var expect = new Expectation(options);
-
- // TODO: this would be nice as its own Object - NegativeExpectation
- // TODO: copy instead of mutate options
- options.isNot = true;
- expect.not = new Expectation(options);
-
- return expect;
- };
-
- return Expectation;
-};
-
-//TODO: expectation result may make more sense as a presentation of an expectation.
-getJasmineRequireObj().buildExpectationResult = function() {
- function buildExpectationResult(options) {
- var messageFormatter = options.messageFormatter || function() {},
- stackFormatter = options.stackFormatter || function() {};
-
- var result = {
- matcherName: options.matcherName,
- message: message(),
- stack: stack(),
- passed: options.passed
- };
-
- if(!result.passed) {
- result.expected = options.expected;
- result.actual = options.actual;
- }
-
- return result;
-
- function message() {
- if (options.passed) {
- return 'Passed.';
- } else if (options.message) {
- return options.message;
- } else if (options.error) {
- return messageFormatter(options.error);
- }
- return '';
- }
-
- function stack() {
- if (options.passed) {
- return '';
- }
-
- var error = options.error;
- if (!error) {
- try {
- throw new Error(message());
- } catch (e) {
- error = e;
- }
- }
- return stackFormatter(error);
- }
- }
-
- return buildExpectationResult;
-};
-
-getJasmineRequireObj().MockDate = function() {
- function MockDate(global) {
- var self = this;
- var currentTime = 0;
-
- if (!global || !global.Date) {
- self.install = function() {};
- self.tick = function() {};
- self.uninstall = function() {};
- return self;
- }
-
- var GlobalDate = global.Date;
-
- self.install = function(mockDate) {
- if (mockDate instanceof GlobalDate) {
- currentTime = mockDate.getTime();
- } else {
- currentTime = new GlobalDate().getTime();
- }
-
- global.Date = FakeDate;
- };
-
- self.tick = function(millis) {
- millis = millis || 0;
- currentTime = currentTime + millis;
- };
-
- self.uninstall = function() {
- currentTime = 0;
- global.Date = GlobalDate;
- };
-
- createDateProperties();
-
- return self;
-
- function FakeDate() {
- switch(arguments.length) {
- case 0:
- return new GlobalDate(currentTime);
- case 1:
- return new GlobalDate(arguments[0]);
- case 2:
- return new GlobalDate(arguments[0], arguments[1]);
- case 3:
- return new GlobalDate(arguments[0], arguments[1], arguments[2]);
- case 4:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3]);
- case 5:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4]);
- case 6:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4], arguments[5]);
- default:
- return new GlobalDate(arguments[0], arguments[1], arguments[2], arguments[3],
- arguments[4], arguments[5], arguments[6]);
- }
- }
-
- function createDateProperties() {
- FakeDate.prototype = GlobalDate.prototype;
-
- FakeDate.now = function() {
- if (GlobalDate.now) {
- return currentTime;
- } else {
- throw new Error('Browser does not support Date.now()');
- }
- };
-
- FakeDate.toSource = GlobalDate.toSource;
- FakeDate.toString = GlobalDate.toString;
- FakeDate.parse = GlobalDate.parse;
- FakeDate.UTC = GlobalDate.UTC;
- }
- }
-
- return MockDate;
-};
-
-getJasmineRequireObj().pp = function(j$) {
-
- function PrettyPrinter() {
- this.ppNestLevel_ = 0;
- this.seen = [];
- }
-
- PrettyPrinter.prototype.format = function(value) {
- this.ppNestLevel_++;
- try {
- if (j$.util.isUndefined(value)) {
- this.emitScalar('undefined');
- } else if (value === null) {
- this.emitScalar('null');
- } else if (value === 0 && 1/value === -Infinity) {
- this.emitScalar('-0');
- } else if (value === j$.getGlobal()) {
- this.emitScalar('');
- } else if (value.jasmineToString) {
- this.emitScalar(value.jasmineToString());
- } else if (typeof value === 'string') {
- this.emitString(value);
- } else if (j$.isSpy(value)) {
- this.emitScalar('spy on ' + value.and.identity());
- } else if (value instanceof RegExp) {
- this.emitScalar(value.toString());
- } else if (typeof value === 'function') {
- this.emitScalar('Function');
- } else if (typeof value.nodeType === 'number') {
- this.emitScalar('HTMLNode');
- } else if (value instanceof Date) {
- this.emitScalar('Date(' + value + ')');
- } else if (j$.util.arrayContains(this.seen, value)) {
- this.emitScalar('');
- } else if (j$.isArray_(value) || j$.isA_('Object', value)) {
- this.seen.push(value);
- if (j$.isArray_(value)) {
- this.emitArray(value);
- } else {
- this.emitObject(value);
- }
- this.seen.pop();
- } else {
- this.emitScalar(value.toString());
- }
- } finally {
- this.ppNestLevel_--;
- }
- };
-
- PrettyPrinter.prototype.iterateObject = function(obj, fn) {
- for (var property in obj) {
- if (!Object.prototype.hasOwnProperty.call(obj, property)) { continue; }
- fn(property, obj.__lookupGetter__ ? (!j$.util.isUndefined(obj.__lookupGetter__(property)) &&
- obj.__lookupGetter__(property) !== null) : false);
- }
- };
-
- PrettyPrinter.prototype.emitArray = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitObject = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitScalar = j$.unimplementedMethod_;
- PrettyPrinter.prototype.emitString = j$.unimplementedMethod_;
-
- function StringPrettyPrinter() {
- PrettyPrinter.call(this);
-
- this.string = '';
- }
-
- j$.util.inherit(StringPrettyPrinter, PrettyPrinter);
-
- StringPrettyPrinter.prototype.emitScalar = function(value) {
- this.append(value);
- };
-
- StringPrettyPrinter.prototype.emitString = function(value) {
- this.append('\'' + value + '\'');
- };
-
- StringPrettyPrinter.prototype.emitArray = function(array) {
- if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
- this.append('Array');
- return;
- }
- var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH);
- this.append('[ ');
- for (var i = 0; i < length; i++) {
- if (i > 0) {
- this.append(', ');
- }
- this.format(array[i]);
- }
- if(array.length > length){
- this.append(', ...');
- }
- this.append(' ]');
- };
-
- StringPrettyPrinter.prototype.emitObject = function(obj) {
- var constructorName = obj.constructor ? j$.fnNameFor(obj.constructor) : 'null';
- this.append(constructorName);
-
- if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) {
- return;
- }
-
- var self = this;
- this.append('({ ');
- var first = true;
-
- this.iterateObject(obj, function(property, isGetter) {
- if (first) {
- first = false;
- } else {
- self.append(', ');
- }
-
- self.append(property);
- self.append(': ');
- if (isGetter) {
- self.append('');
- } else {
- self.format(obj[property]);
- }
- });
-
- this.append(' })');
- };
-
- StringPrettyPrinter.prototype.append = function(value) {
- this.string += value;
- };
-
- return function(value) {
- var stringPrettyPrinter = new StringPrettyPrinter();
- stringPrettyPrinter.format(value);
- return stringPrettyPrinter.string;
- };
-};
-
-getJasmineRequireObj().QueueRunner = function(j$) {
-
- function once(fn) {
- var called = false;
- return function() {
- if (!called) {
- called = true;
- fn();
- }
- };
- }
-
- function QueueRunner(attrs) {
- this.queueableFns = attrs.queueableFns || [];
- this.onComplete = attrs.onComplete || function() {};
- this.clearStack = attrs.clearStack || function(fn) {fn();};
- this.onException = attrs.onException || function() {};
- this.catchException = attrs.catchException || function() { return true; };
- this.userContext = attrs.userContext || {};
- this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
- this.fail = attrs.fail || function() {};
- }
-
- QueueRunner.prototype.execute = function() {
- this.run(this.queueableFns, 0);
- };
-
- QueueRunner.prototype.run = function(queueableFns, recursiveIndex) {
- var length = queueableFns.length,
- self = this,
- iterativeIndex;
-
-
- for(iterativeIndex = recursiveIndex; iterativeIndex < length; iterativeIndex++) {
- var queueableFn = queueableFns[iterativeIndex];
- if (queueableFn.fn.length > 0) {
- attemptAsync(queueableFn);
- return;
- } else {
- attemptSync(queueableFn);
- }
- }
-
- var runnerDone = iterativeIndex >= length;
-
- if (runnerDone) {
- this.clearStack(this.onComplete);
- }
-
- function attemptSync(queueableFn) {
- try {
- queueableFn.fn.call(self.userContext);
- } catch (e) {
- handleException(e, queueableFn);
- }
- }
-
- function attemptAsync(queueableFn) {
- var clearTimeout = function () {
- Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeoutId]]);
- },
- next = once(function () {
- clearTimeout(timeoutId);
- self.run(queueableFns, iterativeIndex + 1);
- }),
- timeoutId;
-
- next.fail = function() {
- self.fail.apply(null, arguments);
- next();
- };
-
- if (queueableFn.timeout) {
- timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
- var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');
- onException(error, queueableFn);
- next();
- }, queueableFn.timeout()]]);
- }
-
- try {
- queueableFn.fn.call(self.userContext, next);
- } catch (e) {
- handleException(e, queueableFn);
- next();
- }
- }
-
- function onException(e, queueableFn) {
- self.onException(e);
- }
-
- function handleException(e, queueableFn) {
- onException(e, queueableFn);
- if (!self.catchException(e)) {
- //TODO: set a var when we catch an exception and
- //use a finally block to close the loop in a nice way..
- throw e;
- }
- }
- };
-
- return QueueRunner;
-};
-
-getJasmineRequireObj().ReportDispatcher = function() {
- function ReportDispatcher(methods) {
-
- var dispatchedMethods = methods || [];
-
- for (var i = 0; i < dispatchedMethods.length; i++) {
- var method = dispatchedMethods[i];
- this[method] = (function(m) {
- return function() {
- dispatch(m, arguments);
- };
- }(method));
- }
-
- var reporters = [];
-
- this.addReporter = function(reporter) {
- reporters.push(reporter);
- };
-
- return this;
-
- function dispatch(method, args) {
- for (var i = 0; i < reporters.length; i++) {
- var reporter = reporters[i];
- if (reporter[method]) {
- reporter[method].apply(reporter, args);
- }
- }
- }
- }
-
- return ReportDispatcher;
-};
-
-
-getJasmineRequireObj().SpyRegistry = function(j$) {
-
- function SpyRegistry(options) {
- options = options || {};
- var currentSpies = options.currentSpies || function() { return []; };
-
- this.spyOn = function(obj, methodName) {
- if (j$.util.isUndefined(obj)) {
- throw new Error('spyOn could not find an object to spy upon for ' + methodName + '()');
- }
-
- if (j$.util.isUndefined(methodName)) {
- throw new Error('No method name supplied');
- }
-
- if (j$.util.isUndefined(obj[methodName])) {
- throw new Error(methodName + '() method does not exist');
- }
-
- if (obj[methodName] && j$.isSpy(obj[methodName])) {
- //TODO?: should this return the current spy? Downside: may cause user confusion about spy state
- throw new Error(methodName + ' has already been spied upon');
- }
-
- var spy = j$.createSpy(methodName, obj[methodName]);
-
- currentSpies().push({
- spy: spy,
- baseObj: obj,
- methodName: methodName,
- originalValue: obj[methodName]
- });
-
- obj[methodName] = spy;
-
- return spy;
- };
-
- this.clearSpies = function() {
- var spies = currentSpies();
- for (var i = 0; i < spies.length; i++) {
- var spyEntry = spies[i];
- spyEntry.baseObj[spyEntry.methodName] = spyEntry.originalValue;
- }
- };
- }
-
- return SpyRegistry;
-};
-
-getJasmineRequireObj().SpyStrategy = function() {
-
- function SpyStrategy(options) {
- options = options || {};
-
- var identity = options.name || 'unknown',
- originalFn = options.fn || function() {},
- getSpy = options.getSpy || function() {},
- plan = function() {};
-
- this.identity = function() {
- return identity;
- };
-
- this.exec = function() {
- return plan.apply(this, arguments);
- };
-
- this.callThrough = function() {
- plan = originalFn;
- return getSpy();
- };
-
- this.returnValue = function(value) {
- plan = function() {
- return value;
- };
- return getSpy();
- };
-
- this.returnValues = function() {
- var values = Array.prototype.slice.call(arguments);
- plan = function () {
- return values.shift();
- };
- return getSpy();
- };
-
- this.throwError = function(something) {
- var error = (something instanceof Error) ? something : new Error(something);
- plan = function() {
- throw error;
- };
- return getSpy();
- };
-
- this.callFake = function(fn) {
- plan = fn;
- return getSpy();
- };
-
- this.stub = function(fn) {
- plan = function() {};
- return getSpy();
- };
- }
-
- return SpyStrategy;
-};
-
-getJasmineRequireObj().Suite = function() {
- function Suite(attrs) {
- this.env = attrs.env;
- this.id = attrs.id;
- this.parentSuite = attrs.parentSuite;
- this.description = attrs.description;
- this.onStart = attrs.onStart || function() {};
- this.resultCallback = attrs.resultCallback || function() {};
- this.clearStack = attrs.clearStack || function(fn) {fn();};
- this.expectationFactory = attrs.expectationFactory;
- this.expectationResultFactory = attrs.expectationResultFactory;
- this.runnablesExplictlySetGetter = attrs.runnablesExplictlySetGetter || function() {};
-
- this.beforeFns = [];
- this.afterFns = [];
- this.beforeAllFns = [];
- this.afterAllFns = [];
- this.queueRunner = attrs.queueRunner || function() {};
- this.disabled = false;
-
- this.children = [];
-
- this.result = {
- id: this.id,
- description: this.description,
- fullName: this.getFullName(),
- failedExpectations: []
- };
- }
-
- Suite.prototype.expect = function(actual) {
- return this.expectationFactory(actual, this);
- };
-
- Suite.prototype.getFullName = function() {
- var fullName = this.description;
- for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
- if (parentSuite.parentSuite) {
- fullName = parentSuite.description + ' ' + fullName;
- }
- }
- return fullName;
- };
-
- Suite.prototype.disable = function() {
- this.disabled = true;
- };
-
- Suite.prototype.beforeEach = function(fn) {
- this.beforeFns.unshift(fn);
- };
-
- Suite.prototype.beforeAll = function(fn) {
- this.beforeAllFns.push(fn);
- };
-
- Suite.prototype.afterEach = function(fn) {
- this.afterFns.unshift(fn);
- };
-
- Suite.prototype.afterAll = function(fn) {
- this.afterAllFns.push(fn);
- };
-
- Suite.prototype.addChild = function(child) {
- this.children.push(child);
- };
-
- Suite.prototype.status = function() {
- if (this.disabled) {
- return 'disabled';
- }
-
- if (this.result.failedExpectations.length > 0) {
- return 'failed';
- } else {
- return 'finished';
- }
- };
-
- Suite.prototype.execute = function(onComplete) {
- var self = this;
-
- this.onStart(this);
-
- if (this.disabled) {
- complete();
- return;
- }
-
- var allFns = [];
-
- for (var i = 0; i < this.children.length; i++) {
- allFns.push(wrapChildAsAsync(this.children[i]));
- }
-
- if (this.isExecutable()) {
- allFns = this.beforeAllFns.concat(allFns);
- allFns = allFns.concat(this.afterAllFns);
- }
-
- this.queueRunner({
- queueableFns: allFns,
- onComplete: complete,
- userContext: this.sharedUserContext(),
- onException: function() { self.onException.apply(self, arguments); }
- });
-
- function complete() {
- self.result.status = self.status();
- self.resultCallback(self.result);
-
- if (onComplete) {
- onComplete();
- }
- }
-
- function wrapChildAsAsync(child) {
- return { fn: function(done) { child.execute(done); } };
- }
- };
-
- Suite.prototype.isExecutable = function() {
- var runnablesExplicitlySet = this.runnablesExplictlySetGetter();
- return !runnablesExplicitlySet && hasExecutableChild(this.children);
- };
-
- Suite.prototype.sharedUserContext = function() {
- if (!this.sharedContext) {
- this.sharedContext = this.parentSuite ? clone(this.parentSuite.sharedUserContext()) : {};
- }
-
- return this.sharedContext;
- };
-
- Suite.prototype.clonedSharedUserContext = function() {
- return clone(this.sharedUserContext());
- };
-
- Suite.prototype.onException = function() {
- if(isAfterAll(this.children)) {
- var data = {
- matcherName: '',
- passed: false,
- expected: '',
- actual: '',
- error: arguments[0]
- };
- this.result.failedExpectations.push(this.expectationResultFactory(data));
- } else {
- for (var i = 0; i < this.children.length; i++) {
- var child = this.children[i];
- child.onException.apply(child, arguments);
- }
- }
- };
-
- Suite.prototype.addExpectationResult = function () {
- if(isAfterAll(this.children) && isFailure(arguments)){
- var data = arguments[1];
- this.result.failedExpectations.push(this.expectationResultFactory(data));
- } else {
- for (var i = 0; i < this.children.length; i++) {
- var child = this.children[i];
- child.addExpectationResult.apply(child, arguments);
- }
- }
- };
-
- function isAfterAll(children) {
- return children && children[0].result.status;
- }
-
- function isFailure(args) {
- return !args[0];
- }
-
- function hasExecutableChild(children) {
- var foundActive = false;
- for (var i = 0; i < children.length; i++) {
- if (children[i].isExecutable()) {
- foundActive = true;
- break;
- }
- }
- return foundActive;
- }
-
- function clone(obj) {
- var clonedObj = {};
- for (var prop in obj) {
- if (obj.hasOwnProperty(prop)) {
- clonedObj[prop] = obj[prop];
- }
- }
-
- return clonedObj;
- }
-
- return Suite;
-};
-
-if (typeof window == void 0 && typeof exports == 'object') {
- exports.Suite = jasmineRequire.Suite;
-}
-
-getJasmineRequireObj().Timer = function() {
- var defaultNow = (function(Date) {
- return function() { return new Date().getTime(); };
- })(Date);
-
- function Timer(options) {
- options = options || {};
-
- var now = options.now || defaultNow,
- startTime;
-
- this.start = function() {
- startTime = now();
- };
-
- this.elapsed = function() {
- return now() - startTime;
- };
- }
-
- return Timer;
-};
-
-getJasmineRequireObj().Any = function() {
-
- function Any(expectedObject) {
- this.expectedObject = expectedObject;
- }
-
- Any.prototype.asymmetricMatch = function(other) {
- if (this.expectedObject == String) {
- return typeof other == 'string' || other instanceof String;
- }
-
- if (this.expectedObject == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
-
- if (this.expectedObject == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
-
- if (this.expectedObject == Object) {
- return typeof other == 'object';
- }
-
- if (this.expectedObject == Boolean) {
- return typeof other == 'boolean';
- }
-
- return other instanceof this.expectedObject;
- };
-
- Any.prototype.jasmineToString = function() {
- return '';
- };
-
- return Any;
-};
-
-getJasmineRequireObj().Anything = function(j$) {
-
- function Anything() {}
-
- Anything.prototype.asymmetricMatch = function(other) {
- return !j$.util.isUndefined(other) && other !== null;
- };
-
- Anything.prototype.jasmineToString = function() {
- return '';
- };
-
- return Anything;
-};
-
-getJasmineRequireObj().ArrayContaining = function(j$) {
- function ArrayContaining(sample) {
- this.sample = sample;
- }
-
- ArrayContaining.prototype.asymmetricMatch = function(other) {
- var className = Object.prototype.toString.call(this.sample);
- if (className !== '[object Array]') { throw new Error('You must provide an array to arrayContaining, not \'' + this.sample + '\'.'); }
-
- for (var i = 0; i < this.sample.length; i++) {
- var item = this.sample[i];
- if (!j$.matchersUtil.contains(other, item)) {
- return false;
- }
- }
-
- return true;
- };
-
- ArrayContaining.prototype.jasmineToString = function () {
- return '';
- };
-
- return ArrayContaining;
-};
-
-getJasmineRequireObj().ObjectContaining = function(j$) {
-
- function ObjectContaining(sample) {
- this.sample = sample;
- }
-
- ObjectContaining.prototype.asymmetricMatch = function(other) {
- if (typeof(this.sample) !== 'object') { throw new Error('You must provide an object to objectContaining, not \''+this.sample+'\'.'); }
-
- for (var property in this.sample) {
- if (!Object.prototype.hasOwnProperty.call(other, property) ||
- !j$.matchersUtil.equals(this.sample[property], other[property])) {
- return false;
- }
- }
-
- return true;
- };
-
- ObjectContaining.prototype.jasmineToString = function() {
- return '';
- };
-
- return ObjectContaining;
-};
-
-getJasmineRequireObj().StringMatching = function(j$) {
-
- function StringMatching(expected) {
- if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
- throw new Error('Expected is not a String or a RegExp');
- }
-
- this.regexp = new RegExp(expected);
- }
-
- StringMatching.prototype.asymmetricMatch = function(other) {
- return this.regexp.test(other);
- };
-
- StringMatching.prototype.jasmineToString = function() {
- return '';
- };
-
- return StringMatching;
-};
-
-getJasmineRequireObj().matchersUtil = function(j$) {
- // TODO: what to do about jasmine.pp not being inject? move to JSON.stringify? gut PrettyPrinter?
-
- return {
- equals: function(a, b, customTesters) {
- customTesters = customTesters || [];
-
- return eq(a, b, [], [], customTesters);
- },
-
- contains: function(haystack, needle, customTesters) {
- customTesters = customTesters || [];
-
- if ((Object.prototype.toString.apply(haystack) === '[object Array]') ||
- (!!haystack && !haystack.indexOf))
- {
- for (var i = 0; i < haystack.length; i++) {
- if (eq(haystack[i], needle, [], [], customTesters)) {
- return true;
- }
- }
- return false;
- }
-
- return !!haystack && haystack.indexOf(needle) >= 0;
- },
-
- buildFailureMessage: function() {
- var args = Array.prototype.slice.call(arguments, 0),
- matcherName = args[0],
- isNot = args[1],
- actual = args[2],
- expected = args.slice(3),
- englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
-
- var message = 'Expected ' +
- j$.pp(actual) +
- (isNot ? ' not ' : ' ') +
- englishyPredicate;
-
- if (expected.length > 0) {
- for (var i = 0; i < expected.length; i++) {
- if (i > 0) {
- message += ',';
- }
- message += ' ' + j$.pp(expected[i]);
- }
- }
-
- return message + '.';
- }
- };
-
- function isAsymmetric(obj) {
- return obj && j$.isA_('Function', obj.asymmetricMatch);
- }
-
- function asymmetricMatch(a, b) {
- var asymmetricA = isAsymmetric(a),
- asymmetricB = isAsymmetric(b);
-
- if (asymmetricA && asymmetricB) {
- return undefined;
- }
-
- if (asymmetricA) {
- return a.asymmetricMatch(b);
- }
-
- if (asymmetricB) {
- return b.asymmetricMatch(a);
- }
- }
-
- // Equality function lovingly adapted from isEqual in
- // [Underscore](http://underscorejs.org)
- function eq(a, b, aStack, bStack, customTesters) {
- var result = true;
-
- var asymmetricResult = asymmetricMatch(a, b);
- if (!j$.util.isUndefined(asymmetricResult)) {
- return asymmetricResult;
- }
-
- for (var i = 0; i < customTesters.length; i++) {
- var customTesterResult = customTesters[i](a, b);
- if (!j$.util.isUndefined(customTesterResult)) {
- return customTesterResult;
- }
- }
-
- if (a instanceof Error && b instanceof Error) {
- return a.message == b.message;
- }
-
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
- if (a === b) { return a !== 0 || 1 / a == 1 / b; }
- // A strict comparison is necessary because `null == undefined`.
- if (a === null || b === null) { return a === b; }
- var className = Object.prototype.toString.call(a);
- if (className != Object.prototype.toString.call(b)) { return false; }
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : (a === 0 ? 1 / a == 1 / b : a == +b);
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source &&
- a.global == b.global &&
- a.multiline == b.multiline &&
- a.ignoreCase == b.ignoreCase;
- }
- if (typeof a != 'object' || typeof b != 'object') { return false; }
-
- var aIsDomNode = j$.isDomNode(a);
- var bIsDomNode = j$.isDomNode(b);
- if (aIsDomNode && bIsDomNode) {
- // At first try to use DOM3 method isEqualNode
- if (a.isEqualNode) {
- return a.isEqualNode(b);
- }
- // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
- var aIsElement = a instanceof Element;
- var bIsElement = b instanceof Element;
- if (aIsElement && bIsElement) {
- return a.outerHTML == b.outerHTML;
- }
- if (aIsElement || bIsElement) {
- return false;
- }
- return a.innerText == b.innerText && a.textContent == b.textContent;
- }
- if (aIsDomNode || bIsDomNode) {
- return false;
- }
-
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] == a) { return bStack[length] == b; }
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0;
- // Recursively compare objects and arrays.
- // Compare array lengths to determine if a deep comparison is necessary.
- if (className == '[object Array]' && a.length !== b.length) {
- result = false;
- }
-
- if (result) {
- // Objects with different constructors are not equivalent, but `Object`s
- // from different frames are.
- var aCtor = a.constructor, bCtor = b.constructor;
- if (aCtor !== bCtor && !(isFunction(aCtor) && (aCtor instanceof aCtor) &&
- isFunction(bCtor) && (bCtor instanceof bCtor))) {
- return false;
- }
- // Deep compare objects.
- for (var key in a) {
- if (has(a, key)) {
- // Count the expected number of properties.
- size++;
- // Deep compare each member.
- if (!(result = has(b, key) && eq(a[key], b[key], aStack, bStack, customTesters))) { break; }
- }
- }
- // Ensure that both objects contain the same number of properties.
- if (result) {
- for (key in b) {
- if (has(b, key) && !(size--)) { break; }
- }
- result = !size;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
-
- return result;
-
- function has(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
-
- function isFunction(obj) {
- return typeof obj === 'function';
- }
- }
-};
-
-getJasmineRequireObj().toBe = function() {
- function toBe() {
- return {
- compare: function(actual, expected) {
- return {
- pass: actual === expected
- };
- }
- };
- }
-
- return toBe;
-};
-
-getJasmineRequireObj().toBeCloseTo = function() {
-
- function toBeCloseTo() {
- return {
- compare: function(actual, expected, precision) {
- if (precision !== 0) {
- precision = precision || 2;
- }
-
- return {
- pass: Math.abs(expected - actual) < (Math.pow(10, -precision) / 2)
- };
- }
- };
- }
-
- return toBeCloseTo;
-};
-
-getJasmineRequireObj().toBeDefined = function() {
- function toBeDefined() {
- return {
- compare: function(actual) {
- return {
- pass: (void 0 !== actual)
- };
- }
- };
- }
-
- return toBeDefined;
-};
-
-getJasmineRequireObj().toBeFalsy = function() {
- function toBeFalsy() {
- return {
- compare: function(actual) {
- return {
- pass: !!!actual
- };
- }
- };
- }
-
- return toBeFalsy;
-};
-
-getJasmineRequireObj().toBeGreaterThan = function() {
-
- function toBeGreaterThan() {
- return {
- compare: function(actual, expected) {
- return {
- pass: actual > expected
- };
- }
- };
- }
-
- return toBeGreaterThan;
-};
-
-
-getJasmineRequireObj().toBeLessThan = function() {
- function toBeLessThan() {
- return {
-
- compare: function(actual, expected) {
- return {
- pass: actual < expected
- };
- }
- };
- }
-
- return toBeLessThan;
-};
-getJasmineRequireObj().toBeNaN = function(j$) {
-
- function toBeNaN() {
- return {
- compare: function(actual) {
- var result = {
- pass: (actual !== actual)
- };
-
- if (result.pass) {
- result.message = 'Expected actual not to be NaN.';
- } else {
- result.message = function() { return 'Expected ' + j$.pp(actual) + ' to be NaN.'; };
- }
-
- return result;
- }
- };
- }
-
- return toBeNaN;
-};
-
-getJasmineRequireObj().toBeNull = function() {
-
- function toBeNull() {
- return {
- compare: function(actual) {
- return {
- pass: actual === null
- };
- }
- };
- }
-
- return toBeNull;
-};
-
-getJasmineRequireObj().toBeTruthy = function() {
-
- function toBeTruthy() {
- return {
- compare: function(actual) {
- return {
- pass: !!actual
- };
- }
- };
- }
-
- return toBeTruthy;
-};
-
-getJasmineRequireObj().toBeUndefined = function() {
-
- function toBeUndefined() {
- return {
- compare: function(actual) {
- return {
- pass: void 0 === actual
- };
- }
- };
- }
-
- return toBeUndefined;
-};
-
-getJasmineRequireObj().toContain = function() {
- function toContain(util, customEqualityTesters) {
- customEqualityTesters = customEqualityTesters || [];
-
- return {
- compare: function(actual, expected) {
-
- return {
- pass: util.contains(actual, expected, customEqualityTesters)
- };
- }
- };
- }
-
- return toContain;
-};
-
-getJasmineRequireObj().toEqual = function() {
-
- function toEqual(util, customEqualityTesters) {
- customEqualityTesters = customEqualityTesters || [];
-
- return {
- compare: function(actual, expected) {
- var result = {
- pass: false
- };
-
- result.pass = util.equals(actual, expected, customEqualityTesters);
-
- return result;
- }
- };
- }
-
- return toEqual;
-};
-
-getJasmineRequireObj().toHaveBeenCalled = function(j$) {
-
- function toHaveBeenCalled() {
- return {
- compare: function(actual) {
- var result = {};
-
- if (!j$.isSpy(actual)) {
- throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
- }
-
- if (arguments.length > 1) {
- throw new Error('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
- }
-
- result.pass = actual.calls.any();
-
- result.message = result.pass ?
- 'Expected spy ' + actual.and.identity() + ' not to have been called.' :
- 'Expected spy ' + actual.and.identity() + ' to have been called.';
-
- return result;
- }
- };
- }
-
- return toHaveBeenCalled;
-};
-
-getJasmineRequireObj().toHaveBeenCalledWith = function(j$) {
-
- function toHaveBeenCalledWith(util, customEqualityTesters) {
- return {
- compare: function() {
- var args = Array.prototype.slice.call(arguments, 0),
- actual = args[0],
- expectedArgs = args.slice(1),
- result = { pass: false };
-
- if (!j$.isSpy(actual)) {
- throw new Error('Expected a spy, but got ' + j$.pp(actual) + '.');
- }
-
- if (!actual.calls.any()) {
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but it was never called.'; };
- return result;
- }
-
- if (util.contains(actual.calls.allArgs(), expectedArgs, customEqualityTesters)) {
- result.pass = true;
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' not to have been called with ' + j$.pp(expectedArgs) + ' but it was.'; };
- } else {
- result.message = function() { return 'Expected spy ' + actual.and.identity() + ' to have been called with ' + j$.pp(expectedArgs) + ' but actual calls were ' + j$.pp(actual.calls.allArgs()).replace(/^\[ | ]$/g, '') + '.'; };
- }
-
- return result;
- }
- };
- }
-
- return toHaveBeenCalledWith;
-};
-
-getJasmineRequireObj().toMatch = function(j$) {
-
- function toMatch() {
- return {
- compare: function(actual, expected) {
- if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) {
- throw new Error('Expected is not a String or a RegExp');
- }
-
- var regexp = new RegExp(expected);
-
- return {
- pass: regexp.test(actual)
- };
- }
- };
- }
-
- return toMatch;
-};
-
-getJasmineRequireObj().toThrow = function(j$) {
-
- function toThrow(util) {
- return {
- compare: function(actual, expected) {
- var result = { pass: false },
- threw = false,
- thrown;
-
- if (typeof actual != 'function') {
- throw new Error('Actual is not a Function');
- }
-
- try {
- actual();
- } catch (e) {
- threw = true;
- thrown = e;
- }
-
- if (!threw) {
- result.message = 'Expected function to throw an exception.';
- return result;
- }
-
- if (arguments.length == 1) {
- result.pass = true;
- result.message = function() { return 'Expected function not to throw, but it threw ' + j$.pp(thrown) + '.'; };
-
- return result;
- }
-
- if (util.equals(thrown, expected)) {
- result.pass = true;
- result.message = function() { return 'Expected function not to throw ' + j$.pp(expected) + '.'; };
- } else {
- result.message = function() { return 'Expected function to throw ' + j$.pp(expected) + ', but it threw ' + j$.pp(thrown) + '.'; };
- }
-
- return result;
- }
- };
- }
-
- return toThrow;
-};
-
-getJasmineRequireObj().toThrowError = function(j$) {
- function toThrowError (util) {
- return {
- compare: function(actual) {
- var threw = false,
- pass = {pass: true},
- fail = {pass: false},
- thrown;
-
- if (typeof actual != 'function') {
- throw new Error('Actual is not a Function');
- }
-
- var errorMatcher = getMatcher.apply(null, arguments);
-
- try {
- actual();
- } catch (e) {
- threw = true;
- thrown = e;
- }
-
- if (!threw) {
- fail.message = 'Expected function to throw an Error.';
- return fail;
- }
-
- if (!(thrown instanceof Error)) {
- fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
- return fail;
- }
-
- if (errorMatcher.hasNoSpecifics()) {
- pass.message = 'Expected function not to throw an Error, but it threw ' + j$.fnNameFor(thrown) + '.';
- return pass;
- }
-
- if (errorMatcher.matches(thrown)) {
- pass.message = function() {
- return 'Expected function not to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() + '.';
- };
- return pass;
- } else {
- fail.message = function() {
- return 'Expected function to throw ' + errorMatcher.errorTypeDescription + errorMatcher.messageDescription() +
- ', but it threw ' + errorMatcher.thrownDescription(thrown) + '.';
- };
- return fail;
- }
- }
- };
-
- function getMatcher() {
- var expected = null,
- errorType = null;
-
- if (arguments.length == 2) {
- expected = arguments[1];
- if (isAnErrorType(expected)) {
- errorType = expected;
- expected = null;
- }
- } else if (arguments.length > 2) {
- errorType = arguments[1];
- expected = arguments[2];
- if (!isAnErrorType(errorType)) {
- throw new Error('Expected error type is not an Error.');
- }
- }
-
- if (expected && !isStringOrRegExp(expected)) {
- if (errorType) {
- throw new Error('Expected error message is not a string or RegExp.');
- } else {
- throw new Error('Expected is not an Error, string, or RegExp.');
- }
- }
-
- function messageMatch(message) {
- if (typeof expected == 'string') {
- return expected == message;
- } else {
- return expected.test(message);
- }
- }
-
- return {
- errorTypeDescription: errorType ? j$.fnNameFor(errorType) : 'an exception',
- thrownDescription: function(thrown) {
- var thrownName = errorType ? j$.fnNameFor(thrown.constructor) : 'an exception',
- thrownMessage = '';
-
- if (expected) {
- thrownMessage = ' with message ' + j$.pp(thrown.message);
- }
-
- return thrownName + thrownMessage;
- },
- messageDescription: function() {
- if (expected === null) {
- return '';
- } else if (expected instanceof RegExp) {
- return ' with a message matching ' + j$.pp(expected);
- } else {
- return ' with message ' + j$.pp(expected);
- }
- },
- hasNoSpecifics: function() {
- return expected === null && errorType === null;
- },
- matches: function(error) {
- return (errorType === null || error.constructor === errorType) &&
- (expected === null || messageMatch(error.message));
- }
- };
- }
-
- function isStringOrRegExp(potential) {
- return potential instanceof RegExp || (typeof potential == 'string');
- }
-
- function isAnErrorType(type) {
- if (typeof type !== 'function') {
- return false;
- }
-
- var Surrogate = function() {};
- Surrogate.prototype = type.prototype;
- return (new Surrogate()) instanceof Error;
- }
- }
-
- return toThrowError;
-};
-
-getJasmineRequireObj().interface = function(jasmine, env) {
- var jasmineInterface = {
- describe: function(description, specDefinitions) {
- return env.describe(description, specDefinitions);
- },
-
- xdescribe: function(description, specDefinitions) {
- return env.xdescribe(description, specDefinitions);
- },
-
- fdescribe: function(description, specDefinitions) {
- return env.fdescribe(description, specDefinitions);
- },
-
- it: function() {
- return env.it.apply(env, arguments);
- },
-
- xit: function() {
- return env.xit.apply(env, arguments);
- },
-
- fit: function() {
- return env.fit.apply(env, arguments);
- },
-
- beforeEach: function() {
- return env.beforeEach.apply(env, arguments);
- },
-
- afterEach: function() {
- return env.afterEach.apply(env, arguments);
- },
-
- beforeAll: function() {
- return env.beforeAll.apply(env, arguments);
- },
-
- afterAll: function() {
- return env.afterAll.apply(env, arguments);
- },
-
- expect: function(actual) {
- return env.expect(actual);
- },
-
- pending: function() {
- return env.pending.apply(env, arguments);
- },
-
- fail: function() {
- return env.fail.apply(env, arguments);
- },
-
- spyOn: function(obj, methodName) {
- return env.spyOn(obj, methodName);
- },
-
- jsApiReporter: new jasmine.JsApiReporter({
- timer: new jasmine.Timer()
- }),
-
- jasmine: jasmine
- };
-
- jasmine.addCustomEqualityTester = function(tester) {
- env.addCustomEqualityTester(tester);
- };
-
- jasmine.addMatchers = function(matchers) {
- return env.addMatchers(matchers);
- };
-
- jasmine.clock = function() {
- return env.clock;
- };
-
- return jasmineInterface;
-};
-
-getJasmineRequireObj().version = function() {
- return '2.2.0';
-};
diff --git a/admin-panel/app/vendor/nwbp/contextmenu.js b/admin-panel/app/vendor/nwbp/contextmenu.js
deleted file mode 100755
index 25fc0850..00000000
--- a/admin-panel/app/vendor/nwbp/contextmenu.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// This gives you default context menu (cut, copy, paste)
-// in all input fields and textareas across your app.
-
-(function () {
- 'use strict';
-
- var gui = require('nw.gui');
-
- var cut = new gui.MenuItem({
- label: "Cut",
- click: function () {
- document.execCommand("cut");
- }
- });
-
- var copy = new gui.MenuItem({
- label: "Copy",
- click: function () {
- document.execCommand("copy");
- }
- });
-
- var paste = new gui.MenuItem({
- label: "Paste",
- click: function () {
- document.execCommand("paste");
- }
- });
-
- var textMenu = new gui.Menu();
- textMenu.append(cut);
- textMenu.append(copy);
- textMenu.append(paste);
-
- document.addEventListener('contextmenu', function(e) {
-
- switch (e.target.nodeName) {
- case 'TEXTAREA':
- case 'INPUT':
- e.preventDefault();
- textMenu.popup(e.x, e.y);
- break;
- }
-
- }, false);
-
-}());
diff --git a/admin-panel/app/vendor/nwbp/dev-helpers.js b/admin-panel/app/vendor/nwbp/dev-helpers.js
deleted file mode 100755
index a0656dda..00000000
--- a/admin-panel/app/vendor/nwbp/dev-helpers.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// When application runs in development mode this
-// module activates convenient shortcuts for you.
-
-(function () {
- 'use strict';
-
- var gui = require('nw.gui');
-
- var registerShortcuts = function () {
- var keyDown = function (e) {
- if ((e.ctrlKey || e.metaKey) && e.keyCode == 82) {
- // CTRL (CMD) + R reloads the page
- gui.Window.get().reload();
- }
- if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode == 73) {
- // CTRL (CMD) + SHIFT + I shows devtools window
- gui.Window.get().showDevTools();
- }
- };
-
- document.addEventListener('keydown', keyDown, false);
- };
-
- if (gui.App.manifest.developmentMode) {
- registerShortcuts();
- }
-
-}());
diff --git a/admin-panel/app/vendor/nwbp/external-links.js b/admin-panel/app/vendor/nwbp/external-links.js
deleted file mode 100755
index 87558d3d..00000000
--- a/admin-panel/app/vendor/nwbp/external-links.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Convenient way for opening links in external browser, not in the app.
-// Useful especially if you have a lot of links to deal with.
-//
-// Usage:
-//
-// Every link with class ".js-external-link" will be opened in external browser.
-// google
-//
-// The same behaviour for many links can be achieved by adding
-// this class to any parent tag of an anchor tag.
-//
-// google
-// bing
-//
-
-(function () {
- var gui = require('nw.gui');
-
- var supportExternalLinks = function (e) {
- var href;
- var isExternal = false;
-
- var checkDomElement = function (element) {
- if (element.nodeName === 'A') {
- href = element.getAttribute('href');
- }
- if (element.classList.contains('js-external-link')) {
- isExternal = true;
- }
- if (href && isExternal) {
- gui.Shell.openExternal(href);
- e.preventDefault();
- } else if (element.parentElement) {
- checkDomElement(element.parentElement);
- }
- };
-
- checkDomElement(e.target);
- };
-
- document.addEventListener('click', supportExternalLinks, false);
-}());
\ No newline at end of file
diff --git a/admin-panel/app/vendor/nwbp/window-state.js b/admin-panel/app/vendor/nwbp/window-state.js
deleted file mode 100755
index ec7c7142..00000000
--- a/admin-panel/app/vendor/nwbp/window-state.js
+++ /dev/null
@@ -1,123 +0,0 @@
-// Window state (size and position) preservation between app launches.
-(function () {
- 'use strict';
-
- var gui = require('nw.gui');
- var win = gui.Window.get();
- var state;
- var currMode = 'normal';
- var maximized = null;
- var saveTimeout;
-
- var init = function () {
- try {
- state = JSON.parse(localStorage.windowState);
-
- // Make sure the window is in-bounds of the screen.
- // If not, it is safer to ignore it.
- if (state.x < -10 ||
- state.y < -10 ||
- state.x + state.width > screen.width + 10 ||
- state.y + state.height > screen.height + 10) {
- throw "Window out of bounds.";
- }
-
- // Restore saved window state.
- currMode = state.mode;
- win.resizeTo(state.width, state.height);
- win.moveTo(state.x, state.y);
- if (currMode === 'maximized') {
- // Have to delay maximization a little to let NW set
- // the normal x,y,width,height of the window,
- // so we can unmaximize to that state later on.
- // It also prevents bug https://github.com/nwjs/nw.js/issues/1105
- setTimeout(function () {
- win.maximize();
- maximized = snapshotWindowSize();
- }, 100);
- }
- } catch (err) {
- // There was no data, or data has been corrupted.
- // Start from scratch with safe defaults.
- state = {
- mode: currMode,
- x: win.x,
- y: win.y,
- width: win.width,
- height: win.height
- };
- }
-
- win.show();
- };
-
- // We are delaying save for one second to be sure window state
- // has "stabilized" (order of events is sometimes unreliable,
- // and we can save some junk by not waiting).
- var scheduleSave = function () {
- clearTimeout(saveTimeout);
- saveTimeout = setTimeout(save, 1000);
- };
-
- var snapshotWindowSize = function (obj) {
- obj = obj || {};
- obj.x = win.x;
- obj.y = win.y;
- obj.width = win.width;
- obj.height = win.height;
- return obj;
- };
-
- var save = function () {
- if (currMode === 'minimized') {
- // Don't save minimized state.
- return;
- }
- if (currMode === 'normal') {
- // Update window dimensions only if in normal mode.
- snapshotWindowSize(state);
- }
- if (currMode === 'maximized') {
- // Save maximized dimensions into separate object.
- maximized = snapshotWindowSize();
- }
- state.mode = currMode;
- localStorage.windowState = JSON.stringify(state);
- };
-
- init();
-
- win.on('maximize', function () {
- currMode = 'maximized';
- scheduleSave();
- });
-
- win.on('unmaximize', function () {
- currMode = 'normal';
- scheduleSave();
- });
-
- win.on('minimize', function () {
- currMode = 'minimized';
- // Don't save minimized state.
- });
-
- win.on('restore', function () {
- currMode = 'normal';
- scheduleSave();
- });
-
- win.on('resize', function () {
- if (maximized && (win.width !== maximized.width || win.height !== maximized.height)) {
- // On OSX you can resize maximized window, so it is no longer maximized.
- maximized = null;
- currMode = 'normal';
- }
- scheduleSave();
- });
-
- win.on('move', function () {
- scheduleSave();
- });
-
-}());
diff --git a/admin-panel/app/vendor/require.js b/admin-panel/app/vendor/require.js
deleted file mode 100755
index abebd2ab..00000000
--- a/admin-panel/app/vendor/require.js
+++ /dev/null
@@ -1,2076 +0,0 @@
-/** vim: et:ts=4:sw=4:sts=4
- * @license RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-//Not using strict: uneven strict support in browsers, #392, and causes
-//problems with requirejs.exec()/transpiler plugins that may not be strict.
-/*jslint regexp: true, nomen: true, sloppy: true */
-/*global window, navigator, document, importScripts, setTimeout, opera */
-
-var requirejs, require, define;
-(function (global) {
- var req, s, head, baseElement, dataMain, src,
- interactiveScript, currentlyAddingScript, mainScript, subPath,
- version = '2.1.14',
- commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
- cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
- jsSuffixRegExp = /\.js$/,
- currDirRegExp = /^\.\//,
- op = Object.prototype,
- ostring = op.toString,
- hasOwn = op.hasOwnProperty,
- ap = Array.prototype,
- apsp = ap.splice,
- isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
- isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
- //PS3 indicates loaded and complete, but need to wait for complete
- //specifically. Sequence is 'loading', 'loaded', execution,
- // then 'complete'. The UA check is unfortunate, but not sure how
- //to feature test w/o causing perf issues.
- readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
- /^complete$/ : /^(complete|loaded)$/,
- defContextName = '_',
- //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
- isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
- contexts = {},
- cfg = {},
- globalDefQueue = [],
- useInteractive = false;
-
- function isFunction(it) {
- return ostring.call(it) === '[object Function]';
- }
-
- function isArray(it) {
- return ostring.call(it) === '[object Array]';
- }
-
- /**
- * Helper function for iterating over an array. If the func returns
- * a true value, it will break out of the loop.
- */
- function each(ary, func) {
- if (ary) {
- var i;
- for (i = 0; i < ary.length; i += 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- /**
- * Helper function for iterating over an array backwards. If the func
- * returns a true value, it will break out of the loop.
- */
- function eachReverse(ary, func) {
- if (ary) {
- var i;
- for (i = ary.length - 1; i > -1; i -= 1) {
- if (ary[i] && func(ary[i], i, ary)) {
- break;
- }
- }
- }
- }
-
- function hasProp(obj, prop) {
- return hasOwn.call(obj, prop);
- }
-
- function getOwn(obj, prop) {
- return hasProp(obj, prop) && obj[prop];
- }
-
- /**
- * Cycles over properties in an object and calls a function for each
- * property value. If the function returns a truthy value, then the
- * iteration is stopped.
- */
- function eachProp(obj, func) {
- var prop;
- for (prop in obj) {
- if (hasProp(obj, prop)) {
- if (func(obj[prop], prop)) {
- break;
- }
- }
- }
- }
-
- /**
- * Simple function to mix in properties from source into target,
- * but only if target does not already have a property of the same name.
- */
- function mixin(target, source, force, deepStringMixin) {
- if (source) {
- eachProp(source, function (value, prop) {
- if (force || !hasProp(target, prop)) {
- if (deepStringMixin && typeof value === 'object' && value &&
- !isArray(value) && !isFunction(value) &&
- !(value instanceof RegExp)) {
-
- if (!target[prop]) {
- target[prop] = {};
- }
- mixin(target[prop], value, force, deepStringMixin);
- } else {
- target[prop] = value;
- }
- }
- });
- }
- return target;
- }
-
- //Similar to Function.prototype.bind, but the 'this' object is specified
- //first, since it is easier to read/figure out what 'this' will be.
- function bind(obj, fn) {
- return function () {
- return fn.apply(obj, arguments);
- };
- }
-
- function scripts() {
- return document.getElementsByTagName('script');
- }
-
- function defaultOnError(err) {
- throw err;
- }
-
- //Allow getting a global that is expressed in
- //dot notation, like 'a.b.c'.
- function getGlobal(value) {
- if (!value) {
- return value;
- }
- var g = global;
- each(value.split('.'), function (part) {
- g = g[part];
- });
- return g;
- }
-
- /**
- * Constructs an error with a pointer to an URL with more information.
- * @param {String} id the error ID that maps to an ID on a web page.
- * @param {String} message human readable error.
- * @param {Error} [err] the original error, if there is one.
- *
- * @returns {Error}
- */
- function makeError(id, msg, err, requireModules) {
- var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
- e.requireType = id;
- e.requireModules = requireModules;
- if (err) {
- e.originalError = err;
- }
- return e;
- }
-
- if (typeof define !== 'undefined') {
- //If a define is already in play via another AMD loader,
- //do not overwrite.
- return;
- }
-
- if (typeof requirejs !== 'undefined') {
- if (isFunction(requirejs)) {
- //Do not overwrite an existing requirejs instance.
- return;
- }
- cfg = requirejs;
- requirejs = undefined;
- }
-
- //Allow for a require config object
- if (typeof require !== 'undefined' && !isFunction(require)) {
- //assume it is a config object.
- cfg = require;
- require = undefined;
- }
-
- function newContext(contextName) {
- var inCheckLoaded, Module, context, handlers,
- checkLoadedTimeoutId,
- config = {
- //Defaults. Do not set a default for map
- //config to speed up normalize(), which
- //will run faster if there is no default.
- waitSeconds: 7,
- baseUrl: './',
- paths: {},
- bundles: {},
- pkgs: {},
- shim: {},
- config: {}
- },
- registry = {},
- //registry of just enabled modules, to speed
- //cycle breaking code when lots of modules
- //are registered, but not activated.
- enabledRegistry = {},
- undefEvents = {},
- defQueue = [],
- defined = {},
- urlFetched = {},
- bundlesMap = {},
- requireCounter = 1,
- unnormalizedCounter = 1;
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; i < ary.length; i++) {
- part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- // If at the start, or previous value is still ..,
- // keep them so that when converted to a path it may
- // still work when converted to a path, even though
- // as an ID it is less than ideal. In larger point
- // releases, may be better to just kick out an error.
- if (i === 0 || (i == 1 && ary[2] === '..') || ary[i - 1] === '..') {
- continue;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- /**
- * Given a relative module name, like ./something, normalize it to
- * a real name that can be mapped to a path.
- * @param {String} name the relative name
- * @param {String} baseName a real name that the name arg is relative
- * to.
- * @param {Boolean} applyMap apply the map config to the value. Should
- * only be done if this normalization is for a dependency ID.
- * @returns {String} normalized name
- */
- function normalize(name, baseName, applyMap) {
- var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
- foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
- baseParts = (baseName && baseName.split('/')),
- map = config.map,
- starMap = map && map['*'];
-
- //Adjust any relative paths.
- if (name) {
- name = name.split('/');
- lastIndex = name.length - 1;
-
- // If wanting node ID compatibility, strip .js from end
- // of IDs. Have to do this here, and not in nameToUrl
- // because node allows either .js or non .js to map
- // to same file.
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
- }
-
- // Starts with a '.' so need the baseName
- if (name[0].charAt(0) === '.' && baseParts) {
- //Convert baseName to array, and lop off the last part,
- //so that . matches that 'directory' and not name of the baseName's
- //module. For instance, baseName of 'one/two/three', maps to
- //'one/two/three.js', but we want the directory, 'one/two' for
- //this normalization.
- normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
- name = normalizedBaseParts.concat(name);
- }
-
- trimDots(name);
- name = name.join('/');
- }
-
- //Apply map config if available.
- if (applyMap && map && (baseParts || starMap)) {
- nameParts = name.split('/');
-
- outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
- nameSegment = nameParts.slice(0, i).join('/');
-
- if (baseParts) {
- //Find the longest baseName segment match in the config.
- //So, do joins on the biggest to smallest lengths of baseParts.
- for (j = baseParts.length; j > 0; j -= 1) {
- mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
-
- //baseName segment has config, find if it has one for
- //this name.
- if (mapValue) {
- mapValue = getOwn(mapValue, nameSegment);
- if (mapValue) {
- //Match, update name to the new value.
- foundMap = mapValue;
- foundI = i;
- break outerLoop;
- }
- }
- }
- }
-
- //Check for a star map match, but just hold on to it,
- //if there is a shorter segment match later in a matching
- //config, then favor over this star map.
- if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
- foundStarMap = getOwn(starMap, nameSegment);
- starI = i;
- }
- }
-
- if (!foundMap && foundStarMap) {
- foundMap = foundStarMap;
- foundI = starI;
- }
-
- if (foundMap) {
- nameParts.splice(0, foundI, foundMap);
- name = nameParts.join('/');
- }
- }
-
- // If the name points to a package's name, use
- // the package main instead.
- pkgMain = getOwn(config.pkgs, name);
-
- return pkgMain ? pkgMain : name;
- }
-
- function removeScript(name) {
- if (isBrowser) {
- each(scripts(), function (scriptNode) {
- if (scriptNode.getAttribute('data-requiremodule') === name &&
- scriptNode.getAttribute('data-requirecontext') === context.contextName) {
- scriptNode.parentNode.removeChild(scriptNode);
- return true;
- }
- });
- }
- }
-
- function hasPathFallback(id) {
- var pathConfig = getOwn(config.paths, id);
- if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
- //Pop off the first array value, since it failed, and
- //retry
- pathConfig.shift();
- context.require.undef(id);
-
- //Custom require that does not do map translation, since
- //ID is "absolute", already mapped/resolved.
- context.makeRequire(null, {
- skipMap: true
- })([id]);
-
- return true;
- }
- }
-
- //Turns a plugin!resource to [plugin, resource]
- //with the plugin being undefined if the name
- //did not have a plugin prefix.
- function splitPrefix(name) {
- var prefix,
- index = name ? name.indexOf('!') : -1;
- if (index > -1) {
- prefix = name.substring(0, index);
- name = name.substring(index + 1, name.length);
- }
- return [prefix, name];
- }
-
- /**
- * Creates a module mapping that includes plugin prefix, module
- * name, and path. If parentModuleMap is provided it will
- * also normalize the name via require.normalize()
- *
- * @param {String} name the module name
- * @param {String} [parentModuleMap] parent module map
- * for the module name, used to resolve relative names.
- * @param {Boolean} isNormalized: is the ID already normalized.
- * This is true if this call is done for a define() module ID.
- * @param {Boolean} applyMap: apply the map config to the ID.
- * Should only be true if this map is for a dependency.
- *
- * @returns {Object}
- */
- function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
- var url, pluginModule, suffix, nameParts,
- prefix = null,
- parentName = parentModuleMap ? parentModuleMap.name : null,
- originalName = name,
- isDefine = true,
- normalizedName = '';
-
- //If no name, then it means it is a require call, generate an
- //internal name.
- if (!name) {
- isDefine = false;
- name = '_@r' + (requireCounter += 1);
- }
-
- nameParts = splitPrefix(name);
- prefix = nameParts[0];
- name = nameParts[1];
-
- if (prefix) {
- prefix = normalize(prefix, parentName, applyMap);
- pluginModule = getOwn(defined, prefix);
- }
-
- //Account for relative paths if there is a base name.
- if (name) {
- if (prefix) {
- if (pluginModule && pluginModule.normalize) {
- //Plugin is loaded, use its normalize method.
- normalizedName = pluginModule.normalize(name, function (name) {
- return normalize(name, parentName, applyMap);
- });
- } else {
- // If nested plugin references, then do not try to
- // normalize, as it will not normalize correctly. This
- // places a restriction on resourceIds, and the longer
- // term solution is not to normalize until plugins are
- // loaded and all normalizations to allow for async
- // loading of a loader plugin. But for now, fixes the
- // common uses. Details in #1131
- normalizedName = name.indexOf('!') === -1 ?
- normalize(name, parentName, applyMap) :
- name;
- }
- } else {
- //A regular module.
- normalizedName = normalize(name, parentName, applyMap);
-
- //Normalized name may be a plugin ID due to map config
- //application in normalize. The map config values must
- //already be normalized, so do not need to redo that part.
- nameParts = splitPrefix(normalizedName);
- prefix = nameParts[0];
- normalizedName = nameParts[1];
- isNormalized = true;
-
- url = context.nameToUrl(normalizedName);
- }
- }
-
- //If the id is a plugin id that cannot be determined if it needs
- //normalization, stamp it with a unique ID so two matching relative
- //ids that may conflict can be separate.
- suffix = prefix && !pluginModule && !isNormalized ?
- '_unnormalized' + (unnormalizedCounter += 1) :
- '';
-
- return {
- prefix: prefix,
- name: normalizedName,
- parentMap: parentModuleMap,
- unnormalized: !!suffix,
- url: url,
- originalName: originalName,
- isDefine: isDefine,
- id: (prefix ?
- prefix + '!' + normalizedName :
- normalizedName) + suffix
- };
- }
-
- function getModule(depMap) {
- var id = depMap.id,
- mod = getOwn(registry, id);
-
- if (!mod) {
- mod = registry[id] = new context.Module(depMap);
- }
-
- return mod;
- }
-
- function on(depMap, name, fn) {
- var id = depMap.id,
- mod = getOwn(registry, id);
-
- if (hasProp(defined, id) &&
- (!mod || mod.defineEmitComplete)) {
- if (name === 'defined') {
- fn(defined[id]);
- }
- } else {
- mod = getModule(depMap);
- if (mod.error && name === 'error') {
- fn(mod.error);
- } else {
- mod.on(name, fn);
- }
- }
- }
-
- function onError(err, errback) {
- var ids = err.requireModules,
- notified = false;
-
- if (errback) {
- errback(err);
- } else {
- each(ids, function (id) {
- var mod = getOwn(registry, id);
- if (mod) {
- //Set error on module, so it skips timeout checks.
- mod.error = err;
- if (mod.events.error) {
- notified = true;
- mod.emit('error', err);
- }
- }
- });
-
- if (!notified) {
- req.onError(err);
- }
- }
- }
-
- /**
- * Internal method to transfer globalQueue items to this context's
- * defQueue.
- */
- function takeGlobalQueue() {
- //Push all the globalDefQueue items into the context's defQueue
- if (globalDefQueue.length) {
- //Array splice in the values since the context code has a
- //local var ref to defQueue, so cannot just reassign the one
- //on context.
- apsp.apply(defQueue,
- [defQueue.length, 0].concat(globalDefQueue));
- globalDefQueue = [];
- }
- }
-
- handlers = {
- 'require': function (mod) {
- if (mod.require) {
- return mod.require;
- } else {
- return (mod.require = context.makeRequire(mod.map));
- }
- },
- 'exports': function (mod) {
- mod.usingExports = true;
- if (mod.map.isDefine) {
- if (mod.exports) {
- return (defined[mod.map.id] = mod.exports);
- } else {
- return (mod.exports = defined[mod.map.id] = {});
- }
- }
- },
- 'module': function (mod) {
- if (mod.module) {
- return mod.module;
- } else {
- return (mod.module = {
- id: mod.map.id,
- uri: mod.map.url,
- config: function () {
- return getOwn(config.config, mod.map.id) || {};
- },
- exports: mod.exports || (mod.exports = {})
- });
- }
- }
- };
-
- function cleanRegistry(id) {
- //Clean up machinery used for waiting modules.
- delete registry[id];
- delete enabledRegistry[id];
- }
-
- function breakCycle(mod, traced, processed) {
- var id = mod.map.id;
-
- if (mod.error) {
- mod.emit('error', mod.error);
- } else {
- traced[id] = true;
- each(mod.depMaps, function (depMap, i) {
- var depId = depMap.id,
- dep = getOwn(registry, depId);
-
- //Only force things that have not completed
- //being defined, so still in the registry,
- //and only if it has not been matched up
- //in the module already.
- if (dep && !mod.depMatched[i] && !processed[depId]) {
- if (getOwn(traced, depId)) {
- mod.defineDep(i, defined[depId]);
- mod.check(); //pass false?
- } else {
- breakCycle(dep, traced, processed);
- }
- }
- });
- processed[id] = true;
- }
- }
-
- function checkLoaded() {
- var err, usingPathFallback,
- waitInterval = config.waitSeconds * 1000,
- //It is possible to disable the wait interval by using waitSeconds of 0.
- expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
- noLoads = [],
- reqCalls = [],
- stillLoading = false,
- needCycleCheck = true;
-
- //Do not bother if this call was a result of a cycle break.
- if (inCheckLoaded) {
- return;
- }
-
- inCheckLoaded = true;
-
- //Figure out the state of all the modules.
- eachProp(enabledRegistry, function (mod) {
- var map = mod.map,
- modId = map.id;
-
- //Skip things that are not enabled or in error state.
- if (!mod.enabled) {
- return;
- }
-
- if (!map.isDefine) {
- reqCalls.push(mod);
- }
-
- if (!mod.error) {
- //If the module should be executed, and it has not
- //been inited and time is up, remember it.
- if (!mod.inited && expired) {
- if (hasPathFallback(modId)) {
- usingPathFallback = true;
- stillLoading = true;
- } else {
- noLoads.push(modId);
- removeScript(modId);
- }
- } else if (!mod.inited && mod.fetched && map.isDefine) {
- stillLoading = true;
- if (!map.prefix) {
- //No reason to keep looking for unfinished
- //loading. If the only stillLoading is a
- //plugin resource though, keep going,
- //because it may be that a plugin resource
- //is waiting on a non-plugin cycle.
- return (needCycleCheck = false);
- }
- }
- }
- });
-
- if (expired && noLoads.length) {
- //If wait time expired, throw error of unloaded modules.
- err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
- err.contextName = context.contextName;
- return onError(err);
- }
-
- //Not expired, check for a cycle.
- if (needCycleCheck) {
- each(reqCalls, function (mod) {
- breakCycle(mod, {}, {});
- });
- }
-
- //If still waiting on loads, and the waiting load is something
- //other than a plugin resource, or there are still outstanding
- //scripts, then just try back later.
- if ((!expired || usingPathFallback) && stillLoading) {
- //Something is still waiting to load. Wait for it, but only
- //if a timeout is not already in effect.
- if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
- checkLoadedTimeoutId = setTimeout(function () {
- checkLoadedTimeoutId = 0;
- checkLoaded();
- }, 50);
- }
- }
-
- inCheckLoaded = false;
- }
-
- Module = function (map) {
- this.events = getOwn(undefEvents, map.id) || {};
- this.map = map;
- this.shim = getOwn(config.shim, map.id);
- this.depExports = [];
- this.depMaps = [];
- this.depMatched = [];
- this.pluginMaps = {};
- this.depCount = 0;
-
- /* this.exports this.factory
- this.depMaps = [],
- this.enabled, this.fetched
- */
- };
-
- Module.prototype = {
- init: function (depMaps, factory, errback, options) {
- options = options || {};
-
- //Do not do more inits if already done. Can happen if there
- //are multiple define calls for the same module. That is not
- //a normal, common case, but it is also not unexpected.
- if (this.inited) {
- return;
- }
-
- this.factory = factory;
-
- if (errback) {
- //Register for errors on this module.
- this.on('error', errback);
- } else if (this.events.error) {
- //If no errback already, but there are error listeners
- //on this module, set up an errback to pass to the deps.
- errback = bind(this, function (err) {
- this.emit('error', err);
- });
- }
-
- //Do a copy of the dependency array, so that
- //source inputs are not modified. For example
- //"shim" deps are passed in here directly, and
- //doing a direct modification of the depMaps array
- //would affect that config.
- this.depMaps = depMaps && depMaps.slice(0);
-
- this.errback = errback;
-
- //Indicate this module has be initialized
- this.inited = true;
-
- this.ignore = options.ignore;
-
- //Could have option to init this module in enabled mode,
- //or could have been previously marked as enabled. However,
- //the dependencies are not known until init is called. So
- //if enabled previously, now trigger dependencies as enabled.
- if (options.enabled || this.enabled) {
- //Enable this module and dependencies.
- //Will call this.check()
- this.enable();
- } else {
- this.check();
- }
- },
-
- defineDep: function (i, depExports) {
- //Because of cycles, defined callback for a given
- //export can be called more than once.
- if (!this.depMatched[i]) {
- this.depMatched[i] = true;
- this.depCount -= 1;
- this.depExports[i] = depExports;
- }
- },
-
- fetch: function () {
- if (this.fetched) {
- return;
- }
- this.fetched = true;
-
- context.startTime = (new Date()).getTime();
-
- var map = this.map;
-
- //If the manager is for a plugin managed resource,
- //ask the plugin to load it now.
- if (this.shim) {
- context.makeRequire(this.map, {
- enableBuildCallback: true
- })(this.shim.deps || [], bind(this, function () {
- return map.prefix ? this.callPlugin() : this.load();
- }));
- } else {
- //Regular dependency.
- return map.prefix ? this.callPlugin() : this.load();
- }
- },
-
- load: function () {
- var url = this.map.url;
-
- //Regular dependency.
- if (!urlFetched[url]) {
- urlFetched[url] = true;
- context.load(this.map.id, url);
- }
- },
-
- /**
- * Checks if the module is ready to define itself, and if so,
- * define it.
- */
- check: function () {
- if (!this.enabled || this.enabling) {
- return;
- }
-
- var err, cjsModule,
- id = this.map.id,
- depExports = this.depExports,
- exports = this.exports,
- factory = this.factory;
-
- if (!this.inited) {
- this.fetch();
- } else if (this.error) {
- this.emit('error', this.error);
- } else if (!this.defining) {
- //The factory could trigger another require call
- //that would result in checking this module to
- //define itself again. If already in the process
- //of doing that, skip this work.
- this.defining = true;
-
- if (this.depCount < 1 && !this.defined) {
- if (isFunction(factory)) {
- //If there is an error listener, favor passing
- //to that instead of throwing an error. However,
- //only do it for define()'d modules. require
- //errbacks should not be called for failures in
- //their callbacks (#699). However if a global
- //onError is set, use that.
- if ((this.events.error && this.map.isDefine) ||
- req.onError !== defaultOnError) {
- try {
- exports = context.execCb(id, factory, depExports, exports);
- } catch (e) {
- err = e;
- }
- } else {
- exports = context.execCb(id, factory, depExports, exports);
- }
-
- // Favor return value over exports. If node/cjs in play,
- // then will not have a return value anyway. Favor
- // module.exports assignment over exports object.
- if (this.map.isDefine && exports === undefined) {
- cjsModule = this.module;
- if (cjsModule) {
- exports = cjsModule.exports;
- } else if (this.usingExports) {
- //exports already set the defined value.
- exports = this.exports;
- }
- }
-
- if (err) {
- err.requireMap = this.map;
- err.requireModules = this.map.isDefine ? [this.map.id] : null;
- err.requireType = this.map.isDefine ? 'define' : 'require';
- return onError((this.error = err));
- }
-
- } else {
- //Just a literal value
- exports = factory;
- }
-
- this.exports = exports;
-
- if (this.map.isDefine && !this.ignore) {
- defined[id] = exports;
-
- if (req.onResourceLoad) {
- req.onResourceLoad(context, this.map, this.depMaps);
- }
- }
-
- //Clean up
- cleanRegistry(id);
-
- this.defined = true;
- }
-
- //Finished the define stage. Allow calling check again
- //to allow define notifications below in the case of a
- //cycle.
- this.defining = false;
-
- if (this.defined && !this.defineEmitted) {
- this.defineEmitted = true;
- this.emit('defined', this.exports);
- this.defineEmitComplete = true;
- }
-
- }
- },
-
- callPlugin: function () {
- var map = this.map,
- id = map.id,
- //Map already normalized the prefix.
- pluginMap = makeModuleMap(map.prefix);
-
- //Mark this as a dependency for this plugin, so it
- //can be traced for cycles.
- this.depMaps.push(pluginMap);
-
- on(pluginMap, 'defined', bind(this, function (plugin) {
- var load, normalizedMap, normalizedMod,
- bundleId = getOwn(bundlesMap, this.map.id),
- name = this.map.name,
- parentName = this.map.parentMap ? this.map.parentMap.name : null,
- localRequire = context.makeRequire(map.parentMap, {
- enableBuildCallback: true
- });
-
- //If current map is not normalized, wait for that
- //normalized name to load instead of continuing.
- if (this.map.unnormalized) {
- //Normalize the ID if the plugin allows it.
- if (plugin.normalize) {
- name = plugin.normalize(name, function (name) {
- return normalize(name, parentName, true);
- }) || '';
- }
-
- //prefix and name should already be normalized, no need
- //for applying map config again either.
- normalizedMap = makeModuleMap(map.prefix + '!' + name,
- this.map.parentMap);
- on(normalizedMap,
- 'defined', bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true,
- ignore: true
- });
- }));
-
- normalizedMod = getOwn(registry, normalizedMap.id);
- if (normalizedMod) {
- //Mark this as a dependency for this plugin, so it
- //can be traced for cycles.
- this.depMaps.push(normalizedMap);
-
- if (this.events.error) {
- normalizedMod.on('error', bind(this, function (err) {
- this.emit('error', err);
- }));
- }
- normalizedMod.enable();
- }
-
- return;
- }
-
- //If a paths config, then just load that file instead to
- //resolve the plugin, as it is built into that paths layer.
- if (bundleId) {
- this.map.url = context.nameToUrl(bundleId);
- this.load();
- return;
- }
-
- load = bind(this, function (value) {
- this.init([], function () { return value; }, null, {
- enabled: true
- });
- });
-
- load.error = bind(this, function (err) {
- this.inited = true;
- this.error = err;
- err.requireModules = [id];
-
- //Remove temp unnormalized modules for this module,
- //since they will never be resolved otherwise now.
- eachProp(registry, function (mod) {
- if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
- cleanRegistry(mod.map.id);
- }
- });
-
- onError(err);
- });
-
- //Allow plugins to load other code without having to know the
- //context or how to 'complete' the load.
- load.fromText = bind(this, function (text, textAlt) {
- /*jslint evil: true */
- var moduleName = map.name,
- moduleMap = makeModuleMap(moduleName),
- hasInteractive = useInteractive;
-
- //As of 2.1.0, support just passing the text, to reinforce
- //fromText only being called once per resource. Still
- //support old style of passing moduleName but discard
- //that moduleName in favor of the internal ref.
- if (textAlt) {
- text = textAlt;
- }
-
- //Turn off interactive script matching for IE for any define
- //calls in the text, then turn it back on at the end.
- if (hasInteractive) {
- useInteractive = false;
- }
-
- //Prime the system by creating a module instance for
- //it.
- getModule(moduleMap);
-
- //Transfer any config to this other module.
- if (hasProp(config.config, id)) {
- config.config[moduleName] = config.config[id];
- }
-
- try {
- req.exec(text);
- } catch (e) {
- return onError(makeError('fromtexteval',
- 'fromText eval for ' + id +
- ' failed: ' + e,
- e,
- [id]));
- }
-
- if (hasInteractive) {
- useInteractive = true;
- }
-
- //Mark this as a dependency for the plugin
- //resource
- this.depMaps.push(moduleMap);
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
-
- //Bind the value of that module to the value for this
- //resource ID.
- localRequire([moduleName], load);
- });
-
- //Use parentName here since the plugin's name is not reliable,
- //could be some weird string with no path that actually wants to
- //reference the parentName's path.
- plugin.load(map.name, localRequire, load, config);
- }));
-
- context.enable(pluginMap, this);
- this.pluginMaps[pluginMap.id] = pluginMap;
- },
-
- enable: function () {
- enabledRegistry[this.map.id] = this;
- this.enabled = true;
-
- //Set flag mentioning that the module is enabling,
- //so that immediate calls to the defined callbacks
- //for dependencies do not trigger inadvertent load
- //with the depCount still being zero.
- this.enabling = true;
-
- //Enable each dependency
- each(this.depMaps, bind(this, function (depMap, i) {
- var id, mod, handler;
-
- if (typeof depMap === 'string') {
- //Dependency needs to be converted to a depMap
- //and wired up to this module.
- depMap = makeModuleMap(depMap,
- (this.map.isDefine ? this.map : this.map.parentMap),
- false,
- !this.skipMap);
- this.depMaps[i] = depMap;
-
- handler = getOwn(handlers, depMap.id);
-
- if (handler) {
- this.depExports[i] = handler(this);
- return;
- }
-
- this.depCount += 1;
-
- on(depMap, 'defined', bind(this, function (depExports) {
- this.defineDep(i, depExports);
- this.check();
- }));
-
- if (this.errback) {
- on(depMap, 'error', bind(this, this.errback));
- }
- }
-
- id = depMap.id;
- mod = registry[id];
-
- //Skip special modules like 'require', 'exports', 'module'
- //Also, don't call enable if it is already enabled,
- //important in circular dependency cases.
- if (!hasProp(handlers, id) && mod && !mod.enabled) {
- context.enable(depMap, this);
- }
- }));
-
- //Enable each plugin that is used in
- //a dependency
- eachProp(this.pluginMaps, bind(this, function (pluginMap) {
- var mod = getOwn(registry, pluginMap.id);
- if (mod && !mod.enabled) {
- context.enable(pluginMap, this);
- }
- }));
-
- this.enabling = false;
-
- this.check();
- },
-
- on: function (name, cb) {
- var cbs = this.events[name];
- if (!cbs) {
- cbs = this.events[name] = [];
- }
- cbs.push(cb);
- },
-
- emit: function (name, evt) {
- each(this.events[name], function (cb) {
- cb(evt);
- });
- if (name === 'error') {
- //Now that the error handler was triggered, remove
- //the listeners, since this broken Module instance
- //can stay around for a while in the registry.
- delete this.events[name];
- }
- }
- };
-
- function callGetModule(args) {
- //Skip modules already defined.
- if (!hasProp(defined, args[0])) {
- getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
- }
- }
-
- function removeListener(node, func, name, ieName) {
- //Favor detachEvent because of IE9
- //issue, see attachEvent/addEventListener comment elsewhere
- //in this file.
- if (node.detachEvent && !isOpera) {
- //Probably IE. If not it will throw an error, which will be
- //useful to know.
- if (ieName) {
- node.detachEvent(ieName, func);
- }
- } else {
- node.removeEventListener(name, func, false);
- }
- }
-
- /**
- * Given an event from a script node, get the requirejs info from it,
- * and then removes the event listeners on the node.
- * @param {Event} evt
- * @returns {Object}
- */
- function getScriptData(evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- var node = evt.currentTarget || evt.srcElement;
-
- //Remove the listeners once here.
- removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
- removeListener(node, context.onScriptError, 'error');
-
- return {
- node: node,
- id: node && node.getAttribute('data-requiremodule')
- };
- }
-
- function intakeDefines() {
- var args;
-
- //Any defined modules in the global queue, intake them now.
- takeGlobalQueue();
-
- //Make sure any remaining defQueue items get properly processed.
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
- } else {
- //args are id, deps, factory. Should be normalized by the
- //define() function.
- callGetModule(args);
- }
- }
- }
-
- context = {
- config: config,
- contextName: contextName,
- registry: registry,
- defined: defined,
- urlFetched: urlFetched,
- defQueue: defQueue,
- Module: Module,
- makeModuleMap: makeModuleMap,
- nextTick: req.nextTick,
- onError: onError,
-
- /**
- * Set a configuration for the context.
- * @param {Object} cfg config object to integrate.
- */
- configure: function (cfg) {
- //Make sure the baseUrl ends in a slash.
- if (cfg.baseUrl) {
- if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
- cfg.baseUrl += '/';
- }
- }
-
- //Save off the paths since they require special processing,
- //they are additive.
- var shim = config.shim,
- objs = {
- paths: true,
- bundles: true,
- config: true,
- map: true
- };
-
- eachProp(cfg, function (value, prop) {
- if (objs[prop]) {
- if (!config[prop]) {
- config[prop] = {};
- }
- mixin(config[prop], value, true, true);
- } else {
- config[prop] = value;
- }
- });
-
- //Reverse map the bundles
- if (cfg.bundles) {
- eachProp(cfg.bundles, function (value, prop) {
- each(value, function (v) {
- if (v !== prop) {
- bundlesMap[v] = prop;
- }
- });
- });
- }
-
- //Merge shim
- if (cfg.shim) {
- eachProp(cfg.shim, function (value, id) {
- //Normalize the structure
- if (isArray(value)) {
- value = {
- deps: value
- };
- }
- if ((value.exports || value.init) && !value.exportsFn) {
- value.exportsFn = context.makeShimExports(value);
- }
- shim[id] = value;
- });
- config.shim = shim;
- }
-
- //Adjust packages if necessary.
- if (cfg.packages) {
- each(cfg.packages, function (pkgObj) {
- var location, name;
-
- pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
-
- name = pkgObj.name;
- location = pkgObj.location;
- if (location) {
- config.paths[name] = pkgObj.location;
- }
-
- //Save pointer to main module ID for pkg name.
- //Remove leading dot in main, so main paths are normalized,
- //and remove any trailing .js, since different package
- //envs have different conventions: some use a module name,
- //some use a file name.
- config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
- .replace(currDirRegExp, '')
- .replace(jsSuffixRegExp, '');
- });
- }
-
- //If there are any "waiting to execute" modules in the registry,
- //update the maps for them, since their info, like URLs to load,
- //may have changed.
- eachProp(registry, function (mod, id) {
- //If module already has init called, since it is too
- //late to modify them, and ignore unnormalized ones
- //since they are transient.
- if (!mod.inited && !mod.map.unnormalized) {
- mod.map = makeModuleMap(id);
- }
- });
-
- //If a deps array or a config callback is specified, then call
- //require with those args. This is useful when require is defined as a
- //config object before require.js is loaded.
- if (cfg.deps || cfg.callback) {
- context.require(cfg.deps || [], cfg.callback);
- }
- },
-
- makeShimExports: function (value) {
- function fn() {
- var ret;
- if (value.init) {
- ret = value.init.apply(global, arguments);
- }
- return ret || (value.exports && getGlobal(value.exports));
- }
- return fn;
- },
-
- makeRequire: function (relMap, options) {
- options = options || {};
-
- function localRequire(deps, callback, errback) {
- var id, map, requireMod;
-
- if (options.enableBuildCallback && callback && isFunction(callback)) {
- callback.__requireJsBuild = true;
- }
-
- if (typeof deps === 'string') {
- if (isFunction(callback)) {
- //Invalid call
- return onError(makeError('requireargs', 'Invalid require call'), errback);
- }
-
- //If require|exports|module are requested, get the
- //value for them from the special handlers. Caveat:
- //this only works while module is being defined.
- if (relMap && hasProp(handlers, deps)) {
- return handlers[deps](registry[relMap.id]);
- }
-
- //Synchronous access to one module. If require.get is
- //available (as in the Node adapter), prefer that.
- if (req.get) {
- return req.get(context, deps, relMap, localRequire);
- }
-
- //Normalize module name, if it contains . or ..
- map = makeModuleMap(deps, relMap, false, true);
- id = map.id;
-
- if (!hasProp(defined, id)) {
- return onError(makeError('notloaded', 'Module name "' +
- id +
- '" has not been loaded yet for context: ' +
- contextName +
- (relMap ? '' : '. Use require([])')));
- }
- return defined[id];
- }
-
- //Grab defines waiting in the global queue.
- intakeDefines();
-
- //Mark all the dependencies as needing to be loaded.
- context.nextTick(function () {
- //Some defines could have been added since the
- //require call, collect them.
- intakeDefines();
-
- requireMod = getModule(makeModuleMap(null, relMap));
-
- //Store if map config should be applied to this require
- //call for dependencies.
- requireMod.skipMap = options.skipMap;
-
- requireMod.init(deps, callback, errback, {
- enabled: true
- });
-
- checkLoaded();
- });
-
- return localRequire;
- }
-
- mixin(localRequire, {
- isBrowser: isBrowser,
-
- /**
- * Converts a module name + .extension into an URL path.
- * *Requires* the use of a module name. It does not support using
- * plain URLs like nameToUrl.
- */
- toUrl: function (moduleNamePlusExt) {
- var ext,
- index = moduleNamePlusExt.lastIndexOf('.'),
- segment = moduleNamePlusExt.split('/')[0],
- isRelative = segment === '.' || segment === '..';
-
- //Have a file extension alias, and it is not the
- //dots from a relative path.
- if (index !== -1 && (!isRelative || index > 1)) {
- ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
- moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
- }
-
- return context.nameToUrl(normalize(moduleNamePlusExt,
- relMap && relMap.id, true), ext, true);
- },
-
- defined: function (id) {
- return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
- },
-
- specified: function (id) {
- id = makeModuleMap(id, relMap, false, true).id;
- return hasProp(defined, id) || hasProp(registry, id);
- }
- });
-
- //Only allow undef on top level require calls
- if (!relMap) {
- localRequire.undef = function (id) {
- //Bind any waiting define() calls to this context,
- //fix for #408
- takeGlobalQueue();
-
- var map = makeModuleMap(id, relMap, true),
- mod = getOwn(registry, id);
-
- removeScript(id);
-
- delete defined[id];
- delete urlFetched[map.url];
- delete undefEvents[id];
-
- //Clean queued defines too. Go backwards
- //in array so that the splices do not
- //mess up the iteration.
- eachReverse(defQueue, function(args, i) {
- if(args[0] === id) {
- defQueue.splice(i, 1);
- }
- });
-
- if (mod) {
- //Hold on to listeners in case the
- //module will be attempted to be reloaded
- //using a different config.
- if (mod.events.defined) {
- undefEvents[id] = mod.events;
- }
-
- cleanRegistry(id);
- }
- };
- }
-
- return localRequire;
- },
-
- /**
- * Called to enable a module if it is still in the registry
- * awaiting enablement. A second arg, parent, the parent module,
- * is passed in for context, when this method is overridden by
- * the optimizer. Not shown here to keep code compact.
- */
- enable: function (depMap) {
- var mod = getOwn(registry, depMap.id);
- if (mod) {
- getModule(depMap).enable();
- }
- },
-
- /**
- * Internal method used by environment adapters to complete a load event.
- * A load event could be a script load or just a load pass from a synchronous
- * load call.
- * @param {String} moduleName the name of the module to potentially complete.
- */
- completeLoad: function (moduleName) {
- var found, args, mod,
- shim = getOwn(config.shim, moduleName) || {},
- shExports = shim.exports;
-
- takeGlobalQueue();
-
- while (defQueue.length) {
- args = defQueue.shift();
- if (args[0] === null) {
- args[0] = moduleName;
- //If already found an anonymous module and bound it
- //to this name, then this is some other anon module
- //waiting for its completeLoad to fire.
- if (found) {
- break;
- }
- found = true;
- } else if (args[0] === moduleName) {
- //Found matching define call for this script!
- found = true;
- }
-
- callGetModule(args);
- }
-
- //Do this after the cycle of callGetModule in case the result
- //of those calls/init calls changes the registry.
- mod = getOwn(registry, moduleName);
-
- if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
- if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
- if (hasPathFallback(moduleName)) {
- return;
- } else {
- return onError(makeError('nodefine',
- 'No define call for ' + moduleName,
- null,
- [moduleName]));
- }
- } else {
- //A script that does not call define(), so just simulate
- //the call for it.
- callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
- }
- }
-
- checkLoaded();
- },
-
- /**
- * Converts a module name to a file path. Supports cases where
- * moduleName may actually be just an URL.
- * Note that it **does not** call normalize on the moduleName,
- * it is assumed to have already been normalized. This is an
- * internal API, not a public one. Use toUrl for the public API.
- */
- nameToUrl: function (moduleName, ext, skipExt) {
- var paths, syms, i, parentModule, url,
- parentPath, bundleId,
- pkgMain = getOwn(config.pkgs, moduleName);
-
- if (pkgMain) {
- moduleName = pkgMain;
- }
-
- bundleId = getOwn(bundlesMap, moduleName);
-
- if (bundleId) {
- return context.nameToUrl(bundleId, ext, skipExt);
- }
-
- //If a colon is in the URL, it indicates a protocol is used and it is just
- //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
- //or ends with .js, then assume the user meant to use an url and not a module id.
- //The slash is important for protocol-less URLs as well as full paths.
- if (req.jsExtRegExp.test(moduleName)) {
- //Just a plain path, not module name lookup, so just return it.
- //Add extension if it is included. This is a bit wonky, only non-.js things pass
- //an extension, this method probably needs to be reworked.
- url = moduleName + (ext || '');
- } else {
- //A module that needs to be converted to a path.
- paths = config.paths;
-
- syms = moduleName.split('/');
- //For each module name segment, see if there is a path
- //registered for it. Start with most specific name
- //and work up from it.
- for (i = syms.length; i > 0; i -= 1) {
- parentModule = syms.slice(0, i).join('/');
-
- parentPath = getOwn(paths, parentModule);
- if (parentPath) {
- //If an array, it means there are a few choices,
- //Choose the one that is desired
- if (isArray(parentPath)) {
- parentPath = parentPath[0];
- }
- syms.splice(0, i, parentPath);
- break;
- }
- }
-
- //Join the path parts together, then figure out if baseUrl is needed.
- url = syms.join('/');
- url += (ext || (/^data:|\?/.test(url) || skipExt ? '' : '.js'));
- url = (url.charAt(0) === '/' || url.match(/^[\w+.\-]+:/) ? '' : config.baseUrl) + url;
- }
-
- return config.urlArgs ? url +
- ((url.indexOf('?') === -1 ? '?' : '&') +
- config.urlArgs) : url;
- },
-
- //Delegates to req.load. Broken out as a separate function to
- //allow overriding in the optimizer.
- load: function (id, url) {
- req.load(context, id, url);
- },
-
- /**
- * Executes a module callback function. Broken out as a separate function
- * solely to allow the build system to sequence the files in the built
- * layer in the right sequence.
- *
- * @private
- */
- execCb: function (name, callback, args, exports) {
- return callback.apply(exports, args);
- },
-
- /**
- * callback for script loads, used to check status of loading.
- *
- * @param {Event} evt the event from the browser for the script
- * that was loaded.
- */
- onScriptLoad: function (evt) {
- //Using currentTarget instead of target for Firefox 2.0's sake. Not
- //all old browsers will be supported, but this one was easy enough
- //to support and still makes sense.
- if (evt.type === 'load' ||
- (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
- //Reset interactive script so a script node is not held onto for
- //to long.
- interactiveScript = null;
-
- //Pull out the name of the module and the context.
- var data = getScriptData(evt);
- context.completeLoad(data.id);
- }
- },
-
- /**
- * Callback for script errors.
- */
- onScriptError: function (evt) {
- var data = getScriptData(evt);
- if (!hasPathFallback(data.id)) {
- return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
- }
- }
- };
-
- context.require = context.makeRequire();
- return context;
- }
-
- /**
- * Main entry point.
- *
- * If the only argument to require is a string, then the module that
- * is represented by that string is fetched for the appropriate context.
- *
- * If the first argument is an array, then it will be treated as an array
- * of dependency string names to fetch. An optional function callback can
- * be specified to execute when all of those dependencies are available.
- *
- * Make a local req variable to help Caja compliance (it assumes things
- * on a require that are not standardized), and to give a short
- * name for minification/local scope use.
- */
- req = requirejs = function (deps, callback, errback, optional) {
-
- //Find the right context, use default
- var context, config,
- contextName = defContextName;
-
- // Determine if have config object in the call.
- if (!isArray(deps) && typeof deps !== 'string') {
- // deps is a config object
- config = deps;
- if (isArray(callback)) {
- // Adjust args if there are dependencies
- deps = callback;
- callback = errback;
- errback = optional;
- } else {
- deps = [];
- }
- }
-
- if (config && config.context) {
- contextName = config.context;
- }
-
- context = getOwn(contexts, contextName);
- if (!context) {
- context = contexts[contextName] = req.s.newContext(contextName);
- }
-
- if (config) {
- context.configure(config);
- }
-
- return context.require(deps, callback, errback);
- };
-
- /**
- * Support require.config() to make it easier to cooperate with other
- * AMD loaders on globally agreed names.
- */
- req.config = function (config) {
- return req(config);
- };
-
- /**
- * Execute something after the current tick
- * of the event loop. Override for other envs
- * that have a better solution than setTimeout.
- * @param {Function} fn function to execute later.
- */
- req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
- setTimeout(fn, 4);
- } : function (fn) { fn(); };
-
- /**
- * Export require as a global, but only if it does not already exist.
- */
- if (!require) {
- require = req;
- }
-
- req.version = version;
-
- //Used to filter out dependencies that are already paths.
- req.jsExtRegExp = /^\/|:|\?|\.js$/;
- req.isBrowser = isBrowser;
- s = req.s = {
- contexts: contexts,
- newContext: newContext
- };
-
- //Create default context.
- req({});
-
- //Exports some context-sensitive methods on global require.
- each([
- 'toUrl',
- 'undef',
- 'defined',
- 'specified'
- ], function (prop) {
- //Reference from contexts instead of early binding to default context,
- //so that during builds, the latest instance of the default context
- //with its config gets used.
- req[prop] = function () {
- var ctx = contexts[defContextName];
- return ctx.require[prop].apply(ctx, arguments);
- };
- });
-
- if (isBrowser) {
- head = s.head = document.getElementsByTagName('head')[0];
- //If BASE tag is in play, using appendChild is a problem for IE6.
- //When that browser dies, this can be removed. Details in this jQuery bug:
- //http://dev.jquery.com/ticket/2709
- baseElement = document.getElementsByTagName('base')[0];
- if (baseElement) {
- head = s.head = baseElement.parentNode;
- }
- }
-
- /**
- * Any errors that require explicitly generates will be passed to this
- * function. Intercept/override it if you want custom error handling.
- * @param {Error} err the error object.
- */
- req.onError = defaultOnError;
-
- /**
- * Creates the node for the load command. Only used in browser envs.
- */
- req.createNode = function (config, moduleName, url) {
- var node = config.xhtml ?
- document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
- document.createElement('script');
- node.type = config.scriptType || 'text/javascript';
- node.charset = 'utf-8';
- node.async = true;
- return node;
- };
-
- /**
- * Does the request to load a module for the browser case.
- * Make this a separate function to allow other environments
- * to override it.
- *
- * @param {Object} context the require context to find state.
- * @param {String} moduleName the name of the module.
- * @param {Object} url the URL to the module.
- */
- req.load = function (context, moduleName, url) {
- var config = (context && context.config) || {},
- node;
- if (isBrowser) {
- //In the browser so use a script tag
- node = req.createNode(config, moduleName, url);
-
- node.setAttribute('data-requirecontext', context.contextName);
- node.setAttribute('data-requiremodule', moduleName);
-
- //Set up load listener. Test attachEvent first because IE9 has
- //a subtle issue in its addEventListener and script onload firings
- //that do not match the behavior of all other browsers with
- //addEventListener support, which fire the onload event for a
- //script right after the script execution. See:
- //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
- //UNFORTUNATELY Opera implements attachEvent but does not follow the script
- //script execution mode.
- if (node.attachEvent &&
- //Check if node.attachEvent is artificially added by custom script or
- //natively supported by browser
- //read https://github.com/jrburke/requirejs/issues/187
- //if we can NOT find [native code] then it must NOT natively supported.
- //in IE8, node.attachEvent does not have toString()
- //Note the test for "[native code" with no closing brace, see:
- //https://github.com/jrburke/requirejs/issues/273
- !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
- !isOpera) {
- //Probably IE. IE (at least 6-8) do not fire
- //script onload right after executing the script, so
- //we cannot tie the anonymous define call to a name.
- //However, IE reports the script as being in 'interactive'
- //readyState at the time of the define call.
- useInteractive = true;
-
- node.attachEvent('onreadystatechange', context.onScriptLoad);
- //It would be great to add an error handler here to catch
- //404s in IE9+. However, onreadystatechange will fire before
- //the error handler, so that does not help. If addEventListener
- //is used, then IE will fire error before load, but we cannot
- //use that pathway given the connect.microsoft.com issue
- //mentioned above about not doing the 'script execute,
- //then fire the script load event listener before execute
- //next script' that other browsers do.
- //Best hope: IE10 fixes the issues,
- //and then destroys all installs of IE 6-9.
- //node.attachEvent('onerror', context.onScriptError);
- } else {
- node.addEventListener('load', context.onScriptLoad, false);
- node.addEventListener('error', context.onScriptError, false);
- }
- node.src = url;
-
- //For some cache cases in IE 6-8, the script executes before the end
- //of the appendChild execution, so to tie an anonymous define
- //call to the module name (which is stored on the node), hold on
- //to a reference to this node, but clear after the DOM insertion.
- currentlyAddingScript = node;
- if (baseElement) {
- head.insertBefore(node, baseElement);
- } else {
- head.appendChild(node);
- }
- currentlyAddingScript = null;
-
- return node;
- } else if (isWebWorker) {
- try {
- //In a web worker, use importScripts. This is not a very
- //efficient use of importScripts, importScripts will block until
- //its script is downloaded and evaluated. However, if web workers
- //are in play, the expectation that a build has been done so that
- //only one script needs to be loaded anyway. This may need to be
- //reevaluated if other use cases become common.
- importScripts(url);
-
- //Account for anonymous modules
- context.completeLoad(moduleName);
- } catch (e) {
- context.onError(makeError('importscripts',
- 'importScripts failed for ' +
- moduleName + ' at ' + url,
- e,
- [moduleName]));
- }
- }
- };
-
- function getInteractiveScript() {
- if (interactiveScript && interactiveScript.readyState === 'interactive') {
- return interactiveScript;
- }
-
- eachReverse(scripts(), function (script) {
- if (script.readyState === 'interactive') {
- return (interactiveScript = script);
- }
- });
- return interactiveScript;
- }
-
- //Look for a data-main script attribute, which could also adjust the baseUrl.
- if (isBrowser && !cfg.skipDataMain) {
- //Figure out baseUrl. Get it from the script tag with require.js in it.
- eachReverse(scripts(), function (script) {
- //Set the 'head' where we can append children by
- //using the script's parent.
- if (!head) {
- head = script.parentNode;
- }
-
- //Look for a data-main attribute to set main script for the page
- //to load. If it is there, the path to data main becomes the
- //baseUrl, if it is not already set.
- dataMain = script.getAttribute('data-main');
- if (dataMain) {
- //Preserve dataMain in case it is a path (i.e. contains '?')
- mainScript = dataMain;
-
- //Set final baseUrl if there is not already an explicit one.
- if (!cfg.baseUrl) {
- //Pull off the directory of data-main for use as the
- //baseUrl.
- src = mainScript.split('/');
- mainScript = src.pop();
- subPath = src.length ? src.join('/') + '/' : './';
-
- cfg.baseUrl = subPath;
- }
-
- //Strip off any trailing .js since mainScript is now
- //like a module name.
- mainScript = mainScript.replace(jsSuffixRegExp, '');
-
- //If mainScript is still a path, fall back to dataMain
- if (req.jsExtRegExp.test(mainScript)) {
- mainScript = dataMain;
- }
-
- //Put the data-main script in the files to load.
- cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
-
- return true;
- }
- });
- }
-
- /**
- * The function that handles definitions of modules. Differs from
- * require() in that a string for the module should be the first argument,
- * and the function to execute after dependencies are loaded should
- * return a value to define the module corresponding to the first argument's
- * name.
- */
- define = function (name, deps, callback) {
- var node, context;
-
- //Allow for anonymous modules
- if (typeof name !== 'string') {
- //Adjust args appropriately
- callback = deps;
- deps = name;
- name = null;
- }
-
- //This module may not have dependencies
- if (!isArray(deps)) {
- callback = deps;
- deps = null;
- }
-
- //If no name, and callback is a function, then figure out if it a
- //CommonJS thing with dependencies.
- if (!deps && isFunction(callback)) {
- deps = [];
- //Remove comments from the callback string,
- //look for require calls, and pull them into the dependencies,
- //but only if there are function args.
- if (callback.length) {
- callback
- .toString()
- .replace(commentRegExp, '')
- .replace(cjsRequireRegExp, function (match, dep) {
- deps.push(dep);
- });
-
- //May be a CommonJS thing even without require calls, but still
- //could use exports, and module. Avoid doing exports and module
- //work though if it just needs require.
- //REQUIRES the function to expect the CommonJS variables in the
- //order listed below.
- deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
- }
- }
-
- //If in IE 6-8 and hit an anonymous define() call, do the interactive
- //work.
- if (useInteractive) {
- node = currentlyAddingScript || getInteractiveScript();
- if (node) {
- if (!name) {
- name = node.getAttribute('data-requiremodule');
- }
- context = contexts[node.getAttribute('data-requirecontext')];
- }
- }
-
- //Always save off evaluating the def call until the script onload handler.
- //This allows multiple modules to be in a file without prematurely
- //tracing dependencies, and allows for anonymous module support,
- //where the module name is not known until the script onload event
- //occurs. If no context, use the global queue, and get it processed
- //in the onscript load callback.
- (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
- };
-
- define.amd = {
- jQuery: true
- };
-
-
- /**
- * Executes the text. Normally just uses eval, but can be modified
- * to use a better, environment-specific call. Only used for transpiling
- * loader plugins, not for plain JS modules.
- * @param {String} text the text to execute/evaluate.
- */
- req.exec = function (text) {
- /*jslint evil: true */
- return eval(text);
- };
-
- //Set up with config info.
- req(cfg);
-}(this));
diff --git a/admin-panel/app/views/menuView.js b/admin-panel/app/views/menuView.js
deleted file mode 100755
index 5f84afb1..00000000
--- a/admin-panel/app/views/menuView.js
+++ /dev/null
@@ -1,190 +0,0 @@
-var http = require('http');
-var domain = "127.0.0.1";
-var playerChart;
-var AUTH_CODE = "rCh9yvT7WL4Q1TG6ySxlOB8At19jvDdb";
-
-var fetchInfo = function(callback) {
- var options = {
- host: domain,
- path: '/admin/info',
- port: '8080',
- headers: { 'X-AdminKey': AUTH_CODE}
- };
-
- var req = http.request(options, function(res) {
- if (res.statusCode == 401) {
- alert("Auth failed with server!");
- process.exit();
- return;
- }
-
- var data = '';
- res.on('data', function(chunk) {
- data += chunk;
- });
-
- res.on('end', function() {
- var info = JSON.parse(data);
- callback(info);
- });
- });
- req.on('error', function(e) {
- alert("Could not connect to server!\n" + e);
- process.exit();
- });
- req.end();
-};
-
-var fetchServers = function(callback) {
- var options = {
- host: domain,
- path: '/admin/servers',
- port: '8080',
- headers: { 'X-AdminKey': AUTH_CODE}
- };
-
- var req = http.request(options, function(res) {
- if (res.statusCode == 401) {
- alert("Auth failed with server!");
- process.exit();
- return;
- }
-
- var data = '';
- res.on('data', function(chunk) {
- data += chunk;
- });
-
- res.on('end', function() {
- var info = JSON.parse(data);
- callback(info);
- });
- });
- req.on('error', function(e) {
- alert("Could not connect to server!\n" + e);
- process.exit();
- });
- req.end();
-};
-
-
-
-var updateChart = function() {
- fetchInfo(function(info) {
- var date = new Date();
- var time = date.getHours() + ":" + date.getMinutes();
-
- playerChart.addData([info.playersInQueue], time);
- });
-};
-
-var toStream = function(level) {
- switch (level) {
- case 0:
- return 'Test';
- case 1:
- return 'Alpha';
- case 2:
- return 'Beta';
- case 3:
- return 'Buffered';
- case 4:
- return 'Live';
- default:
- return 'UNKNOWN';
- }
-};
-
-var toQueue = function(queue) {
- switch (queue) {
- case 1:
- return 'Original';
- case 2:
- return 'Laser';
- case 3:
- return 'Weapon Select';
- case 4:
- return '2v2 Weapon Select';
- case 5:
- return 'Dash';
- case 6:
- return 'Tutorial';
- case 7:
- return 'Boomerrang';
- case 8:
- return 'Ranked';
- case 254:
- return 'Test';
- default:
- return 'UNKNOWN';
- }
-};
-
-var updateServers = function() {
- var list = $('#server-list');
- fetchServers(function(servers) {
- list.empty();
- servers.forEach(function(server) {
- var html = ' ' +
- '
' +
- '
Name: ' + server.config.internal_name + '
' +
- '
ID: ' + server.config.id + '
' +
- '
Stream: ' + toStream(server.config.streamLevel) + '
' +
- '
Queue: ' + toQueue(server.config.queueServing) + '
' +
- '
' +
- '
' +
- '
IP: ' + server.config.ip + '
' +
- '
Port: ' + server.config.port + '
' +
- '
Match Count: ' + (server.config.server ? server.config.server.matchCount : 'offline') + '
' +
- '
Player Count: ' + (server.config.server ? server.config.server.playerCount : 'offline') + '
' +
- '
' +
- '
' +
- '
' +
- '
' +
- '
' +
- ' ';
-
- var element = $.parseHTML(html);
- list.append(element);
- });
- });
-};
-
-$(document).ready(function() {
- $('#loginLoading').foundation('reveal', 'open');
-
- fetchInfo(function(info) {
- var ctx = $('#playersOnline').get(0).getContext("2d");
-
- var date = new Date();
- var time = date.getHours() + ":" + date.getMinutes();
-
- var data = {
- labels: [ time ],
- datasets: [
- {
- label: time,
- fillColor: "rgba(220,220,220,0.2)",
- strokeColor: "rgba(220,220,220,1)",
- pointColor: "rgba(220,220,220,1)",
- pointStrokeColor: "#fff",
- pointHighlightFill: "#fff",
- pointHighlightStroke: "rgba(220,220,220,1)",
- data: [info.playersInQueue]
- }
- ]
- };
-
- playerChart = new Chart(ctx).Line(data, {
- bezierCurve: false
- });
-
- $('#matches').text('Matches: ' + info.matchCount);
- $('#serverCount').text('Servers: ' + info.connectedServers);
-
- setInterval(updateChart, 60000);
- setInterval(updateServers, 10000);
-
- $('#loginLoading').foundation('reveal', 'close');
- })
-});
\ No newline at end of file
diff --git a/admin-panel/bower.json b/admin-panel/bower.json
deleted file mode 100755
index 50cd3b49..00000000
--- a/admin-panel/bower.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "name": "Project Ghost Launcher",
- "version": "0.0.1a",
- "homepage": "https://github.com/hypereddie/Ghost-Shadow-Warrior-Phantom-Assault-DX",
- "authors": [
- "Cat In Cup"
- ],
- "description": "Launches the main game",
- "main": "index.html",
- "moduleType": [
- "es6",
- "globals",
- "node"
- ],
- "license": "MIT",
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "test",
- "tests"
- ],
- "dependencies": {
- "foundation": "~5.5.1",
- "fontawesome": "~4.3.0",
- "loaders.css": "0.0.2",
- "Chart.js": "~1.0.2"
- }
-}
diff --git a/admin-panel/gulpfile.js b/admin-panel/gulpfile.js
deleted file mode 100755
index 0f721834..00000000
--- a/admin-panel/gulpfile.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict';
-
-require('./tasks/build');
-require('./tasks/start');
-require('./tasks/release');
\ No newline at end of file
diff --git a/admin-panel/os/icon.png b/admin-panel/os/icon.png
deleted file mode 100755
index 455648f8..00000000
Binary files a/admin-panel/os/icon.png and /dev/null differ
diff --git a/admin-panel/os/linux/DEBIAN/control b/admin-panel/os/linux/DEBIAN/control
deleted file mode 100755
index d989bfb6..00000000
--- a/admin-panel/os/linux/DEBIAN/control
+++ /dev/null
@@ -1,7 +0,0 @@
-Package: {{name}}
-Version: {{version}}
-Maintainer: {{author}}
-Priority: optional
-Architecture: amd64
-Installed-Size: {{size}}
-Description: {{description}}
diff --git a/admin-panel/os/linux/app.desktop b/admin-panel/os/linux/app.desktop
deleted file mode 100755
index 0e9c926c..00000000
--- a/admin-panel/os/linux/app.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Type=Application
-Encoding=UTF-8
-Name={{prettyName}}
-Comment={{description}}
-Exec=/opt/{{name}}/nw
-Icon=/opt/{{name}}/icon.png
-Terminal=false
-Categories=Application;
\ No newline at end of file
diff --git a/admin-panel/os/osx/Info.plist b/admin-panel/os/osx/Info.plist
deleted file mode 100755
index 28460d05..00000000
--- a/admin-panel/os/osx/Info.plist
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- CFBundleDevelopmentRegion
- en
- CFBundleDisplayName
- {{prettyName}}
- CFBundleExecutable
- nwjs
- CFBundleIconFile
- icon.icns
- CFBundleIdentifier
- com.intel.nw
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- {{prettyName}}
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- {{version}}
- CFBundleVersion
- {{version}}
- LSFileQuarantineEnabled
-
- LSMinimumSystemVersion
- 10.6.0
- NSPrincipalClass
- NSApplication
- NSSupportsAutomaticGraphicsSwitching
-
-
-
diff --git a/admin-panel/os/osx/appdmg.json b/admin-panel/os/osx/appdmg.json
deleted file mode 100755
index 3b6d9806..00000000
--- a/admin-panel/os/osx/appdmg.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "title": "{{prettyName}}",
- "icon": "{{dmgIcon}}",
- "background": "{{dmgBackground}}",
- "icon-size": 128,
- "contents": [
- { "x": 410, "y": 220, "type": "link", "path": "/Applications" },
- { "x": 130, "y": 220, "type": "file", "path": "{{appPath}}" }
- ]
-}
diff --git a/admin-panel/os/osx/dmg-background.png b/admin-panel/os/osx/dmg-background.png
deleted file mode 100755
index 90deafab..00000000
Binary files a/admin-panel/os/osx/dmg-background.png and /dev/null differ
diff --git a/admin-panel/os/osx/dmg-background@2x.png b/admin-panel/os/osx/dmg-background@2x.png
deleted file mode 100755
index 1caff048..00000000
Binary files a/admin-panel/os/osx/dmg-background@2x.png and /dev/null differ
diff --git a/admin-panel/os/osx/dmg-icon.icns b/admin-panel/os/osx/dmg-icon.icns
deleted file mode 100755
index ef0c701d..00000000
Binary files a/admin-panel/os/osx/dmg-icon.icns and /dev/null differ
diff --git a/admin-panel/os/osx/icon.icns b/admin-panel/os/osx/icon.icns
deleted file mode 100755
index dca12edf..00000000
Binary files a/admin-panel/os/osx/icon.icns and /dev/null differ
diff --git a/admin-panel/os/windows/icon.ico b/admin-panel/os/windows/icon.ico
deleted file mode 100755
index 4c04c233..00000000
Binary files a/admin-panel/os/windows/icon.ico and /dev/null differ
diff --git a/admin-panel/os/windows/installer.nsi b/admin-panel/os/windows/installer.nsi
deleted file mode 100755
index 9a08ef89..00000000
--- a/admin-panel/os/windows/installer.nsi
+++ /dev/null
@@ -1,160 +0,0 @@
-; NSIS packaging/install script
-; Docs: http://nsis.sourceforge.net/Docs/Contents.html
-
-!include LogicLib.nsh
-!include nsDialogs.nsh
-
-; --------------------------------
-; Variables
-; --------------------------------
-
-!define dest "{{dest}}"
-!define src "{{src}}"
-!define name "{{name}}"
-!define prettyName "{{prettyName}}"
-!define version "{{version}}"
-!define icon "{{icon}}"
-!define setupIcon "{{setupIcon}}"
-!define banner "{{banner}}"
-
-!define exec "nw.exe"
-
-!define regkey "Software\${name}"
-!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${name}"
-
-!define uninstaller "uninstall.exe"
-
-; --------------------------------
-; Installation
-; --------------------------------
-
-SetCompressor lzma
-
-Name "${name}"
-Icon "${setupIcon}"
-OutFile "${dest}"
-InstallDir "$PROGRAMFILES\${name}"
-InstallDirRegKey HKLM "${regkey}" ""
-
-CRCCheck on
-SilentInstall normal
-
-XPStyle on
-ShowInstDetails nevershow
-AutoCloseWindow false
-WindowIcon off
-
-Caption "${prettyName} Setup"
-; Don't add sub-captions to title bar
-SubCaption 3 " "
-SubCaption 4 " "
-
-Page custom welcome
-Page instfiles
-
-Var Image
-Var ImageHandle
-
-Function .onInit
-
- ; Extract banner image for welcome page
- InitPluginsDir
- ReserveFile "${banner}"
- File /oname=$PLUGINSDIR\banner.bmp "${banner}"
-
-FunctionEnd
-
-; Custom welcome page
-Function welcome
-
- nsDialogs::Create 1018
-
- ${NSD_CreateLabel} 185 1u 210 100% "Welcome to ${prettyName} version ${version} installer.$\r$\n$\r$\nClick install to begin."
-
- ${NSD_CreateBitmap} 0 0 170 210 ""
- Pop $Image
- ${NSD_SetImage} $Image $PLUGINSDIR\banner.bmp $ImageHandle
-
- nsDialogs::Show
-
- ${NSD_FreeImage} $ImageHandle
-
-FunctionEnd
-
-; Installation declarations
-Section "Install"
-
- WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
- WriteRegStr HKLM "${uninstkey}" "DisplayName" "${name}"
- WriteRegStr HKLM "${uninstkey}" "DisplayIcon" '"$INSTDIR\icon.ico"'
- WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
-
- ; Remove all application files copied by previous installation
- RMDir /r "$INSTDIR"
-
- SetOutPath $INSTDIR
-
- ; Include all files from /build directory
- File /r "${src}\*"
-
- ; Create start menu shortcut
- CreateShortCut "$SMPROGRAMS\${name}.lnk" "$INSTDIR\${exec}" "" "$INSTDIR\icon.ico"
-
- WriteUninstaller "${uninstaller}"
-
-SectionEnd
-
-; --------------------------------
-; Uninstaller
-; --------------------------------
-
-ShowUninstDetails nevershow
-
-UninstallCaption "Uninstall ${prettyName}"
-UninstallText "Don't like ${prettyName} anymore? Hit uninstall button."
-UninstallIcon "${icon}"
-
-UninstPage custom un.confirm un.confirmOnLeave
-UninstPage instfiles
-
-Var RemoveAppDataCheckbox
-Var RemoveAppDataCheckbox_State
-
-; Custom uninstall confirm page
-Function un.confirm
-
- nsDialogs::Create 1018
-
- ${NSD_CreateLabel} 1u 1u 100% 24u "If you really want to remove ${prettyName} from your computer press uninstall button."
-
- ${NSD_CreateCheckbox} 1u 35u 100% 10u "Remove also my ${prettyName} personal data"
- Pop $RemoveAppDataCheckbox
-
- nsDialogs::Show
-
-FunctionEnd
-
-Function un.confirmOnLeave
-
- ; Save checkbox state on page leave
- ${NSD_GetState} $RemoveAppDataCheckbox $RemoveAppDataCheckbox_State
-
-FunctionEnd
-
-; Uninstall declarations
-Section "Uninstall"
-
- DeleteRegKey HKLM "${uninstkey}"
- DeleteRegKey HKLM "${regkey}"
-
- Delete "$SMPROGRAMS\${name}.lnk"
-
- ; Remove whole directory from Program Files
- RMDir /r "$INSTDIR"
-
- ; Remove also appData directory generated by your app if user checked this option
- ${If} $RemoveAppDataCheckbox_State == ${BST_CHECKED}
- RMDir /r "$LOCALAPPDATA\${name}"
- ${EndIf}
-
-SectionEnd
\ No newline at end of file
diff --git a/admin-panel/os/windows/setup-banner.bmp b/admin-panel/os/windows/setup-banner.bmp
deleted file mode 100755
index 36f8ab84..00000000
Binary files a/admin-panel/os/windows/setup-banner.bmp and /dev/null differ
diff --git a/admin-panel/os/windows/setup-icon.ico b/admin-panel/os/windows/setup-icon.ico
deleted file mode 100755
index 7b92627a..00000000
Binary files a/admin-panel/os/windows/setup-icon.ico and /dev/null differ
diff --git a/admin-panel/package.json b/admin-panel/package.json
deleted file mode 100755
index 8b107383..00000000
--- a/admin-panel/package.json
+++ /dev/null
@@ -1,41 +0,0 @@
-{
- "nwBoilerplateVersion": "1.0",
- "devDependencies": {
- "download": "^4.0.1",
- "esperanto": "^0.6.17",
- "fs-jetpack": "^0.6.2",
- "gulp": "^3.8.9",
- "gulp-bower": "^0.0.10",
- "gulp-less": "^1.3.6",
- "gulp-util": "^3.0.1",
- "loaders.css": "^0.1.0",
- "q": "^1.0.1",
- "vinyl-map": "^1.0.1",
- "yargs": "^1.3.1"
- },
- "optionalDependencies": {
- "appdmg": "^0.3.0"
- },
- "config": {
- "nw": {
- "version": "0.12.0",
- "downloadUrls": {
- "osx": "http://dl.nwjs.io/v{{version}}/nwjs-v{{version}}-osx-x64.zip",
- "linux": "https://dl.nwjs.io/v{{version}}/nwjs-v{{version}}-linux-x64.tar.gz",
- "windows": "http://dl.nwjs.io/v{{version}}/nwjs-v{{version}}-win-ia32.zip"
- }
- }
- },
- "scripts": {
- "postinstall": "node ./tasks/download-nw && cd ./app && npm install",
- "build": "./node_modules/.bin/gulp build",
- "start": "./node_modules/.bin/gulp start",
- "test": "./node_modules/.bin/gulp start --target=test",
- "release": "./node_modules/.bin/gulp release --target=release"
- },
- "dependencies": {
- "gulp-bower": "0.0.10",
- "pkginfo": "^0.3.0"
- },
- "version": "0.0.1"
-}
diff --git a/admin-panel/tasks/build.js b/admin-panel/tasks/build.js
deleted file mode 100755
index 2d9f67e3..00000000
--- a/admin-panel/tasks/build.js
+++ /dev/null
@@ -1,154 +0,0 @@
-'use strict';
-
-var gulp = require('gulp');
-var less = require('gulp-less');
-var esperanto = require('esperanto');
-var map = require('vinyl-map');
-var projectDir = require('fs-jetpack');
-var bower = require("gulp-bower");
-
-var utils = require('./utils');
-
-// -------------------------------------
-// Setup
-// -------------------------------------
-
-var srcDir = projectDir.cwd('./app/');
-var destDir = projectDir.cwd('./build/');
-
-// On Windows and Linux our code is going into main directory...
-var destForCodeDir = destDir;
-if (utils.os() === 'osx') {
- // ...but on OSX deep into folder in bundle structure.
- destForCodeDir = destDir.cwd('./nwjs.app/Contents/Resources/app.nw');
-}
-
-var paths = {
- jsCode: [
- 'app/**/*.js',
- '!app/node_modules/**',
- '!app/bower_components/**',
- '!app/vendor/**'
- ]
-};
-
-// -------------------------------------
-// Tasks
-// -------------------------------------
-
-gulp.task('clean', function(callback) {
- return destDir.dirAsync('.', { empty: true });
-});
-
-
-gulp.task('prepare-runtime', ['clean'] , function () {
- var runtimeForThisOs = './nw/' + utils.os();
- return projectDir.copyAsync(runtimeForThisOs, destDir.path(), {
- overwrite: true
- });
-});
-
-gulp.task('bower', function() {
- return bower()
- .pipe(gulp.dest(destForCodeDir.path('lib')))
-});
-
-
-var copyTask = function () {
- return projectDir.copyAsync('app', destForCodeDir.path(), {
- overwrite: true,
- matching: [
- './node_modules/**',
- './vendor/**',
- '*.html',
- './img/**',
- './fonts/**'
- ]
- });
-};
-gulp.task('copy', ['prepare-runtime'], copyTask);
-gulp.task('copy-watch', copyTask);
-
-
-var transpileTask = function () {
- return gulp.src(paths.jsCode)
- .pipe(map(function(code, filename) {
- var transpiled = esperanto.toAmd(code.toString(), { strict: true });
- return transpiled.code;
- }))
- .pipe(gulp.dest(destForCodeDir.path()));
-};
-gulp.task('transpile', ['prepare-runtime'], transpileTask);
-gulp.task('transpile-watch', transpileTask);
-
-
-var lessTask = function () {
- return gulp.src('app/stylesheets/**.less')
- .pipe(less())
- .pipe(gulp.dest(destForCodeDir.path('stylesheets')));
-};
-gulp.task('less', ['prepare-runtime'], lessTask);
-gulp.task('less-watch', lessTask);
-
-
-// Add and customize OS-specyfic and target-specyfic stuff.
-gulp.task('finalize', ['prepare-runtime'], function () {
- var manifest = srcDir.read('package.json', 'json');
- switch (utils.getBuildTarget()) {
- case 'release':
- // Hide dev toolbar if doing a release.
- manifest.window.toolbar = false;
- break;
- case 'test':
- // Add "-test" suffix to name, so NW.js will write all
- // data like cookies and locaStorage into separate place.
- manifest.name += '-test';
- // Change the main entry to spec runner.
- manifest.main = 'spec.html';
- // Set extra flag so we know this is development mode, and we can
- // alter some behaviours of running app.
- manifest.developmentMode = true;
- break;
- case 'development':
- // Add "-dev" suffix to name, so NW.js will write all
- // data like cookies and locaStorage into separate place.
- manifest.name += '-dev';
- // Set extra flag so we know this is development mode, and we can
- // alter some behaviours of running app.
- manifest.developmentMode = true;
- break;
- }
- destForCodeDir.write('package.json', manifest, { jsonIndent: 4 });
-
- projectDir.copy('os/icon.png', destForCodeDir.path('icon.png'));
-
- // Stuff specyfic for certains OS
- switch (utils.os()) {
- case 'windows':
- // icon
- projectDir.copy('os/windows/icon.ico', destDir.path('icon.ico'));
- break;
- case 'osx':
- // Info.plist
- var manifest = projectDir.read('app/package.json', 'json');
- var info = projectDir.read('os/osx/Info.plist');
- info = utils.replace(info, {
- prettyName: manifest.prettyName,
- version: manifest.version
- });
- destDir.write('nwjs.app/Contents/Info.plist', info);
- // icon
- projectDir.copy('os/osx/icon.icns', destDir.path('nwjs.app/Contents/Resources/icon.icns'));
- break;
- }
-});
-
-
-gulp.task('watch', function () {
- gulp.watch(paths.jsCode, ['transpile-watch']);
- gulp.watch('*.less', ['less-watch']);
- gulp.watch('*.html', ['copy-watch']);
-});
-
-
-gulp.task('build', ['transpile', 'less', 'bower', 'copy', 'finalize']);
diff --git a/admin-panel/tasks/download-nw.js b/admin-panel/tasks/download-nw.js
deleted file mode 100755
index e096d52d..00000000
--- a/admin-panel/tasks/download-nw.js
+++ /dev/null
@@ -1,84 +0,0 @@
-// Downloads NW.js runtime and unpacks it into proper place.
-
-'use strict';
-
-var Q = require('q');
-var childProcess = require('child_process');
-var projectDir = require('fs-jetpack');
-var utils = require('./utils');
-
-// --------------------------------------------------------
-// Preparations
-// --------------------------------------------------------
-
-var devManifest = projectDir.read('package.json', 'json');
-var appManifest = projectDir.read('app/package.json', 'json');
-
-// Version of NW.js we need
-var runtimeVersion = devManifest.config.nw.version;
-// The directory where runtime should be placed
-var destDir = projectDir.dir('nw/' + utils.os());
-
-// First check if we already haven't downloaded this version of runtime.
-if (destDir.read('version') === runtimeVersion) {
- // No need for continuing
- process.exit();
-}
-
-// Figure out the URL we have to download.
-var url = devManifest.config.nw.downloadUrls[utils.os()];
-// URL has places where we have to inject version we are interested with.
-url = utils.replace(url, { version: runtimeVersion });
-
-var finalize = function () {
- var deferred = Q.defer();
-
- // Place file with version next to downloaded runtime,
- // so we know in the future what we have there.
- destDir.file('version', { content: runtimeVersion });
-
- // Special preparations necessary for linux runtime
- if (utils.os() === 'linux') {
- // The hack for problems with libudev.so.0 on Linux platform.
- // Read more: https://github.com/nwjs/nw.js/wiki/The-solution-of-lacking-libudev.so.0
- childProcess.exec("sed -i 's/udev\.so\.0/udev.so.1/g' nw", { cwd: destDir.path() },
- function (error, stdout, stderr) {
- if (error || stderr) {
- console.log('ERROR while patching libudev:');
- console.log(error);
- console.log(stderr);
- } else {
- deferred.resolve();
- }
- });
- } else {
- deferred.resolve();
- }
-
- return deferred.promise;
-};
-
-// --------------------------------------------------------
-// Let's get started
-// --------------------------------------------------------
-
-destDir.dir('.', { empty: true });
-
-var Download = require('download');
-
-var download = new Download({ extract: true, strip: 1, mode: '755' })
-.get(url)
-.dest(destDir.path());
-
-console.log('Downloading NW.js...');
-
-download.run(function (err, files) {
- if (err) {
- console.error(err);
- } else {
- finalize()
- .then(function () {
- console.log('NW.js v' + runtimeVersion + ' downloaded successfully!');
- });
- }
-});
diff --git a/admin-panel/tasks/release.js b/admin-panel/tasks/release.js
deleted file mode 100755
index 1a6b6f52..00000000
--- a/admin-panel/tasks/release.js
+++ /dev/null
@@ -1,158 +0,0 @@
-'use strict';
-
-var gulp = require('gulp');
-var gulpUtil = require('gulp-util');
-var childProcess = require('child_process');
-var projectDir = require('fs-jetpack');
-var utils = require('./utils');
-
-var releaseForOs = {};
-
-var tmpDir = projectDir.dir('./tmp', { empty: true });
-var cleanTmp = function () {
- tmpDir.remove('.');
-};
-
-// -------------------------------------
-// OSX
-// -------------------------------------
-
-releaseForOs.osx = function (callback) {
- var appdmg = require('appdmg');
-
- var releasesDir = projectDir.dir('./releases');
- var manifest = projectDir.read('app/package.json', 'json');
- var dmgName = manifest.name + '_' + manifest.version + '.dmg';
-
- // Change app bundle name to desired
- projectDir.rename("build/nwjs.app", manifest.prettyName + ".app");
-
- // Prepare appdmg config
- var dmgManifest = projectDir.read('os/osx/appdmg.json');
- dmgManifest = utils.replace(dmgManifest, {
- prettyName: manifest.prettyName,
- appPath: projectDir.path("build/" + manifest.prettyName + ".app"),
- dmgIcon: projectDir.path("os/osx/dmg-icon.icns"),
- dmgBackground: projectDir.path("os/osx/dmg-background.png")
- });
- tmpDir.write('appdmg.json', dmgManifest);
-
- // Delete DMG file with this name if already exists
- releasesDir.remove(dmgName);
-
- gulpUtil.log('Packaging to DMG image...');
-
- var readyDmg = releasesDir.path(dmgName);
- appdmg({
- source: tmpDir.path('appdmg.json'),
- target: readyDmg
- })
- .on('error', function (err) {
- console.error(err);
- })
- .on('finish', function () {
- gulpUtil.log('DMG image ready!', readyDmg);
- cleanTmp();
- callback();
- });
-};
-
-// -------------------------------------
-// Linux
-// -------------------------------------
-
-releaseForOs.linux = function (callback) {
- var releasesDir = projectDir.dir('./releases');
- var manifest = projectDir.read('app/package.json', 'json');
- var packName = manifest.name + '_' + manifest.version;
- var pack = tmpDir.dir(packName);
- var debFileName = packName + '_amd64.deb';
-
- gulpUtil.log('Creating DEB package...');
-
- // The whole app will be installed into /opt directory
- projectDir.copy('build', pack.path('opt', manifest.name));
-
- // Create .desktop file from the template
- var desktop = projectDir.read('os/linux/app.desktop');
- desktop = utils.replace(desktop, {
- name: manifest.name,
- prettyName: manifest.prettyName,
- description: manifest.description,
- version: manifest.version,
- author: manifest.author
- });
- pack.write('usr/share/applications/' + manifest.name + '.desktop', desktop);
-
- // Counting size of the app in KB
- var appSize = Math.round(projectDir.inspectTree('build').size / 1024);
-
- // Preparing debian control file
- var control = projectDir.read('os/linux/DEBIAN/control');
- control = utils.replace(control, {
- name: manifest.name,
- description: manifest.description,
- version: manifest.version,
- author: manifest.author,
- size: appSize
- });
- pack.write('DEBIAN/control', control);
-
- // Build the package...
- childProcess.exec('fakeroot dpkg-deb -Zxz --build ' + pack.path() + ' ' + releasesDir.path(debFileName),
- function (error, stdout, stderr) {
- if (error || stderr) {
- console.log("ERROR while building DEB package:");
- console.log(error);
- console.log(stderr);
- } else {
- gulpUtil.log('Package', debFileName, 'ready!');
- }
- cleanTmp();
- callback();
- });
-};
-
-// -------------------------------------
-// Windows
-// -------------------------------------
-
-releaseForOs.windows = function (callback) {
- projectDir.dir('./releases');
- var manifest = projectDir.read('app/package.json', 'json');
- var filename = manifest.name + '_' + manifest.version + '.exe';
- var installScript = projectDir.read('./os/windows/installer.nsi');
- installScript = utils.replace(installScript, {
- "name": manifest.name,
- "prettyName": manifest.prettyName,
- "version": manifest.version,
- // The paths expect the .nsi file is in "nw-boilerplate/tmp" folder.
- "src": "..\\build",
- "dest": "..\\releases\\" + filename,
- "icon": "..\\os\\windows\\icon.ico",
- "setupIcon": "..\\os\\windows\\setup-icon.ico",
- "banner": "..\\os\\windows\\setup-banner.bmp"
- });
- projectDir.write('./tmp/installer.nsi', installScript);
-
- gulpUtil.log('Building installer with NSIS...');
-
- // Note: NSIS have to be added to PATH!
- var nsis = childProcess.spawn('makensis', ['.\\tmp\\installer.nsi']);
- nsis.stdout.pipe(process.stdout);
- nsis.stderr.pipe(process.stderr);
- nsis.on('close', function () {
- gulpUtil.log('Installer', filename, 'ready!');
- cleanTmp();
- callback();
- });
-};
-
-// -------------------------------------
-// The task
-// -------------------------------------
-
-// Wire release name to specyfic release process for this operating system.
-gulp.task('release', ['build'], function (callback) {
- return releaseForOs[utils.os()](callback);
-});
diff --git a/admin-panel/tasks/start.js b/admin-panel/tasks/start.js
deleted file mode 100755
index b4bde1b0..00000000
--- a/admin-panel/tasks/start.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict';
-
-var gulp = require('gulp');
-var childProcess = require('child_process');
-var utils = require('./utils');
-
-// Starts the app in /build folder and runs gulp watch for the time, when app is running.
-gulp.task('start', ['watch', 'build'], function () {
- var app;
-
- switch (utils.os()) {
- case 'osx':
- app = childProcess.spawn('./build/nwjs.app/Contents/MacOS/nwjs');
- break;
- case 'linux':
- app = childProcess.spawn('./build/nw');
- break;
- case 'windows':
- app = childProcess.spawn('build/nw.exe');
- break;
- }
-
- app.stdout.pipe(process.stdout);
- app.stderr.pipe(process.stderr);
-
- app.on('close', function (code) {
- // Kill this gulp (watch) process when application closes.
- process.exit();
- });
-});
diff --git a/admin-panel/tasks/utils.js b/admin-panel/tasks/utils.js
deleted file mode 100755
index b5e47a5d..00000000
--- a/admin-panel/tasks/utils.js
+++ /dev/null
@@ -1,28 +0,0 @@
-'use strict';
-
-var argv = require('yargs').argv;
-var os = require('os');
-
-module.exports.os = function () {
- switch (os.platform()) {
- case 'darwin':
- return 'osx';
- case 'linux':
- return 'linux';
- case 'win32':
- return 'windows';
- }
- return 'unsupported';
-};
-
-module.exports.replace = function (str, patterns) {
- Object.keys(patterns).forEach(function (pattern) {
- var matcher = new RegExp('{{' + pattern + '}}', 'g');
- str = str.replace(matcher, patterns[pattern]);
- });
- return str;
-};
-
-module.exports.getBuildTarget = function () {
- return argv.target || 'development';
-};
\ No newline at end of file
diff --git a/client/core/src/com/boxtrotstudio/ghost/client/core/game/events/StandardEvent.java b/client/core/src/com/boxtrotstudio/ghost/client/core/game/events/StandardEvent.java
index d245ce1a..7f19a169 100755
--- a/client/core/src/com/boxtrotstudio/ghost/client/core/game/events/StandardEvent.java
+++ b/client/core/src/com/boxtrotstudio/ghost/client/core/game/events/StandardEvent.java
@@ -317,6 +317,13 @@ public void trigger(@NotNull Entity cause, double direction, @NotNull SpriteScen
System.err.println(game.getDidWin1() + " : " + game.getDidWin2() + " : " + game.getDidWin3());
}
}
+ },
+
+ CancelAbility(22) {
+ @Override
+ public void trigger(@NotNull Entity cause, double direction, @NotNull SpriteScene world) {
+ System.out.println("Ability canceled");
+ }
};
diff --git a/client/core/src/com/boxtrotstudio/ghost/client/core/game/sprites/InputEntity.kt b/client/core/src/com/boxtrotstudio/ghost/client/core/game/sprites/InputEntity.kt
index 343819c9..7d38c40d 100755
--- a/client/core/src/com/boxtrotstudio/ghost/client/core/game/sprites/InputEntity.kt
+++ b/client/core/src/com/boxtrotstudio/ghost/client/core/game/sprites/InputEntity.kt
@@ -113,13 +113,12 @@ class InputEntity(id: Short, texture: String) : NetworkPlayer(id, texture) {
var mousePos = Vector3(Gdx.input.x.toFloat(), Gdx.input.y.toFloat(), 0f)
Ghost.getInstance().camera.unproject(mousePos)
- moveTowards(Vector2f(mousePos.x, mousePos.y))
+ //moveTowards(Vector2f(mousePos.x, mousePos.y))
if (Ghost.matchStarted) {
Thread(Runnable { //Maybe buffer this?
//Ghost.startPingTimer(target);
- val movementByte = if (GlobalOptions.getOptions().isPathfinding) 0x3.toByte() else 0x0.toByte()
val packet = ActionRequestPacket()
- packet.writePacket(Ghost.client, movementByte, mousePos.x, mousePos.y)
+ packet.writePacket(Ghost.client, 0x0.toByte(), mousePos.x, mousePos.y)
}).start()
}
diff --git a/program.json b/program.json
deleted file mode 100755
index 64d2dced..00000000
--- a/program.json
+++ /dev/null
@@ -1 +0,0 @@
-{"execute":"java -jar game.jar","name":"Project Ghost","updateURL":"http://localhost/updates/update.json","version":"1.0.0"}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/Player.java b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/Player.java
index 816c8a4e..f510668d 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/Player.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/Player.java
@@ -7,6 +7,8 @@
import com.boxtrotstudio.ghost.common.network.world.NetworkWorld;
import com.boxtrotstudio.ghost.game.match.LiveMatch;
import com.boxtrotstudio.ghost.game.match.Match;
+import com.boxtrotstudio.ghost.game.match.abilities.Ability;
+import com.boxtrotstudio.ghost.game.match.abilities.PlayerAbility;
import com.boxtrotstudio.ghost.game.match.entities.PlayableEntity;
import com.boxtrotstudio.ghost.game.match.entities.playable.impl.BaseNetworkPlayer;
import com.boxtrotstudio.ghost.game.match.item.Item;
@@ -17,6 +19,7 @@
import com.boxtrotstudio.ghost.network.sql.PlayerData;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -175,6 +178,17 @@ public void sendMatchMessage(String message) {
}
}
+ public void _packet_setCurrentAbility(Class extends Ability> class_) {
+ if (!canChangeAbility)
+ return;
+
+ try {
+ this.ability = class_.getConstructor(PlayableEntity.class).newInstance(this);
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+ throw new IllegalArgumentException("This ability is not compatible!");
+ }
+ }
+
public void stopSpectating() {
((NetworkWorld)this.getMatch().getWorld()).removeSpectator(this);
this.setMatch(null);
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/bots/TestPlayableEntity.java b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/bots/TestPlayableEntity.java
index 0feacaa7..d734beb1 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/bots/TestPlayableEntity.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/bots/TestPlayableEntity.java
@@ -46,10 +46,10 @@ public void tick() {
setTarget(new Vector2f(x, y));
}
- if (Global.RANDOM.nextDouble() < 0.2 && canFire) {
+ if (Global.RANDOM.nextDouble() < 0.2 && currentAbility().canFirePrimary()) {
float x = Global.random(100, 1000);
float y = Global.random(100, 700);
- useAbility(x, y, 1);
+ useAbility(x, y, false);
}
super.tick();
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialBot.java b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialBot.java
index 86a5083c..7bedb660 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialBot.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialBot.java
@@ -20,7 +20,7 @@ public TutorialBot(PlayableEntity player) {
}
public void fire(float targetX, float targetY){
- useAbility(targetX, targetY, 0);
+ useAbility(targetX, targetY, false);
firstFire = true;
}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialMatch.java b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialMatch.java
index 8d883e67..5eedbf30 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialMatch.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/common/game/gamemodes/tutorial/TutorialMatch.java
@@ -20,7 +20,7 @@ public TutorialMatch(Team team1, Team team2, Server server) {
super(team1, team2, server);
bot = (TutorialBot) team2.getTeamMembers()[0];
- bot._packet_setCurrentAbility(Gun.class);
+ bot.setCurrentAbility(new Gun(bot));
}
@Override
@@ -58,7 +58,6 @@ protected void stage() {
player.getY() < startPosY - 300 || player.getY() > startPosY + 300));
p.triggerEvent(Event.DidMove, 0);
- p.setCanFire(true);
waitFor(PlayableEntity::didFire);
if(bot.getLives() < 3){
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/common/network/packet/ActionRequestPacket.java b/server/api/src/main/java/com/boxtrotstudio/ghost/common/network/packet/ActionRequestPacket.java
index 92076565..ade17647 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/common/network/packet/ActionRequestPacket.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/common/network/packet/ActionRequestPacket.java
@@ -29,9 +29,9 @@ public void onHandlePacket(BasePlayerClient client) throws IOException {
//long time = consume(4).asLong();
if (actionType == 0)
- client.getPlayer().moveTowards(mouseX, mouseY);
+ client.getPlayer().fireTowards(mouseX, mouseY, false);
else if (actionType == 1)
- client.getPlayer().fireTowards(mouseX, mouseY, actionType);
+ client.getPlayer().fireTowards(mouseX, mouseY, true);
else if (actionType == 2) {
Vector2f direction = new Vector2f(mouseX, mouseY);
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/Event.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/Event.java
index dd41d47a..65bb42d1 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/Event.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/Event.java
@@ -24,7 +24,8 @@ public enum Event {
TeamWin(20),
TeamLose(21),
MatchWin(22),
- MatchLose(23);
+ MatchLose(23),
+ CancelAbility(24);
private short id;
Event(int id) {
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Ability.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Ability.java
index 1e9de072..a8150a76 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Ability.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Ability.java
@@ -17,11 +17,22 @@ public interface Ability {
T owner();
/**
- * The entity has executed this ability with the mouse position at targetX and targetY
+ * The entity has executed this ability primary ability with the mouse position at targetX and targetY
* @param targetX The X position this ability was used
* @param targetY The Y position this ability was used
*/
- void use(float targetX, float targetY);
+ void usePrimary(float targetX, float targetY);
+
+ /**
+ * The entity has executed this ability secondary ability with the mouse position at targetX and targetY
+ * @param targetX The X position this ability was used
+ * @param targetY The Y position this ability was used
+ */
+ void useSecondary(float targetX, float targetY);
byte id();
+
+ boolean canFirePrimary();
+
+ boolean canFireSecondary();
}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Boomerang.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Boomerang.java
index ed45d40a..44fe984b 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Boomerang.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Boomerang.java
@@ -6,17 +6,16 @@
import com.boxtrotstudio.ghost.utils.TimeUtils;
import com.boxtrotstudio.ghost.utils.Vector2f;
-public class Boomerang implements Ability {
+public class Boomerang extends PlayerAbility {
private static final long BASE_COOLDOWN = 315;
private static final float BOOMERANG_SPEED = 10f;
private static final long DEFAULT_RETURN_TIME = 1000;
- private PlayableEntity owner;
private BoomerangEntity boomerang;
- private boolean active;
- private boolean returning;
+ private boolean active = false;
+ private boolean returning = false;
public ConditionalRunnable checker;
@@ -28,41 +27,24 @@ private abstract class ConditionalRunnable implements Runnable {
}
public Boomerang(PlayableEntity owner) {
- this.owner = owner;
+ super(owner);
+ baseCooldown = BASE_COOLDOWN;
+ canCancel = false;
}
- public Boomerang() { }
-
@Override
public String name() {
return "Boomerang";
}
@Override
- public PlayableEntity owner() {
- return owner;
- }
-
- @Override
- public void use(float targetX, float targetY) {
- if (!active) {
- handleLaunch(targetX, targetY);
- } else {
- handleReturn(targetX, targetY);
- }
- }
+ protected void onUsePrimary(float targetX, float targetY) {
+ if (active)
+ return;
- @Override
- public byte id() {
- return 4;
- }
+ PlayableEntity owner = owner();
- /**
- * Boomerang starts moving away.
- */
- public void handleLaunch(float targetX, float targetY) {
owner.setVisible(true);
- owner.setCanFire(false);
float x = owner.getX();
float y = owner.getY();
@@ -84,9 +66,10 @@ public void handleLaunch(float targetX, float targetY) {
active = true;
owner.onFire(); //Indicate the player has fired, also triggers the fade out
- TimeUtils.executeInSync(200, () -> owner.setCanFire(true), owner.getWorld());
+ //Setup ability to use secondary weapon
+ TimeUtils.executeInSync(200, () -> canUseSecondary = true, owner.getWorld());
- TimeUtils.executeInSync(DEFAULT_RETURN_TIME, (checker = new ConditionalRunnable() {
+ executeInSync(DEFAULT_RETURN_TIME, (checker = new ConditionalRunnable() {
@Override
public void run() {
if (!returning && execute) {
@@ -97,21 +80,37 @@ public void run() {
y = owner.getTarget().y;
}
- owner.setCanFire(false); //The player can't fire while the boomerang is returning
+ canUseSecondary = false;
+ canUsePrimary = false; //The player can't fire while the boomerang is returning
boomerang.startReturn(x, y);
returning = true;
}
}
- }), owner.getWorld());
+ }));
+ }
+
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ if (active) {
+ handleReturn(targetX, targetY);
+ }
+ }
+
+ @Override
+ public byte id() {
+ return 4;
}
/**
* Boomerang starts coming back.
*/
public void handleReturn(float x, float y) {
+ PlayableEntity owner = owner();
owner.setVisible(true);
- owner.setCanFire(false); //The player can't fire while the boomerang is returning
+
+ canUseSecondary = false;
+ canUsePrimary = false; //The player can't fire while the boomerang is returning
boomerang.startReturn(x, y);
returning = true;
@@ -125,7 +124,6 @@ public void onReturnFinished() {
returning = false;
checker.execute = false;
- long wait = owner.calculateFireRate(BASE_COOLDOWN); //Base value is 315ms
- TimeUtils.executeInSync(wait, () -> owner.setCanFire(true), owner.getWorld());
+ endPrimary();
}
}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/CancelableAbility.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/CancelableAbility.java
deleted file mode 100644
index d27a662e..00000000
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/CancelableAbility.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.boxtrotstudio.ghost.game.match.abilities;
-
-import com.boxtrotstudio.ghost.game.match.entities.PlayableEntity;
-import com.boxtrotstudio.ghost.utils.TimeUtils;
-
-public abstract class CancelableAbility implements Ability {
- private boolean running;
- protected boolean canCancel = true;
-
- @Override
- public final void use(float targetX, float targetY) {
- running = true;
- onUse(targetX, targetY);
- }
-
- public boolean isRunning() {
- return running;
- }
-
- public final void cancel() {
- if (!running || !canCancel)
- return;
-
- running = false;
- onCancel();
- }
-
- protected final void end(long baseCooldown) {
- if (!running)
- return;
-
- PlayableEntity p = owner();
-
- running = false;
-
- long wait = p.calculateFireRate(baseCooldown);
- TimeUtils.executeInSync(wait, () -> p.setCanFire(true), p.getWorld());
- }
-
- protected void executeInSync(long duration, Runnable runnable) {
- TimeUtils.executeInSync(duration, () -> {
- if (running) {
- runnable.run();
- }
- }, owner().getWorld());
- }
-
- protected abstract void onUse(float targetX, float targetY);
-
- protected void onCancel() {
-
- }
-}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Circle.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Circle.java
index f388c43b..feb50841 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Circle.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Circle.java
@@ -7,18 +7,17 @@
import java.util.ArrayList;
-public class Circle implements Ability {
+public class Circle extends PlayerAbility {
private PlayableEntity p;
private static final long STAGE1_DURATION = 700;
private static final long STAGE2_DURATION = 600;
private static final long BASE_COOLDOWN = 1000;
public Circle(PlayableEntity owner) {
- this.p = owner;
+ super(owner);
+ baseCooldown = BASE_COOLDOWN;
}
- public Circle() { }
-
@Override
public String name() {
return "Circle";
@@ -30,9 +29,8 @@ public PlayableEntity owner() {
}
@Override
- public void use(float targetX, float targetY) {
+ public void onUsePrimary(float targetX, float targetY) {
wasInside.clear();
- p.setCanFire(false);
p.setVisible(true);
double temp = NetworkUtils.storeFloats(targetX, targetY);
@@ -43,23 +41,26 @@ public void use(float targetX, float targetY) {
//p.getWorld().spawnParticle(ParticleEffect.CIRCLE, (int) (STAGE1_DURATION + STAGE2_DURATION), 64, targetX, targetY, STAGE1_DURATION);
- TimeUtils.executeInSync(STAGE1_DURATION, () -> {
+ executeInSync(STAGE1_DURATION, () -> {
token.useDefaultBehavior();
- for (PlayableEntity p : wasInside) {
- p.setVisible(false);
- p.getSpeedStat().removeBuff("circle_debuff");
+ for (PlayableEntity p1 : wasInside) {
+ p1.setVisible(false);
+ p1.getSpeedStat().removeBuff("circle_debuff");
}
wasInside.clear();
- TimeUtils.executeInSync(STAGE2_DURATION, () -> {
+ executeInSync(STAGE2_DURATION, () -> {
token.stopChecking();
p.onFire();
- long wait = p.calculateFireRate(BASE_COOLDOWN); //Base value is 315ms
- TimeUtils.executeInSync(wait, () -> p.setCanFire(true), p.getWorld());
- }, p.getWorld());
- }, p.getWorld());
- //TimeUtils.executeInSync()
+ endPrimary();
+ });
+ });
+ }
+
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ endSecondary();
}
@Override
@@ -81,4 +82,4 @@ public byte id() {
wasInside.remove(p);
}
};
-}
+}
\ No newline at end of file
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/ConelAOE.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/ConelAOE.java
index 0d8912fb..96e365c6 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/ConelAOE.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/ConelAOE.java
@@ -3,27 +3,20 @@
import com.boxtrotstudio.ghost.game.match.entities.PlayableEntity;
import com.boxtrotstudio.ghost.game.match.entities.ability.ConelEntity;
-public class ConelAOE implements Ability {
+public class ConelAOE extends PlayerAbility {
private PlayableEntity p;
public ConelAOE(PlayableEntity playableEntity) {
- this.p = playableEntity;
+ super(playableEntity);
}
- public ConelAOE() { }
-
@Override
public String name() {
return "ConelAOE"; //TODO Pick a better name
}
@Override
- public PlayableEntity owner() {
- return p;
- }
-
- @Override
- public void use(float targetX, float targetY) {
+ public void onUsePrimary(float targetX, float targetY) {
final float x = p.getX();
final float y = p.getY();
@@ -34,6 +27,12 @@ public void use(float targetX, float targetY) {
ConelEntity entity = new ConelEntity(p, direction);
entity.setPosition(p.getPosition());
p.getWorld().spawnEntity(entity);
+ endPrimary();
+ }
+
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ endSecondary();
}
@Override
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Dash.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Dash.java
index 3cf9a140..e3454935 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Dash.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Dash.java
@@ -10,7 +10,7 @@
import java.util.List;
-public class Dash implements Ability {
+public class Dash extends PlayerAbility {
private static final long BASE_COOLDOWN = 1100;
private PlayableEntity p;
@@ -18,11 +18,10 @@ public class Dash implements Ability {
private static final int STALL = 800;
public Dash(PlayableEntity p) {
- this.p = p;
+ super(p);
+ baseCooldown = BASE_COOLDOWN;
}
- public Dash() { }
-
@Override
public String name() {
return "Dash";
@@ -34,8 +33,7 @@ public PlayableEntity owner() {
}
@Override
- public void use(final float targetX, final float targetY) {
- p.setCanFire(false);
+ public void onUsePrimary(final float targetX, final float targetY) {
p.setVisible(true);
p.freeze();
@@ -68,7 +66,7 @@ public void use(final float targetX, final float targetY) {
p.triggerEvent(Event.DashCharge, angle);
- TimeUtils.executeInSync(STALL, () -> {
+ executeInSync(STALL, () -> {
p.freeze();
p.setVelocity(0f, 0f);
p.getSpeedStat().removeBuff(buffDecrease);
@@ -82,18 +80,27 @@ public void use(final float targetX, final float targetY) {
p.easeTo(target, 400);
+ canCancel = false;
- TimeUtils.executeWhen(() -> {
- //Stop checking this hitbox
- hitboxToken.stopChecking();
+ TimeUtils.executeWhen(new Runnable() {
+ @Override
+ public void run() {
+ //Stop checking this hitbox
+ hitboxToken.stopChecking();
- p.setTarget(null);
- p.unfreeze();
- p.onFire();
- long wait = p.calculateFireRate(BASE_COOLDOWN);
- TimeUtils.executeInSync(wait, () -> p.setCanFire(true), p.getWorld());
+ p.setTarget(null);
+ p.unfreeze();
+ p.onFire();
+ endPrimary();
+ canCancel = true;
+ }
}, val -> (p.getX() == target.x && p.getY() == target.y) || !p.isEasing(), p.getWorld());
- }, p.getWorld());
+ });
+ }
+
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ endSecondary();
}
@Override
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Gun.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Gun.java
index 83be81e3..9b81dce0 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Gun.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Gun.java
@@ -5,32 +5,25 @@
import com.boxtrotstudio.ghost.game.match.entities.ability.BulletEntity;
import com.boxtrotstudio.ghost.utils.Vector2f;
-public class Gun extends CancelableAbility {
+public class Gun extends PlayerAbility {
private static final float BULLET_SPEED = 15f;
private static final long BASE_COOLDOWN = 555;
private static final long ANIMATION_DELAY = 250;
private PlayableEntity p;
public Gun(PlayableEntity p) {
- this.p = p;
+ super(p);
+ baseCooldown = BASE_COOLDOWN;
}
- public Gun() { }
-
@Override
public String name() {
return "gun";
}
@Override
- public PlayableEntity owner() {
- return p;
- }
-
- @Override
- public void onUse(float targetX, float targetY) {
+ public void onUsePrimary(float targetX, float targetY) {
final PlayableEntity p = owner();
- p.setCanFire(false);
p.freeze();
float x = p.getX();
@@ -59,15 +52,20 @@ public void onUse(float targetX, float targetY) {
p.unfreeze();
- end(BASE_COOLDOWN);
+ endPrimary();
});
}
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ endSecondary();
+ }
+
@Override
protected void onCancel() {
owner().unfreeze();
owner().onFire();
- end(BASE_COOLDOWN);
+ end();
}
@Override
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/JammedGun.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/JammedGun.java
index 5f4ec868..5d17cc41 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/JammedGun.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/JammedGun.java
@@ -3,12 +3,13 @@
import com.boxtrotstudio.ghost.game.match.entities.PlayableEntity;
import com.boxtrotstudio.ghost.utils.TimeUtils;
-public class JammedGun implements Ability {
+public class JammedGun extends PlayerAbility {
private static final long BASE_COOLDOWN = 555;
private PlayableEntity p;
public JammedGun(PlayableEntity p) {
- this.p = p;
+ super(p);
+ baseCooldown = BASE_COOLDOWN;
}
@Override
@@ -17,18 +18,19 @@ public String name() {
}
@Override
- public PlayableEntity owner() {
- return p;
+ protected void onUsePrimary(float targetX, float targetY) {
+ final PlayableEntity p = owner();
+ p.onFire(); //Indicate this player is done firing
+
+ endPrimary();
}
@Override
- public void use(float targetX, float targetY) {
+ protected void onUseSecondary(float targetX, float targetY) {
final PlayableEntity p = owner();
- p.setCanFire(false);
p.onFire(); //Indicate this player is done firing
- long wait = p.calculateFireRate(BASE_COOLDOWN); //Base value is 315ms
- TimeUtils.executeInSync(wait, () -> p.setCanFire(true), p.getWorld());
+ endSecondary();
}
@Override
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Laser.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Laser.java
index cc896c6f..6b3fcf20 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Laser.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/Laser.java
@@ -10,7 +10,7 @@
import java.util.ArrayList;
import java.util.List;
-public class Laser extends CancelableAbility {
+public class Laser extends PlayerAbility {
private static final long STALL_TIME = 600L;
private static final long FIRE_WAIT = 200L;
private static final long ANIMATION_TIME = 350L;
@@ -20,11 +20,10 @@ public class Laser extends CancelableAbility {
private PlayableEntity p;
public Laser(PlayableEntity p) {
- this.p = p;
+ super(p);
+ baseCooldown = BASE_COOLDOWN;
}
- public Laser() { }
-
@Override
public String name() {
return "laser";
@@ -36,11 +35,10 @@ public PlayableEntity owner() {
}
@Override
- public void onUse(float targetX, float targetY) {
+ public void onUsePrimary(float targetX, float targetY) {
p.freeze(); //Freeze the player
p.setVelocity(0f, 0f);
p.setVisible(true);
- p.setCanFire(false);
/*final LaserEntity laserEntity = new LaserEntity(p);
@@ -102,21 +100,27 @@ public void onUse(float targetX, float targetY) {
}, p.getWorld());
TimeUtils.executeInSync(ANIMATION_TIME, () -> {
-
p.unfreeze();
p.onFire(); //Indicate this player is done firing
-
- TimeUtils.executeInSync(FADE_TIME, () -> {
- for (HitboxHelper.HitboxToken h : helpers) {
- h.stopChecking();
+ TimeUtils.executeInSync(FADE_TIME, new Runnable() {
+ @Override
+ public void run() {
+ for (HitboxHelper.HitboxToken h : helpers) {
+ h.stopChecking();
+ }
+
+ endPrimary();
}
-
- end(BASE_COOLDOWN);
}, p.getWorld());
}, p.getWorld());
});
}
+ @Override
+ protected void onUseSecondary(float targetX, float targetY) {
+ endSecondary();
+ }
+
@Override
protected void onCancel() {
owner().unfreeze();
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/PlayerAbility.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/PlayerAbility.java
new file mode 100644
index 00000000..108d84c5
--- /dev/null
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/abilities/PlayerAbility.java
@@ -0,0 +1,139 @@
+package com.boxtrotstudio.ghost.game.match.abilities;
+
+import com.boxtrotstudio.ghost.game.match.Event;
+import com.boxtrotstudio.ghost.game.match.entities.PlayableEntity;
+import com.boxtrotstudio.ghost.utils.TimeUtils;
+
+public abstract class PlayerAbility implements Ability {
+ private final PlayableEntity p;
+ protected boolean runningPrimary, runningSecondary;
+ protected boolean canUsePrimary = true, canUseSecondary = true;
+ protected boolean canCancel = true;
+ protected long baseCooldown = 555;
+
+ public PlayerAbility(PlayableEntity owner) {
+ this.p = owner;
+ }
+
+ @Override
+ public PlayableEntity owner() {
+ return p;
+ }
+
+ public void cancel() {
+ if (!canCancel)
+ return;
+
+ runningPrimary = false;
+ runningSecondary = false;
+ onCancel();
+ }
+
+ @Override
+ public final void usePrimary(float targetX, float targetY) {
+ if (runningPrimary || !canUsePrimary)
+ return;
+
+ runningPrimary = true;
+ canUsePrimary = false;
+ onUsePrimary(targetX, targetY);
+ }
+
+ protected abstract void onUsePrimary(float targetX, float targetY);
+
+ @Override
+ public final void useSecondary(float targetX, float targetY) {
+ if (runningSecondary || !canUseSecondary)
+ return;
+
+ runningSecondary = true;
+ canUseSecondary = false;
+ onUseSecondary(targetX, targetY);
+ }
+
+ protected abstract void onUseSecondary(float targetX, float targetY);
+
+ protected final void end() {
+ end(baseCooldown);
+ }
+
+ protected final void end(long basecooldown) {
+ if (!runningSecondary && !runningPrimary) {
+ return;
+ }
+
+ PlayableEntity p = owner();
+
+ runningPrimary = false;
+ runningSecondary = false;
+
+ long wait = p.calculateFireRate(basecooldown);
+ TimeUtils.executeInSync(wait, () -> {
+ canUsePrimary = true;
+ canUseSecondary = true;
+ }, p.getWorld());
+ }
+
+ protected final void endSecondary() {
+ endSecondary(baseCooldown);
+ }
+
+ protected final void endSecondary(long basecooldown) {
+ if (!runningSecondary) {
+ return;
+ }
+
+ PlayableEntity p = owner();
+
+ runningSecondary = false;
+
+ long wait = p.calculateFireRate(basecooldown);
+ TimeUtils.executeInSync(wait, () -> canUseSecondary = true, p.getWorld());
+ }
+
+ protected final void endPrimary() {
+ endPrimary(baseCooldown);
+ }
+
+ protected final void endPrimary(long basecooldown) {
+ if (!runningPrimary) {
+ return;
+ }
+
+ PlayableEntity p = owner();
+
+ runningPrimary = false;
+
+ long wait = p.calculateFireRate(basecooldown);
+ TimeUtils.executeInSync(wait, () -> canUsePrimary = true, p.getWorld());
+ }
+
+ /**
+ * Ensure when the later task is executed, it's executed during a tick where
+ * the ability is still running.
+ * @param duration
+ * @param runnable
+ */
+ protected void executeInSync(long duration, Runnable runnable) {
+ TimeUtils.executeInSync(duration, () -> {
+ if (runningPrimary || runningSecondary) {
+ runnable.run();
+ }
+ }, owner().getWorld());
+ }
+
+ @Override
+ public boolean canFirePrimary() {
+ return !runningPrimary && canUsePrimary;
+ }
+
+ @Override
+ public boolean canFireSecondary() {
+ return !runningSecondary && canUseSecondary;
+ }
+
+ protected void onCancel() {
+ end(baseCooldown);
+ p.triggerEvent(Event.CancelAbility, 0);
+ }
+}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/PlayableEntity.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/PlayableEntity.java
index ff8d83c0..0be89950 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/PlayableEntity.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/PlayableEntity.java
@@ -1,6 +1,7 @@
package com.boxtrotstudio.ghost.game.match.entities;
import com.boxtrotstudio.ghost.game.match.Match;
+import com.boxtrotstudio.ghost.game.match.abilities.PlayerAbility;
import com.boxtrotstudio.ghost.game.match.abilities.Ability;
import com.boxtrotstudio.ghost.game.match.entities.playable.impl.BaseNetworkPlayer;
import com.boxtrotstudio.ghost.game.match.item.Inventory;
@@ -233,12 +234,6 @@ public interface PlayableEntity extends PhysicsEntity {
*/
Ability currentAbility();
- /**
- * Set this Playable's current ability
- * @param class_ The ability class to set
- */
- void _packet_setCurrentAbility(Class extends Ability> class_);
-
/**
* Set this Playable's current ability
* @param ability The ability class to set
@@ -255,13 +250,18 @@ public interface PlayableEntity extends PhysicsEntity {
/**
* Whether this playable sprite should be able to use abilities
* @return True if this sprite can use abilities, otherwise false
+ * @deprecated Invokes {@link PlayerAbility#canFirePrimary()}
*/
+ @Deprecated
boolean canFire();
/**
* Set whether this playable sprite should be able to use abilities
* @param value True if this sprite can use abilities, otherwise false
+ * @deprecated This value is no longer checked. {@link com.boxtrotstudio.ghost.game.match.abilities.PlayerAbility} control cooldown,
+ * you can control cooldown rate (firerate) with {@link PlayableEntity#getFireRateStat()} object.
*/
+ @Deprecated
void setCanFire(boolean value);
/**
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/BasePlayableEntity.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/BasePlayableEntity.java
index 8b7612a2..a4f97865 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/BasePlayableEntity.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/BasePlayableEntity.java
@@ -2,6 +2,16 @@
import com.boxtrotstudio.ghost.game.match.Event;
import com.boxtrotstudio.ghost.game.match.Match;
+import com.boxtrotstudio.ghost.game.match.abilities.PlayerAbility;
+import com.boxtrotstudio.ghost.game.match.entities.map.FlagEntity;
+import com.boxtrotstudio.ghost.game.match.stats.BuffType;
+import com.boxtrotstudio.ghost.game.match.stats.TemporaryStats;
+import com.boxtrotstudio.ghost.game.match.world.physics.BasePhysicsEntity;
+import com.boxtrotstudio.ghost.game.match.world.physics.CollisionResult;
+import com.boxtrotstudio.ghost.game.match.world.physics.Hitbox;
+import com.boxtrotstudio.ghost.game.match.world.physics.PolygonHitbox;
+import com.boxtrotstudio.ghost.utils.MethodDeprecatedException;
+import com.boxtrotstudio.ghost.utils.Vector2f;
import com.boxtrotstudio.ghost.game.match.abilities.Ability;
import com.boxtrotstudio.ghost.game.match.abilities.Gun;
import com.boxtrotstudio.ghost.game.match.entities.Entity;
@@ -50,14 +60,13 @@ public abstract class BasePlayableEntity extends BasePhysicsEntity implements Pl
protected int preferredItem = -1;
- protected boolean canFire = true;
protected VisibleFunction function = VisibleFunction.ORIGINAL; //Always default to original style
protected Stat visibleLength = new Stat("vlen", 800.0); //In ms
protected Stat visibleStrength = new Stat("vstr", 255.0);
protected int invincibilityStack;
- private Ability ability = new Gun(this);
+ protected Ability ability = new Gun(this);
private TemporaryStats stats;
private boolean tempWasHit;
@@ -650,18 +659,6 @@ public Ability currentAbility() {
return ability;
}
- @Override
- public void _packet_setCurrentAbility(Class extends Ability> class_) {
- if (!canChangeAbility)
- return;
-
- try {
- this.ability = class_.getConstructor(PlayableEntity.class).newInstance(this);
- } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
- throw new IllegalArgumentException("This ability is not compatible!");
- }
- }
-
@Override
public void setCurrentAbility(Ability ability) {
this.ability = ability;
@@ -678,15 +675,18 @@ public void setCanChangeAbility(boolean value) {
}
private boolean isFiring;
- public void useAbility(float targetX, float targetY, int action) {
- if (!canFire || isDead)
+ public void useAbility(float targetX, float targetY, boolean secondary) {
+ if (isDead)
return; //This playable can't use abilities
if (ability != null) {
hasStartedFade = false;
isFiring = true;
- ability.use(targetX, targetY);
+ if (!secondary)
+ ability.usePrimary(targetX, targetY);
+ else
+ ability.useSecondary(targetX, targetY);
}
}
@@ -700,14 +700,14 @@ public void setCarryingFlag(boolean value) {
this.carryingFlag = value;
}
- @Override
public boolean canFire() {
- return canFire;
+ return ability.canFirePrimary();
}
@Override
public void setCanFire(boolean val) {
- this.canFire = val;
+ throw new MethodDeprecatedException("This value is no longer checked. PlayerAbility control cooldown,\n" +
+ "you can control cooldown rate (firerate) with the PlayableEntity.getFireRateStat() object.");
}
/**
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/impl/BaseNetworkPlayer.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/impl/BaseNetworkPlayer.java
index 82d3fb49..4bb60b34 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/impl/BaseNetworkPlayer.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/entities/playable/impl/BaseNetworkPlayer.java
@@ -15,6 +15,7 @@
import com.boxtrotstudio.ghost.network.sql.PlayerData;
import com.boxtrotstudio.ghost.network.sql.PlayerUpdate;
import com.boxtrotstudio.ghost.utils.Global;
+import com.boxtrotstudio.ghost.utils.MethodDeprecatedException;
import com.boxtrotstudio.ghost.utils.PRunnable;
import com.boxtrotstudio.ghost.utils.Vector2f;
@@ -238,7 +239,9 @@ public void setName(String name) {
* Have this playable move towards an {x, y} point and update all players in the match
* @param targetX The x point to move towards
* @param targetY The y point to move towards
+ * @deprecated The client no longer sends this kind of action.
*/
+ @Deprecated
public void moveTowards(float targetX, float targetY) {
if (!isUDPConnected())
return;
@@ -265,6 +268,8 @@ public void moveTowards(float targetX, float targetY) {
if (world != null) {
world.requestEntityUpdate();
}
+
+ throw new MethodDeprecatedException("The client shouldn't be sending this kind of action!");
}
/**
@@ -294,15 +299,15 @@ public void moveWithDirection(Vector2f direction) {
* Have this playable fire towards an {x, y} point and update all players in the match
* @param targetX The x point to fire towards
* @param targetY The y point to fire towards
- * @param action The action that was requested
+ * @param secondary The action that was requested
*/
- public void fireTowards(float targetX, float targetY, int action) {
+ public void fireTowards(float targetX, float targetY, boolean secondary) {
if (!isUDPConnected())
return;
lastActive = System.currentTimeMillis();
- useAbility(targetX, targetY, action);
+ useAbility(targetX, targetY, secondary);
}
@Override
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/item/SpeedItem.java b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/item/SpeedItem.java
index b46daa91..6863f416 100755
--- a/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/item/SpeedItem.java
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/game/match/item/SpeedItem.java
@@ -1,7 +1,7 @@
package com.boxtrotstudio.ghost.game.match.item;
import com.boxtrotstudio.ghost.game.match.LiveMatch;
-import com.boxtrotstudio.ghost.game.match.abilities.CancelableAbility;
+import com.boxtrotstudio.ghost.game.match.abilities.PlayerAbility;
import com.boxtrotstudio.ghost.game.match.entities.items.ItemEntity;
import com.boxtrotstudio.ghost.game.match.entities.items.SpeedItemEntity;
import com.boxtrotstudio.ghost.game.match.stats.BuffType;
@@ -33,8 +33,8 @@ protected void onActivated() {
activator.getSpeedStat().addBuff("speed_item_buff", BuffType.PercentAddition, 50, false);
activator.onStatUpdate(activator.getSpeedStat());
- if (activator.currentAbility() instanceof CancelableAbility) {
- ((CancelableAbility)activator.currentAbility()).cancel();
+ if (activator.currentAbility() instanceof PlayerAbility) {
+ ((PlayerAbility)activator.currentAbility()).cancel();
}
}
diff --git a/server/api/src/main/java/com/boxtrotstudio/ghost/utils/MethodDeprecatedException.java b/server/api/src/main/java/com/boxtrotstudio/ghost/utils/MethodDeprecatedException.java
new file mode 100644
index 00000000..e429f7dc
--- /dev/null
+++ b/server/api/src/main/java/com/boxtrotstudio/ghost/utils/MethodDeprecatedException.java
@@ -0,0 +1,15 @@
+package com.boxtrotstudio.ghost.utils;
+
+public class MethodDeprecatedException extends RuntimeException {
+
+ public MethodDeprecatedException() {
+ }
+
+ public MethodDeprecatedException(String message) {
+ super(message);
+ }
+
+ public MethodDeprecatedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/GameServer.java b/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/GameServer.java
index e99cff0c..9da9649e 100755
--- a/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/GameServer.java
+++ b/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/GameServer.java
@@ -6,6 +6,7 @@
import com.boxtrotstudio.aws.model.GameSession;
import com.boxtrotstudio.ghost.common.game.MatchFactory;
import com.boxtrotstudio.ghost.common.game.NetworkMatch;
+import com.boxtrotstudio.ghost.common.game.Player;
import com.boxtrotstudio.ghost.common.game.PlayerFactory;
import com.boxtrotstudio.ghost.common.game.gamemodes.tutorial.TutorialBot;
import com.boxtrotstudio.ghost.common.game.gamemodes.tutorial.TutorialMatch;
@@ -152,8 +153,8 @@ private static void gameServerStarted(GameSession session) {
PlayerPacketObject[] team1 = Global.GSON.fromJson(team1Json, PlayerPacketObject[].class);
PlayerPacketObject[] team2 = Global.GSON.fromJson(team2Json, PlayerPacketObject[].class);
- PlayableEntity[] pTeam1 = new PlayableEntity[team1Size];
- PlayableEntity[] pTeam2 = new PlayableEntity[team2Size];
+ Player[] pTeam1 = new Player[team1Size];
+ Player[] pTeam2 = new Player[team2Size];
for (int i = 0; i < team1.length; i++) {
PlayerPacketObject p = team1[i];
diff --git a/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/network/packets/CreateMatchPacket.java b/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/network/packets/CreateMatchPacket.java
index a7b045a1..9a895bf5 100755
--- a/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/network/packets/CreateMatchPacket.java
+++ b/server/gameserver/src/main/java/com/boxtrotstudio/ghost/gameserver/api/network/packets/CreateMatchPacket.java
@@ -1,6 +1,7 @@
package com.boxtrotstudio.ghost.gameserver.api.network.packets;
import com.boxtrotstudio.ghost.common.game.MatchFactory;
+import com.boxtrotstudio.ghost.common.game.Player;
import com.boxtrotstudio.ghost.common.game.gamemodes.tutorial.TutorialBot;
import com.boxtrotstudio.ghost.common.game.gamemodes.tutorial.TutorialMatch;
import com.boxtrotstudio.ghost.common.network.BaseServer;
@@ -37,8 +38,8 @@ public void onHandlePacket(MatchmakingClient client) throws IOException {
team2[i] = consume(chunkSize).as(PlayerPacketObject.class);
}
- PlayableEntity[] pTeam1 = new PlayableEntity[team1Count];
- PlayableEntity[] pTeam2 = new PlayableEntity[team2Count];
+ Player[] pTeam1 = new Player[team1Count];
+ Player[] pTeam2 = new Player[team2Count];
for (int i = 0; i < team1.length; i++) {
PlayerPacketObject p = team1[i];
diff --git a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/Main.java b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/Main.java
index 55e947ba..31c79720 100755
--- a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/Main.java
+++ b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/Main.java
@@ -26,6 +26,7 @@
import com.boxtrotstudio.ghost.test.network.packets.QueueRequestPacket;
import com.boxtrotstudio.ghost.utils.ArrayHelper;
import com.boxtrotstudio.ghost.utils.Global;
+import com.boxtrotstudio.ghost.utils.PRunnable;
import com.boxtrotstudio.ghost.utils.Scheduler;
import me.eddiep.jconfig.JConfig;
@@ -132,11 +133,24 @@ public static void main(String[] args) {
for (int i = 0; i < MAX_MATCHES; i++) {
NetworkMatch match = createTestMatch(TEAM_SIZE, i);
-
- ArrayHelper.forEach(ArrayHelper.combine(match.getTeam1().getTeamMembers(), match.getTeam2().getTeamMembers()), p -> {
- p.setLives((byte) 3);
- p._packet_setCurrentAbility(class_[Global.random(0, class_.length)]);
- p.setVisibleFunction(VisibleFunction.ORIGINAL);
+ ArrayHelper.forEach(ArrayHelper.combine(match.getTeam1().getTeamMembers(), match.getTeam2().getTeamMembers()), new PRunnable() {
+ @Override
+ public void run(PlayableEntity p) {
+ p.setLives((byte) 3);
+ int t = Global.random(0, 3);
+ switch (t) {
+ case 0:
+ p.setCurrentAbility(new Gun(p));
+ break;
+ case 1:
+ p.setCurrentAbility(new Laser(p));
+ break;
+ case 2:
+ p.setCurrentAbility(new Dash(p));
+ break;
+ }
+ p.setVisibleFunction(VisibleFunction.ORIGINAL);
+ }
});
match.start();
diff --git a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/BoomQueue.java b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/BoomQueue.java
index 2856fcb6..a51a2f8c 100755
--- a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/BoomQueue.java
+++ b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/BoomQueue.java
@@ -28,7 +28,7 @@ public String description() {
@Override
public void setupPlayer(PlayableEntity p) {
- p._packet_setCurrentAbility(Boomerang.class);
+ p.setCurrentAbility(new Boomerang(p));
p.setVisibleFunction(VisibleFunction.ORIGINAL);
p.setLives((byte) 3);
}
diff --git a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/DashQueue.java b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/DashQueue.java
index f1cd5f0b..21fb86d0 100755
--- a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/DashQueue.java
+++ b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/DashQueue.java
@@ -28,7 +28,7 @@ public String description() {
@Override
public void setupPlayer(PlayableEntity p) {
- p._packet_setCurrentAbility(Dash.class);
+ p.setCurrentAbility(new Dash(p));
p.setVisibleFunction(VisibleFunction.ORIGINAL);
p.setLives((byte) 3);
}
diff --git a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/LaserQueue.java b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/LaserQueue.java
index 1b5ec19a..12f39213 100755
--- a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/LaserQueue.java
+++ b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/LaserQueue.java
@@ -9,8 +9,8 @@ public class LaserQueue extends DemoQueue {
@Override
public void setupPlayer(PlayableEntity p) {
p.setLives((byte) 3);
+ p.setCurrentAbility(new Laser(p));
p.setVisibleFunction(VisibleFunction.ORIGINAL);
- p._packet_setCurrentAbility(Laser.class);
}
@Override
diff --git a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/TutorialQueue.java b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/TutorialQueue.java
index f6170892..4a8561c9 100755
--- a/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/TutorialQueue.java
+++ b/server/testing/src/main/java/com/boxtrotstudio/ghost/test/game/queue/impl/TutorialQueue.java
@@ -75,7 +75,7 @@ public void onTeamEnterMatch(Team team1, Team team2) {
ArrayHelper.combine(team1.getTeamMembers(), team2.getTeamMembers()),
p -> {
p.setLives((byte) 3);
- p._packet_setCurrentAbility(Gun.class);
+ p.setCurrentAbility(new Gun(p));
}
);
}
diff --git a/servers/1.gserver b/servers/1.gserver
deleted file mode 100755
index 6317d0d1..00000000
--- a/servers/1.gserver
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "internal_group": "Beta1",
- "streamLevel": 2,
- "ip": "107.170.23.29",
- "port": 6421
-}
\ No newline at end of file
diff --git a/updatecreator/build.gradle b/updatecreator/build.gradle
deleted file mode 100755
index 37a35d31..00000000
--- a/updatecreator/build.gradle
+++ /dev/null
@@ -1,17 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'maven'
-
-group = 'com.boxtrotstudio'
-version = '1.0-SNAPSHOT'
-
-description = """Create update files to host on a remote server"""
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
-[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-sourceSets.main.java.srcDirs = [ "src/main/java" ]
-
-eclipse.project {
- name = appName + "-updatecreator"
-}
diff --git a/updatecreator/src/main/java/META-INF/MANIFEST.MF b/updatecreator/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100755
index 8bd6dbcf..00000000
--- a/updatecreator/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: com.boxtrotstudio.updates.Main
-
diff --git a/updatecreator/src/main/java/com/boxtrotstudio/updates/Main.java b/updatecreator/src/main/java/com/boxtrotstudio/updates/Main.java
deleted file mode 100755
index 3ed3793b..00000000
--- a/updatecreator/src/main/java/com/boxtrotstudio/updates/Main.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package com.boxtrotstudio.updates;
-
-import com.boxtrotstudio.updates.api.Update;
-import com.boxtrotstudio.updates.api.UpdateBuilder;
-import com.boxtrotstudio.updates.api.UpdateType;
-import com.boxtrotstudio.updates.api.Version;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.reflect.TypeToken;
-import org.apache.commons.cli.*;
-import org.apache.commons.io.IOUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Type;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
-public class Main {
- private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
-
- public static void main(String[] args) throws IOException, ParseException {
- if (args.length == 0) {
- String header = "Create and update an update file!\nAt least one command is required.\n";
- String footer = "\nYou must specify the location of the current update file, or you can use -s to start a new one";
-
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("updatecreator", header, getOptions(), footer, true);
- System.exit(-1);
- return;
- }
-
- Options options = parseArgs(args);
- List updates;
-
- if (options.hasOption("s")) {
- updates = new ArrayList<>();
- } else if (!options.hasOption("u")) {
- System.err.println("You must specify the location of the current update file!");
- System.exit(1);
- return;
- } else if (options.hasOption("u")) {
- URL url;
- String location = options.getOption("u").getValue();
- File test = new File(location);
- if (test.exists())
- url = test.toURI().toURL();
- else
- url = new URL(location);
-
- String json = IOUtils.toString(url.openStream(), Charset.defaultCharset());
-
- Type t = new TypeToken>() { }.getType();
- updates = GSON.fromJson(json, t);
- } else {
- System.err.println("You must specify the location of the current update file!");
- System.exit(1);
- return;
- }
-
- if (options.hasOption("l")) {
- if (updates.size() == 0) {
- System.err.println("You cannot list a new update file!");
- System.exit(3);
- return;
- }
-
- for (Update u : updates) {
- System.out.println(u);
- System.out.println();
- }
- } else if (options.hasOption("c")) {
- UpdateBuilder builder;
- if (updates.size() == 0) {
- builder = UpdateBuilder.fromVersion(new Version(1, 0, 0));
- builder.withType(UpdateType.NEW);
- }
- else
- builder = UpdateBuilder.fromPreviousUpdate(updates.get(updates.size() - 1));
-
- if (options.hasOption("d"))
- builder.withDescription(options.getOption("d").getValue());
- if (options.hasOption("a")) {
- File location = new File(options.getOption("a").getValue());
- if (!location.exists()) {
- System.err.println("File does not exist! \"" + location.getAbsolutePath() + '"');
- System.exit(2);
- return;
- }
- builder.withArchive(location);
- }
- if (options.hasOption("b")) {
- String type = options.getOption("b").getValue().toLowerCase();
-
- switch (type) {
- case "bugfix":
- case "bf":
- builder.bumpBugfix();
- break;
- case "minor":
- builder.bumpMinor();
- break;
- case "major":
- builder.bumpMajor();
- break;
- default:
- System.err.println("Invalid bump value! (Given: " + type + ", Expected: bugfix, minor, or major)");
- System.exit(4);
- break;
- }
- }
-
- Update update = builder.build();
- updates.add(update);
-
- String prettyJson = GSON.toJson(updates);
- System.out.println(prettyJson);
- } else if (options.hasOption("r")) {
- if (updates.size() == 0) {
- System.err.println("No updates to rollback!");
- System.exit(5);
- return;
- }
-
- Update update = UpdateBuilder.rollback(updates.get(updates.size() - 1));
- updates.add(update);
-
- String prettyJson = GSON.toJson(updates);
- System.out.println(prettyJson);
- }
- }
-
- private static Options parseArgs(String[] args) throws ParseException {
- CommandLineParser parser = new BasicParser();
- CommandLine cmd = parser.parse(getOptions(), args);
-
- Options output = new Options();
- for (Option o : cmd.getOptions()) {
- output.addOption(o);
- }
-
- return output;
- }
-
- private static Options getOptions() {
- Options options = new Options();
-
- Option startFile = new Option("s", false, "[command] Start a new update file, this should be followed by the -c command");
- Option currentFile = new Option("u", true, "[command] The current location of update file");
- Option list = new Option("l", false, "[command] List all updates from current file");
- Option build = new Option("c", false, "[command] Create a new update to add to the current file. This should be followed by options");
- Option rollback = new Option("r", false, "[command] Create an update that rolls back the latest update");
-
- //Build Options
- Option description = new Option("d", true, "[option] A description for the update");
- Option archiveLocation = new Option("a", true, "[option] The location of the archive to use");
- Option downloadLocation = new Option("d", true, "[option] The download location clients should download the archive from");
- Option bump = new Option("b", true, "[option] Bump one of the 3 version attributes instead of specifying a version (ex; -b major)");
-
- options.addOption(startFile);
- options.addOption(downloadLocation);
- options.addOption(currentFile);
- options.addOption(list);
- options.addOption(build);
- options.addOption(rollback);
-
- options.addOption(description);
- options.addOption(archiveLocation);
- options.addOption(bump);
-
- return options;
- }
-}
diff --git a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Update.java b/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Update.java
deleted file mode 100755
index e8cc2470..00000000
--- a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Update.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.boxtrotstudio.updates.api;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashMap;
-
-/**
- * This object represents a single update.
- */
-public class Update {
- private int id;
- private Version version;
- private UpdateType type;
- private String[] filesModified;
- private HashMap md5;
- private String archiveLocation;
- private long releaseDate;
- private String description;
-
- /**
- * Get the semantic {@link Version} of this {@link Update}
- * @return The {@link Version} of this update
- */
- public Version getVersion() {
- return version;
- }
-
- /**
- * Get the {@link UpdateType} of this {@link Update}
- * @return The {@link UpdateType}
- */
- public UpdateType getType() {
- return type;
- }
-
- /**
- * Get an array of all the files modified. This usually reflects the
- * files contained in the archive
- * @return All the files that were modified in this update
- */
- public String[] getFilesModified() {
- return filesModified;
- }
-
- /**
- * Get a {@link HashMap} of all the MD5 hash for the files modified. The key of the {@link HashMap} is
- * the file path and the value is the file's MD5
- * @return A {@link HashMap}
- */
- public HashMap getMd5() {
- return md5;
- }
-
- /**
- * Get the location of this update
- * @return The location of this update represented as a {@link String}
- */
- public String getArchiveLocation() {
- return archiveLocation;
- }
-
- /**
- * Get the location of this update
- * @return The location of this update represented as a {@link URL}
- */
- public URL getArchiveURL() {
- try {
- return new URL(archiveLocation);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * Get when this update was released as a Unix timestamp
- * @return The time this update was released
- */
- public long getReleaseDate() {
- return releaseDate;
- }
-
- /**
- * Get a text description of this update
- * @return The text description of this update
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Get the unique ID for this update
- * @return The unique ID for this update
- */
- public int getId() {
- return id;
- }
-
- void setVersion(Version version) {
- this.version = version;
- }
-
- void setType(UpdateType type) {
- this.type = type;
- }
-
- void setFilesModified(String[] filesModified) {
- this.filesModified = filesModified;
- }
-
- void setMd5(HashMap md5) {
- this.md5 = md5;
- }
-
- void setArchiveLocation(String archiveLocation) {
- this.archiveLocation = archiveLocation;
- }
-
- void setReleaseDate(long releaseDate) {
- this.releaseDate = releaseDate;
- }
-
- void setDescription(String description) {
- this.description = description;
- }
-
- void setId(int id) {
- this.id = id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Update update = (Update) o;
-
- if (id != update.id) return false;
- if (releaseDate != update.releaseDate) return false;
- if (version != null ? !version.equals(update.version) : update.version != null) return false;
- if (type != update.type) return false;
- // Probably incorrect - comparing Object[] arrays with Arrays.equals
- if (!Arrays.equals(filesModified, update.filesModified)) return false;
- if (md5 != null ? !md5.equals(update.md5) : update.md5 != null) return false;
- if (!archiveLocation.equals(update.archiveLocation)) return false;
- return description.equals(update.description);
-
- }
-
- @Override
- public int hashCode() {
- int result = id;
- result = 31 * result + (version != null ? version.hashCode() : 0);
- result = 31 * result + type.hashCode();
- result = 31 * result + Arrays.hashCode(filesModified);
- result = 31 * result + (md5 != null ? md5.hashCode() : 0);
- result = 31 * result + archiveLocation.hashCode();
- result = 31 * result + (int) (releaseDate ^ (releaseDate >>> 32));
- result = 31 * result + description.hashCode();
- return result;
- }
-
- @Override
- public String toString() {
- return "Update{" +
- "id=" + id +
- ", version=" + version +
- ", type=" + type +
- ", filesModified=" + Arrays.toString(filesModified) +
- ", md5=" + md5 +
- ", archiveLocation='" + archiveLocation + '\'' +
- ", releaseDate=" + releaseDate +
- ", description='" + description + '\'' +
- '}';
- }
-}
diff --git a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateBuilder.java b/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateBuilder.java
deleted file mode 100755
index b1e6622b..00000000
--- a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateBuilder.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package com.boxtrotstudio.updates.api;
-
-import org.apache.commons.codec.digest.DigestUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-public class UpdateBuilder {
- private Update previousUpdate;
- private String description;
- private List filesModified;
- private HashMap md5;
- private Version version;
- private UpdateType type;
- private String download;
-
- public static UpdateBuilder fromPreviousUpdate(Update update) {
- UpdateBuilder builder = new UpdateBuilder();
- builder.previousUpdate = update;
-
- if (update != null) {
- builder.version = new Version(update.getVersion());
- } else {
- builder.version = new Version(1, 0, 0);
- }
-
- return builder;
- }
-
- public static UpdateBuilder fromVersion(Version version) {
- UpdateBuilder builder = new UpdateBuilder();
- builder.previousUpdate = null;
- builder.version = version;
-
- return builder;
- }
-
- public static Update rollback(Update update) {
- UpdateBuilder builder = fromPreviousUpdate(update);
- builder.bumpBugfix();
- builder.withType(UpdateType.ROLLBACK);
- builder.filesModified = Arrays.asList(update.getFilesModified());
- builder.md5 = update.getMd5();
-
- return builder.build();
- }
-
- private UpdateBuilder() { }
-
- public UpdateBuilder bumpBugfix() {
- version.setBugfix(version.getBugfix() + 1);
- type = UpdateType.BUGFIX;
- return this;
- }
-
- public UpdateBuilder bumpMinor() {
- version.setBugfix(0);
- version.setMinor(version.getMinor() + 1);
- type = UpdateType.MINOR;
- return this;
- }
-
- public UpdateBuilder bumpMajor() {
- version.setBugfix(0);
- version.setMinor(0);
- version.setMajor(version.getMajor() + 1);
- type = UpdateType.MAJOR;
- return this;
- }
-
- public UpdateBuilder withVersion(Version version) {
- this.version = version;
- return this;
- }
-
- public UpdateBuilder withDescription(String description) {
- this.description = description;
- return this;
- }
-
- public UpdateBuilder withArchive(File archive) throws IOException {
- ZipFile zip = new ZipFile(archive);
-
- filesModified = new ArrayList<>();
- md5 = new HashMap<>();
-
- Enumeration extends ZipEntry> wat = zip.entries();
- while (wat.hasMoreElements()) {
- ZipEntry entry = wat.nextElement();
-
- if (entry.getName().contains("program.json"))
- continue; //Ignore all program.json files
-
- String md5 = DigestUtils.md5Hex(zip.getInputStream(entry));
-
- filesModified.add(entry.getName());
- this.md5.put(entry.getName(), md5);
- }
-
- zip.close();
-
- return this;
- }
-
- public UpdateBuilder withType(UpdateType type) {
- this.type = type;
- return this;
- }
-
- public UpdateBuilder withDownloadLocation(String location) {
- this.download = location;
- return this;
- }
-
- public Update build() {
- Update update = new Update();
- update.setVersion(version);
-
- if (this.previousUpdate != null)
- update.setId(previousUpdate.getId() + 1);
- else
- update.setId(1);
-
- if (type == null)
- update.setType(UpdateType.UNKNOWN);
- else
- update.setType(type);
-
- if (description != null)
- update.setDescription(description);
- else
- update.setDescription("No description specified");
-
- if (filesModified != null)
- update.setFilesModified(filesModified.toArray(new String[filesModified.size()]));
- else
- update.setFilesModified(new String[0]);
-
- if (md5 != null)
- update.setMd5(md5);
- else
- update.setMd5(new HashMap<>());
-
- if (download != null)
- update.setArchiveLocation(download);
- else
- update.setArchiveLocation("");
-
- update.setReleaseDate(System.currentTimeMillis());
- return update;
- }
-}
diff --git a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateType.java b/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateType.java
deleted file mode 100755
index b941953b..00000000
--- a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/UpdateType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.boxtrotstudio.updates.api;
-
-public enum UpdateType {
- MAJOR(2),
- MINOR(1),
- BUGFIX(0),
- ROLLBACK(-1),
- UNKNOWN(-2),
- NEW(-3);
-
- int type;
- UpdateType(int type) { this.type = type; }
-
- public int getType() {
- return type;
- }
-
- public static UpdateType fromInt(int i) {
- for (UpdateType t : values()) {
- if (t.getType() == i)
- return t;
- }
-
- return UNKNOWN;
- }
-}
diff --git a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Version.java b/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Version.java
deleted file mode 100755
index e700afaa..00000000
--- a/updatecreator/src/main/java/com/boxtrotstudio/updates/api/Version.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.boxtrotstudio.updates.api;
-
-public class Version {
- private int major;
- private int minor;
- private int bugfix;
-
- public static Version getHigher(Version version1, Version version2) {
- if (version1.major > version2.major)
- return version1;
- else if (version1.major < version2.major)
- return version2;
- else {
- if (version1.minor > version2.minor)
- return version1;
- else if (version1.minor < version2.minor)
- return version2;
- else {
- if (version1.bugfix > version2.bugfix)
- return version1;
- else if (version1.bugfix < version2.bugfix)
- return version2;
- else
- return null;
- }
- }
- }
-
- public static Version parseVersion(String string) {
- String[] dots = string.split("\\.");
- int major;
- int minor = 0;
- int bugfix = 0;
- switch (dots.length) {
- case 0:
- throw new NumberFormatException("Could not find major!");
- case 1:
- major = Integer.parseInt(dots[0]);
- break;
- case 2:
- major = Integer.parseInt(dots[0]);
- minor = Integer.parseInt(dots[1]);
- break;
- case 3:
- major = Integer.parseInt(dots[0]);
- minor = Integer.parseInt(dots[1]);
- bugfix = Integer.parseInt(dots[2]);
- break;
- default:
- throw new UnsupportedOperationException("Version can only have 1, 2, or 3 attributes!");
- }
-
- return new Version(major, minor, bugfix);
- }
-
- public Version(int major, int minor, int bugfix) {
- this.major = major;
- this.minor = minor;
- this.bugfix = bugfix;
- }
-
- public Version(Version clone) {
- this.major = clone.major;
- this.minor = clone.minor;
- this.bugfix = clone.bugfix;
- }
-
- public int getMajor() {
- return major;
- }
-
- public int getMinor() {
- return minor;
- }
-
- public int getBugfix() {
- return bugfix;
- }
-
- public void setMajor(int major) {
- this.major = major;
- }
-
- public void setMinor(int minor) {
- this.minor = minor;
- }
-
- public void setBugfix(int bugfix) {
- this.bugfix = bugfix;
- }
-
- public boolean isHigherThan(Version version) {
- Version higher = getHigher(this, version);
- return higher != null && higher.equals(this);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Version version = (Version) o;
-
- return major == version.major && minor == version.minor && bugfix == version.bugfix;
- }
-
- @Override
- public int hashCode() {
- int result = major;
- result = 31 * result + minor;
- result = 31 * result + bugfix;
- return result;
- }
-
- @Override
- public String toString() {
- return major + "." + minor + '.' + bugfix;
- }
-}
diff --git a/updatecreator/update.json b/updatecreator/update.json
deleted file mode 100755
index b8b322bd..00000000
--- a/updatecreator/update.json
+++ /dev/null
@@ -1,15 +0,0 @@
-[
- {
- "id": 1,
- "version": {
- "major": 1,
- "minor": 0,
- "bugfix": 0
- },
- "type": "NEW",
- "filesModified": [],
- "md5": {},
- "releaseDate": 1459707054693,
- "description": "This is a test"
- }
-]
diff --git a/updater/build.gradle b/updater/build.gradle
deleted file mode 100755
index 9ba774e8..00000000
--- a/updater/build.gradle
+++ /dev/null
@@ -1,22 +0,0 @@
-apply plugin: 'java'
-
-group = 'com.boxtrotstudio.updater'
-version = '1.0-SNAPSHOT'
-
-description = """Generic updater and launcher for boxtrotstudio programs"""
-
-sourceCompatibility = 1.8
-targetCompatibility = 1.8
-
-[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-sourceSets.main.java.srcDirs = [ "src/main/java" ]
-
-eclipse.project {
- name = appName + "-updater"
-}
-
-repositories {
- flatDir {
- dirs '../server/libs'
- }
-}
\ No newline at end of file
diff --git a/updater/src/main/java/META-INF/MANIFEST.MF b/updater/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100755
index 95130958..00000000
--- a/updater/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: com.boxtrotstudio.updater.Main
-
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/Main.java b/updater/src/main/java/com/boxtrotstudio/updater/Main.java
deleted file mode 100755
index 73f5f504..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/Main.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.boxtrotstudio.updater;
-
-import com.boxtrotstudio.updater.gui.Launch;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
-
-public class Main {
-
-
- public static void main(String[] args) throws Exception {
- trustLetsEncrypt();
- new Launch().show();
- }
-
- private static boolean leTrusted;
- public static void trustLetsEncrypt() throws Exception {
- if (leTrusted)
- return;
-
- System.setProperty("http.agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36");
-
- InputStream x1fis = Main.class.getResourceAsStream("/cert/lets-encrypt-x1-cross-signed.der");
- InputStream x2fis = Main.class.getResourceAsStream("/cert/lets-encrypt-x2-cross-signed.der");
- InputStream x3fis = Main.class.getResourceAsStream("/cert/lets-encrypt-x3-cross-signed.der");
- InputStream x4fis = Main.class.getResourceAsStream("/cert/lets-encrypt-x4-cross-signed.der");
-
- Certificate x1CA = CertificateFactory.getInstance("X.509").generateCertificate(x1fis);
- Certificate x2CA = CertificateFactory.getInstance("X.509").generateCertificate(x2fis);
- Certificate x3CA = CertificateFactory.getInstance("X.509").generateCertificate(x3fis);
- Certificate x4CA = CertificateFactory.getInstance("X.509").generateCertificate(x4fis);
-
- KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
- Path ksPath = Paths.get(System.getProperty("java.home"),
- "lib", "security", "cacerts");
- ks.load(Files.newInputStream(ksPath),
- "changeit".toCharArray());
- ks.setCertificateEntry(Integer.toString(1), x1CA);
- ks.setCertificateEntry(Integer.toString(2), x2CA);
- ks.setCertificateEntry(Integer.toString(3), x3CA);
- ks.setCertificateEntry(Integer.toString(4), x4CA);
-
-
- TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- tmf.init(ks);
-
- SSLContext ctx = SSLContext.getInstance("TLS");
- ctx.init(null, tmf.getTrustManagers(), null);
-
- SSLContext.setDefault(ctx);
- HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
- }
-}
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/ProgramConfig.java b/updater/src/main/java/com/boxtrotstudio/updater/ProgramConfig.java
deleted file mode 100755
index bf58f273..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/ProgramConfig.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.boxtrotstudio.updater;
-
-import me.eddiep.jconfig.system.Config;
-import me.eddiep.jconfig.system.annotations.Getter;
-import me.eddiep.jconfig.system.annotations.Setter;
-
-public interface ProgramConfig extends Config {
-
- @Getter(property = "name")
- String getName();
-
- @Getter(property = "execute")
- String execute();
-
- @Getter(property = "updateURL")
- String updateLocation();
-
- @Getter(property = "version")
- String currentVersion();
-
- @Setter(property = "version")
- void setCurrentVersion(String version);
-}
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/api/Update.java b/updater/src/main/java/com/boxtrotstudio/updater/api/Update.java
deleted file mode 100755
index 1f1c0ef9..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/api/Update.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package com.boxtrotstudio.updater.api;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashMap;
-
-/**
- * This object represents a single update.
- */
-public class Update {
- private int id;
- private Version version;
- private UpdateType type;
- private String[] filesModified;
- private HashMap md5;
- private String archiveLocation;
- private long releaseDate;
- private String description;
-
- /**
- * Get the semantic {@link Version} of this {@link Update}
- * @return The {@link Version} of this update
- */
- public Version getVersion() {
- return version;
- }
-
- /**
- * Get the {@link UpdateType} of this {@link Update}
- * @return The {@link UpdateType}
- */
- public UpdateType getType() {
- return type;
- }
-
- /**
- * Get an array of all the files modified. This usually reflects the
- * files contained in the archive
- * @return All the files that were modified in this update
- */
- public String[] getFilesModified() {
- return filesModified;
- }
-
- /**
- * Get a {@link HashMap} of all the MD5 hash for the files modified. The key of the {@link HashMap} is
- * the file path and the value is the file's MD5
- * @return A {@link HashMap}
- */
- public HashMap getMd5() {
- return md5;
- }
-
- /**
- * Get the location of this update
- * @return The location of this update represented as a {@link String}
- */
- public String getArchiveLocation() {
- return archiveLocation;
- }
-
- /**
- * Get the location of this update
- * @return The location of this update represented as a {@link URL}
- */
- public URL getArchiveURL() {
- try {
- return new URL(archiveLocation);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * Get when this update was released as a Unix timestamp
- * @return The time this update was released
- */
- public long getReleaseDate() {
- return releaseDate;
- }
-
- /**
- * Get a text description of this update
- * @return The text description of this update
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Get the unique ID for this update
- * @return The unique ID for this update
- */
- public int getId() {
- return id;
- }
-
- void setVersion(Version version) {
- this.version = version;
- }
-
- void setType(UpdateType type) {
- this.type = type;
- }
-
- void setFilesModified(String[] filesModified) {
- this.filesModified = filesModified;
- }
-
- void setMd5(HashMap md5) {
- this.md5 = md5;
- }
-
- void setArchiveLocation(String archiveLocation) {
- this.archiveLocation = archiveLocation;
- }
-
- void setReleaseDate(long releaseDate) {
- this.releaseDate = releaseDate;
- }
-
- void setDescription(String description) {
- this.description = description;
- }
-
- void setId(int id) {
- this.id = id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Update update = (Update) o;
-
- if (id != update.id) return false;
- if (releaseDate != update.releaseDate) return false;
- if (version != null ? !version.equals(update.version) : update.version != null) return false;
- if (type != update.type) return false;
- // Probably incorrect - comparing Object[] arrays with Arrays.equals
- if (!Arrays.equals(filesModified, update.filesModified)) return false;
- if (md5 != null ? !md5.equals(update.md5) : update.md5 != null) return false;
- if (!archiveLocation.equals(update.archiveLocation)) return false;
- return description.equals(update.description);
-
- }
-
- @Override
- public int hashCode() {
- int result = id;
- result = 31 * result + (version != null ? version.hashCode() : 0);
- result = 31 * result + type.hashCode();
- result = 31 * result + Arrays.hashCode(filesModified);
- result = 31 * result + (md5 != null ? md5.hashCode() : 0);
- result = 31 * result + archiveLocation.hashCode();
- result = 31 * result + (int) (releaseDate ^ (releaseDate >>> 32));
- result = 31 * result + description.hashCode();
- return result;
- }
-
- @Override
- public String toString() {
- return "Update{" +
- "id=" + id +
- ", version=" + version +
- ", type=" + type +
- ", filesModified=" + Arrays.toString(filesModified) +
- ", md5=" + md5 +
- ", archiveLocation='" + archiveLocation + '\'' +
- ", releaseDate=" + releaseDate +
- ", description='" + description + '\'' +
- '}';
- }
-}
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/api/UpdateType.java b/updater/src/main/java/com/boxtrotstudio/updater/api/UpdateType.java
deleted file mode 100755
index 240554f1..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/api/UpdateType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.boxtrotstudio.updater.api;
-
-public enum UpdateType {
- MAJOR(2),
- MINOR(1),
- BUGFIX(0),
- ROLLBACK(-1),
- UNKNOWN(-2),
- NEW(-3);
-
- int type;
- UpdateType(int type) { this.type = type; }
-
- public int getType() {
- return type;
- }
-
- public static UpdateType fromInt(int i) {
- for (UpdateType t : values()) {
- if (t.getType() == i)
- return t;
- }
-
- return UNKNOWN;
- }
-}
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/api/Version.java b/updater/src/main/java/com/boxtrotstudio/updater/api/Version.java
deleted file mode 100755
index 8a15b88c..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/api/Version.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.boxtrotstudio.updater.api;
-
-public class Version {
- private int major;
- private int minor;
- private int bugfix;
-
- public static Version getHigher(Version version1, Version version2) {
- if (version1.major > version2.major)
- return version1;
- else if (version1.major < version2.major)
- return version2;
- else {
- if (version1.minor > version2.minor)
- return version1;
- else if (version1.minor < version2.minor)
- return version2;
- else {
- if (version1.bugfix > version2.bugfix)
- return version1;
- else if (version1.bugfix < version2.bugfix)
- return version2;
- else
- return null;
- }
- }
- }
-
- public static Version parseVersion(String string) {
- String[] dots = string.split("\\.");
- int major;
- int minor = 0;
- int bugfix = 0;
- switch (dots.length) {
- case 0:
- throw new NumberFormatException("Could not find major!");
- case 1:
- major = Integer.parseInt(dots[0]);
- break;
- case 2:
- major = Integer.parseInt(dots[0]);
- minor = Integer.parseInt(dots[1]);
- break;
- case 3:
- major = Integer.parseInt(dots[0]);
- minor = Integer.parseInt(dots[1]);
- bugfix = Integer.parseInt(dots[2]);
- break;
- default:
- throw new UnsupportedOperationException("Version can only have 1, 2, or 3 attributes!");
- }
-
- return new Version(major, minor, bugfix);
- }
-
- public Version(int major, int minor, int bugfix) {
- this.major = major;
- this.minor = minor;
- this.bugfix = bugfix;
- }
-
- public Version(Version clone) {
- this.major = clone.major;
- this.minor = clone.minor;
- this.bugfix = clone.bugfix;
- }
-
- public int getMajor() {
- return major;
- }
-
- public int getMinor() {
- return minor;
- }
-
- public int getBugfix() {
- return bugfix;
- }
-
- public void setMajor(int major) {
- this.major = major;
- }
-
- public void setMinor(int minor) {
- this.minor = minor;
- }
-
- public void setBugfix(int bugfix) {
- this.bugfix = bugfix;
- }
-
- public boolean isHigherThan(Version version) {
- Version higher = getHigher(this, version);
- return higher != null && higher.equals(this);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- Version version = (Version) o;
-
- return major == version.major && minor == version.minor && bugfix == version.bugfix;
- }
-
- @Override
- public int hashCode() {
- int result = major;
- result = 31 * result + minor;
- result = 31 * result + bugfix;
- return result;
- }
-
- @Override
- public String toString() {
- return major + "." + minor + '.' + bugfix;
- }
-}
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.form b/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.form
deleted file mode 100755
index ddce90f9..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.form
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
diff --git a/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.java b/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.java
deleted file mode 100755
index 753a3cf0..00000000
--- a/updater/src/main/java/com/boxtrotstudio/updater/gui/Launch.java
+++ /dev/null
@@ -1,507 +0,0 @@
-package com.boxtrotstudio.updater.gui;
-
-import com.boxtrotstudio.updater.ProgramConfig;
-import com.boxtrotstudio.updater.api.Update;
-import com.boxtrotstudio.updater.api.UpdateType;
-import com.boxtrotstudio.updater.api.Version;
-import com.google.gson.Gson;
-import com.intellij.uiDesigner.core.GridConstraints;
-import com.intellij.uiDesigner.core.GridLayoutManager;
-import com.intellij.uiDesigner.core.Spacer;
-import me.eddiep.jconfig.JConfig;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.oxbow.swingbits.dialog.task.TaskDialogs;
-
-import javax.swing.*;
-import javax.swing.border.EmptyBorder;
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-
-public class Launch {
- private static Gson GSON = new Gson();
- private Path tempDirectory;
- private File gamePath;
- private ProgramConfig config;
-
- private JPanel panel1;
- private JButton button1;
- private JPanel panel2;
- private JPanel panel3;
- private JLabel label;
- private JLabel label2;
- private JProgressBar progressBar1;
- private JPanel panel4;
- private JLabel label44;
-
-
- private boolean didError;
-
- private void getGamePath() {
- final String OS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
-
- if (OS.contains("win")) {
- gamePath = new File(System.getenv("AppData"), "ghost");
- } else if (OS.contains("mac")) {
- gamePath = new File("~/Library/Application Support", "Ghost");
- } else {
- gamePath = new File("~/.ghost");
- }
- }
-
- public void show() {
- getGamePath();
-
- config = JConfig.newConfigObject(ProgramConfig.class);
- File configFile = new File(gamePath, "program.json");
- if (configFile.exists())
- config.load(configFile);
- else {
- try {
- if (!gamePath.mkdirs()) {
- System.out.println("Failed to make game directory!");
- }
- PrintWriter writer = new PrintWriter(configFile);
- Scanner scanner = new Scanner(getClass().getResourceAsStream("/program.json"));
- while (scanner.hasNextLine()) {
- writer.println(scanner.nextLine());
- }
-
- writer.close();
- scanner.close();
-
- config.load(configFile);
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
-
-
- final JFrame frame = new JFrame("Launcher");
- frame.setContentPane(panel1);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.pack();
- frame.setVisible(true);
-
- frame.setSize(500, 400);
-
- label44.setForeground(new Color(39, 39, 39, 1));
- label44.setBackground(new Color(39, 39, 39, 1));
-
- label44.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- try {
- Desktop.getDesktop().browse(new URI("http://boxtrotstudio.com"));
- } catch (IOException | URISyntaxException e1) {
- e1.printStackTrace();
- }
- }
-
- @Override
- public void mouseEntered(MouseEvent e) {
- label44.setCursor(new Cursor(Cursor.HAND_CURSOR));
- }
-
- @Override
- public void mouseExited(MouseEvent e) {
- label44.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
- }
- });
-
- button1.setBackground(new Color(93, 148, 86));
- button1.setForeground(new Color(255, 255, 255, 180));
-
- button1.setEnabled(false);
- button1.setVisible(false);
-
- panel1.setBackground(new Color(39, 39, 39));
- panel2.setBackground(new Color(39, 39, 39));
- panel3.setBackground(new Color(39, 39, 39));
- label.setForeground(Color.WHITE);
- label2.setForeground(Color.WHITE);
-
- progressBar1.setIndeterminate(true);
-
- panel1.setBorder(new EmptyBorder(15, 15, 15, 15));
-
- runUpdateCheck(frame);
-
- button1.addActionListener(e -> {
- if (didError) {
- runUpdateCheck(frame);
- } else {
- try {
- launch(config);
- } catch (final Throwable e1) {
- //Spawn both at the same time
- new Thread(() -> TaskDialogs.showException(e1)).start();
-
- try {
- Thread.sleep(800);
- } catch (InterruptedException ignored) {
- }
-
- JOptionPane.showMessageDialog(frame,
- "There was an error launching the game.\nPlease report this at http://boxtrotstudio.com/bugs",
- "Error checking for updates",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
-
- private void runUpdateCheck(final JFrame frame) {
- new Thread(() -> {
- button1.setVisible(false);
- button1.setEnabled(false);
- progressBar1.setVisible(true);
- label2.setVisible(true);
- try {
- checkForUpdates();
- } catch (final IOException e) {
- progressBar1.setVisible(false);
- label2.setVisible(false);
- button1.setEnabled(true);
- button1.setVisible(true);
- button1.setText("Try Again");
- didError = true;
-
- //Spawn both at the same time
- new Thread(() -> TaskDialogs.showException(e)).start();
-
- try {
- Thread.sleep(800);
- } catch (InterruptedException ignored) {
- }
-
- JOptionPane.showMessageDialog(frame,
- "There was an error checking for updates.\nPlease report this at http://boxtrotstudio.com/bugs",
- "Error checking for updates",
- JOptionPane.ERROR_MESSAGE);
- }
- }).start();
- }
-
- private void checkForUpdates() throws IOException {
- URL url = new URL(config.updateLocation());
- Version currentVersion = Version.parseVersion(config.currentVersion());
-
- System.out.println("Downloading remote update list");
-
- String json = IOUtils.toString(url, Charset.defaultCharset());
-
- List updates = Arrays.asList(GSON.fromJson(json, Update[].class));
-
- System.out.println("Checking latest update");
-
- if (!currentVersion.equals(updates.get(updates.size() - 1).getVersion())) {
- System.out.println("Potential update found..");
-
- ArrayList updatesMissed = new ArrayList<>();
- Update latest = updates.get(updates.size() - 1);
-
- updatesMissed.add(latest);
- for (int i = updates.size() - 2; i >= 0; i--) {
- Update temp = updates.get(i);
-
- if (temp.getVersion().isHigherThan(currentVersion)) {
- updatesMissed.add(temp);
- } else {
- break;
- }
- }
-
- System.out.println(updatesMissed.size() + " update" + (updatesMissed.size() == 1 ? "" : "s") + " found!");
- System.out.println(currentVersion + " -> " + latest.getVersion());
-
- tempDirectory = Files.createTempDirectory(config.getName());
-
- int taskCount = calculateTaskCount(updatesMissed);
- progressBar1.setIndeterminate(false);
- progressBar1.setMaximum(taskCount);
-
- for (int i = updatesMissed.size() - 1; i >= 0; i--) {
- Update toApply = updatesMissed.get(i);
- label2.setText("Installing " + toApply.getVersion());
- applyUpdate(toApply, updates, updates.indexOf(toApply));
- stepProgressbar();
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- System.out.println();
- System.out.println("All updates applied, launching");
-
- progressBar1.setVisible(false);
- label2.setVisible(false);
- button1.setEnabled(true);
- button1.setVisible(true);
- } else {
- System.out.println("No updates found, launching");
-
- progressBar1.setVisible(false);
- label2.setVisible(false);
- button1.setEnabled(true);
- button1.setVisible(true);
- }
- }
-
- private void stepProgressbar() {
- progressBar1.setValue(progressBar1.getValue() + 1);
- }
-
- private void applyUpdate(Update update, List updateList, int currentIndex) throws IOException {
- System.out.println();
- System.out.println("Applying update " + update.getVersion());
-
- if (update.getType() != UpdateType.ROLLBACK) {
- File tempFile = new File(tempDirectory.toFile(), update.getVersion() + ".zip");
-
- URL downloadURL = new URL(update.getArchiveLocation());
-
- FileUtils.copyURLToFile(downloadURL, tempFile);
-
- ZipInputStream zis = new ZipInputStream(new FileInputStream(tempFile));
-
- ZipEntry file = zis.getNextEntry();
- byte[] buffer = new byte[1024];
- while (file != null) {
- System.out.println("Extracting " + file.getName() + "...");
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
-
- if (file.isDirectory()) {
- file = zis.getNextEntry();
- stepProgressbar();
- continue;
- }
-
- File newFile = new File(gamePath, file.getName()).getAbsoluteFile();
-
- new File(newFile.getParent()).mkdirs();
-
- FileOutputStream fos = new FileOutputStream(newFile);
-
-
- int len;
- while ((len = zis.read(buffer)) > 0) {
- fos.write(buffer, 0, len);
- }
- fos.close();
-
- file = zis.getNextEntry();
- stepProgressbar();
- }
-
- zis.closeEntry();
- zis.close();
- } else {
- System.out.println("Rollback update detected!");
-
- for (String file : update.getFilesModified()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("Searching for " + file + "...");
- String md5 = update.getMd5().get(file);
-
- for (int i = currentIndex - 1; i >= 0; i--) {
- Update temp = updateList.get(i);
-
- if (temp.equals(update))
- continue;
-
- if (arrayContains(temp.getFilesModified(), file)) {
- System.out.println("Found in " + temp.getVersion());
-
- File tempFile = new File(tempDirectory.toFile(), temp.getVersion() + ".zip");
-
- if (!tempFile.exists()) {
- System.out.println("Downloading update " + temp.getVersion() + "...");
-
- URL downloadURL = new URL(temp.getArchiveLocation());
-
- FileUtils.copyURLToFile(downloadURL, tempFile);
- }
-
- ZipFile zzzz = new ZipFile(tempFile);
-
- ZipInputStream zis = new ZipInputStream(new FileInputStream(tempFile));
-
- ZipEntry zipFile = zis.getNextEntry();
- byte[] buffer = new byte[1024];
-
- boolean badUpdate = false;
-
- while (zipFile != null) {
- if (!zipFile.getName().equals(file)) {
- zipFile = zis.getNextEntry();
- continue;
- }
-
- String their_md5 = DigestUtils.md5Hex(zzzz.getInputStream(zipFile));
- if (their_md5.equals(md5)) {
- badUpdate = true;
- break;
- }
-
- System.out.println("Extracting " + zipFile.getName() + "...");
-
- File newFile = new File(gamePath, zipFile.getName()).getAbsoluteFile();
-
- new File(newFile.getParent()).mkdirs();
-
- FileOutputStream fos = new FileOutputStream(newFile);
-
-
- int len;
- while ((len = zis.read(buffer)) > 0) {
- fos.write(buffer, 0, len);
- }
- fos.close();
- stepProgressbar();
- break;
- }
- zis.closeEntry();
- zis.close();
-
- if (badUpdate)
- continue;
-
- break;
- }
- }
- }
-
- System.out.println("Updating program.json..");
- config.setCurrentVersion(update.getVersion().toString());
- config.save(new File("program.json"));
-
- System.out.println("Rollback complete!");
- }
-
- System.out.println("Update applied successfully!");
- }
-
- private void launch(ProgramConfig config) throws IOException {
- Runtime.getRuntime().exec(config.execute(), null, gamePath);
- System.exit(0);
- }
-
- private static boolean arrayContains(String[] array, String contains) {
- for (String s : array) {
- if (s.equals(contains))
- return true;
- }
- return false;
- }
-
- private static int calculateTaskCount(List updateList) {
- int taskCount = updateList.size();
-
- for (Update u : updateList) {
- taskCount += u.getFilesModified().length;
- }
-
- return taskCount;
- }
-
- {
-// GUI initializer generated by IntelliJ IDEA GUI Designer
-// >>> IMPORTANT!! <<<
-// DO NOT EDIT OR ADD ANY CODE HERE!
- $$$setupUI$$$();
- }
-
- /**
- * Method generated by IntelliJ IDEA GUI Designer
- * >>> IMPORTANT!! <<<
- * DO NOT edit this method OR call it in your code!
- *
- * @noinspection ALL
- */
- private void $$$setupUI$$$() {
- panel1 = new JPanel();
- panel1.setLayout(new GridLayoutManager(5, 4, new Insets(0, 0, 0, 0), -1, -1));
- panel3 = new JPanel();
- panel3.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
- panel1.add(panel3, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
- label = new JLabel();
- label.setFont(new Font(label.getFont().getName(), label.getFont().getStyle(), 36));
- label.setHorizontalAlignment(0);
- label.setHorizontalTextPosition(0);
- label.setText("Project Ghost");
- panel3.add(label, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- final Spacer spacer1 = new Spacer();
- panel3.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- final Spacer spacer2 = new Spacer();
- panel3.add(spacer2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- final Spacer spacer3 = new Spacer();
- panel1.add(spacer3, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
- final Spacer spacer4 = new Spacer();
- panel1.add(spacer4, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
- label2 = new JLabel();
- label2.setFont(new Font(label2.getFont().getName(), label2.getFont().getStyle(), 16));
- label2.setText("Checking for updates...");
- panel1.add(label2, new GridConstraints(2, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- progressBar1 = new JProgressBar();
- panel1.add(progressBar1, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- panel2 = new JPanel();
- panel2.setLayout(new GridLayoutManager(3, 3, new Insets(0, 0, 0, 0), -1, -1));
- panel1.add(panel2, new GridConstraints(4, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
- button1 = new JButton();
- button1.setFont(new Font(button1.getFont().getName(), button1.getFont().getStyle(), 18));
- button1.setText("Launch Game");
- panel2.add(button1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
- final Spacer spacer5 = new Spacer();
- panel2.add(spacer5, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
- final Spacer spacer6 = new Spacer();
- panel2.add(spacer6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- final Spacer spacer7 = new Spacer();
- panel2.add(spacer7, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- panel4 = new JPanel();
- panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
- panel2.add(panel4, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
- label44 = new JLabel();
- label44.setBackground(new Color(-15853247));
- label44.setEnabled(true);
- label44.setForeground(new Color(-15353025));
- label44.setHorizontalAlignment(0);
- label44.setHorizontalTextPosition(0);
- label44.setIcon(new ImageIcon(getClass().getResource("/boxtrotlogo.png")));
- label44.setText("");
- label44.setVerticalAlignment(1);
- label44.setVerticalTextPosition(0);
- panel4.add(label44, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(217, 37), new Dimension(217, 37), 0, false));
- }
-
- /**
- * @noinspection ALL
- */
- public JComponent $$$getRootComponent$$$() {
- return panel1;
- }
-}
diff --git a/updater/src/main/resources/boxtrotlogo.png b/updater/src/main/resources/boxtrotlogo.png
deleted file mode 100755
index 1dd6fc3e..00000000
Binary files a/updater/src/main/resources/boxtrotlogo.png and /dev/null differ
diff --git a/updater/src/main/resources/cert/lets-encrypt-x1-cross-signed.der b/updater/src/main/resources/cert/lets-encrypt-x1-cross-signed.der
deleted file mode 100755
index 97b406af..00000000
Binary files a/updater/src/main/resources/cert/lets-encrypt-x1-cross-signed.der and /dev/null differ
diff --git a/updater/src/main/resources/cert/lets-encrypt-x2-cross-signed.der b/updater/src/main/resources/cert/lets-encrypt-x2-cross-signed.der
deleted file mode 100755
index 61cba413..00000000
Binary files a/updater/src/main/resources/cert/lets-encrypt-x2-cross-signed.der and /dev/null differ
diff --git a/updater/src/main/resources/cert/lets-encrypt-x3-cross-signed.der b/updater/src/main/resources/cert/lets-encrypt-x3-cross-signed.der
deleted file mode 100755
index e08466c5..00000000
Binary files a/updater/src/main/resources/cert/lets-encrypt-x3-cross-signed.der and /dev/null differ
diff --git a/updater/src/main/resources/cert/lets-encrypt-x4-cross-signed.der b/updater/src/main/resources/cert/lets-encrypt-x4-cross-signed.der
deleted file mode 100755
index 53d1ca93..00000000
Binary files a/updater/src/main/resources/cert/lets-encrypt-x4-cross-signed.der and /dev/null differ
diff --git a/updater/src/main/resources/program.json b/updater/src/main/resources/program.json
deleted file mode 100755
index dbc2aff9..00000000
--- a/updater/src/main/resources/program.json
+++ /dev/null
@@ -1 +0,0 @@
-{"execute":"java -jar desktop.jar","name":"Project Ghost","updateURL":"https://api.boxtrotstudio.com/v1/update/check/ghost","version":"0.0.0"}
diff --git a/windows_build.xml b/windows_build.xml
deleted file mode 100755
index d72f2d82..00000000
--- a/windows_build.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
- false
- gui
- C:\Users\Eddie\.babun\cygwin\home\Eddie\Projects\Ghost-Shadow-Warrior-Phantom-Assault-DX\build\classes\artifacts\updater_jar\Project Ghost.jar
- C:\Users\Eddie\.babun\cygwin\home\Eddie\Projects\Ghost-Shadow-Warrior-Phantom-Assault-DX\build\classes\artifacts\updater_jar\launcher.exe
- No Java Runtime
-
- .
- normal
- http://java.com/download
-
- false
- false
-
- C:\Users\Eddie\.babun\cygwin\home\Eddie\Projects\Ghost-Shadow-Warrior-Phantom-Assault-DX\build\classes\artifacts\updater_jar\ball.ico
-
- project_ghost
- Project Ghost
-
-
-
- false
- false
- 1.7.0
-
- preferJre
- 64/32
-
-
- 0.0.0.1
- Version 0.0.1
- Alpha version for Project Ghost
- BoxtrotStudio 2016
- 0.0.0.1
- Version 0.0.1
- Project Ghost
- BoxtrotStudio
- ghost
- ghost.exe
-
-
\ No newline at end of file