diff --git a/.travis.yml b/.travis.yml index ab30d78ff..c757e5a9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,11 @@ sudo: false install: - npm install - npm install -g grunt-cli -- npm install -g npm@'>=2.13.5' \ No newline at end of file +- npm install -g npm@'>=2.13.5' + +env: + global: + - GH_REF: github.com/ScottLogic/StockFlux.git + - secure: ecJ7bY21fCUBzUnlK11lZWC8lZyXrIxK3jkz6NuI9uEQ0lthmL10s0N+makYA9MJApgm6bgcPQNzJRDZ8ogxMTwMNeD+r4Hj8TcNzI4Mze03KdzGzWv7pY6uW5A2OoonOOLWvIJjK4RZqKTBNbbPt1TWgwS+DY02+QKveUiOsKWKeQ16N1qcH0xPT2cQP98TbioMuBF0hBMekfDmF+RqLPvCzR0Q2QYsh0Yb2uCGdMDQw+VJjlTdNWNaLss+i6DxRjvAm1mecK6OsCsGNJG2fV5DmURSBeP4BD4r+0skLPmYtkiNkJ8bXnDdQwLMbHOwfzxgyE6a2gMdSsR4AQMofjXzFQfwfF/RsC6q7LjvalsytLOJAn1XS7IZ+WRn/PHx7+ceRRCsQYd/dRkWMQgYh6c+cvNSV7yDnnxsbVsrdNP2DIIB+KYLMWD90PH4fH0xlyPvULTjGoJfiKBwjSzNB7Vu8H0M7YtjUD334stI1oTvQwgvN0SA6MWe2BvEBv2avFu5IQ7Kv3mySvlYcFZxHidxTBytKDW809UPs3yHGLCLLvhAnF2BtcvOsqzWKjd5VPUYzGGwEzNeWtiQNyyLNEF5K+/zeeqILEN39YRMQtRjtx8MTzQ9NMz3U3si17htfRHB/R5aO6SWJzABWO+uK3SL2zA6IL5c+9polElssIw= + +after_success: bash ./deploy.sh \ No newline at end of file diff --git a/README.md b/README.md index aeb4a44c8..a7c3b52e7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Here are a few things to try: ## Installing -In order to install the application, download [StockFlux installer zipfile](http://scottlogic.github.io/StockFlux/StockFlux.zip), unzip and run the executable. If you haven't already installed an OpenFin application, this will install the required runtime. It'll also add shortcuts to StockFlux to your desktop and start menu. +In order to install the application, download [StockFlux installer zipfile](http://scottlogic.github.io/StockFlux/master/StockFlux.zip), unzip and run the executable. If you haven't already installed an OpenFin application, this will install the required runtime. It'll also add shortcuts to StockFlux to your desktop and start menu. This is an 'evergreen' application, each time it launches the application code is downloaded (from GitHub pages), ensuring that it is always up-to-date. diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 000000000..40e53fafd --- /dev/null +++ b/deploy.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -eo pipefail +if ([ $TRAVIS_PULL_REQUEST == "false" ] && [ "${TRAVIS_REPO_SLUG}" == "ScottLogic/StockFlux" ] && ([ $TRAVIS_BRANCH == "dev" ] || [ $TRAVIS_BRANCH == "master" ])) +then + #Clone the latest gh-pages + git clone https://github.com/ScottLogic/StockFlux.git --branch gh-pages gh-pages + + #Get line with version from the file -> get the second word -> remove quotes around the value + VERSION=$(grep "version" package.json | awk -v N=$2 '{print $2}' | cut -d \" -f2) + echo "Version is: $VERSION" + + #Get line with the release type (develop/master) from the file -> get the second word -> remove quotes around the value + TYPE=$(grep "type" package.json | awk -v N=$2 '{print $2}' | cut -d \" -f2) + echo "Type is: $TYPE" + + if ([ -z "$TYPE" ] || [ -z "$VERSION" ]) + then + echo "Version or Type not set in package.json" + exit 1 + fi + + rm -rf "./gh-pages/$TYPE" + cp -r "./public" "./gh-pages/$TYPE" + rm -rf "./gh-pages/$VERSION" + cp -r "./public" "./gh-pages/$VERSION" + cd gh-pages + + #Removing git history + rm -rf .git + git init + + # inside this git repo we'll pretend to be a new user + git config user.name "Travis CI" + git config user.email "travis@scottlogic.com" + + # The first and only commit to this new Git repo contains all the + # files present with the commit message "Deploy to GitHub Pages". + git add . + git commit -m "Deploy to GitHub Pages" + + # Force push from the current repo's master branch to the remote + # repo's gh-pages branch. (All previous history on the gh-pages branch + # will be lost, since we are overwriting it.) We redirect any output to + # /dev/null to hide any sensitive credential data that might otherwise be exposed. + echo "Pushing to: https://${GH_TOKEN}@${GH_REF}" + git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 +fi diff --git a/gruntfile.js b/gruntfile.js index c59d91747..10dce9c9f 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -2,7 +2,9 @@ 'use strict'; module.exports = function(grunt) { var target = grunt.option('target') || 'http://localhost:5000', - port = process.env.PORT || 5000; + port = process.env.PORT || 5000, + version = grunt.file.readJSON('package.json').version, + type = grunt.file.readJSON('package.json').type; grunt.initConfig({ 'gh-pages': { @@ -87,9 +89,15 @@ module.exports = function(grunt) { }, download: { + //One zip for release type (development/master) and one for the version are created here openfinZip: { - src: ['https://dl.openfin.co/services/download?fileName=StockFlux&config=http://scottlogic.github.io/StockFlux/app.json'], - dest: './public/StockFlux.zip' + src: ['https://dl.openfin.co/services/download?fileName=StockFlux-' + version + + '&config=http://scottlogic.github.io/StockFlux/' + version + '/app.json'], + dest: './public/StockFlux-' + version + '.zip' + }, + openfinTypeZip: { + src: ['https://dl.openfin.co/services/download?fileName=StockFlux-' + type + '&config=http://scottlogic.github.io/StockFlux/' + type + '/app.json'], + dest: './public/StockFlux-' + type + '.zip' } }, diff --git a/package.json b/package.json index 87c399f6d..5f531c582 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "bitflux-openfin", - "version": "10.0.0-rc.1", + "version": "10.0.0-rc.2", + "type": "master", "scripts": { "test": "grunt ci", "postinstall": "cd node_modules/BitFlux && npm i" diff --git a/src/app.json b/src/app.json index 4764b531b..76422e10d 100644 --- a/src/app.json +++ b/src/app.json @@ -9,17 +9,17 @@ "defaultHeight": 0, "frame": false, "showTaskbarIcon": false, - "url": "http://scottlogic.github.io/StockFlux/parent.html", - "applicationIcon": "http://scottlogic.github.io/StockFlux/favicon.ico" + "url": "http://scottlogic.github.io/StockFlux/develop/parent.html", + "applicationIcon": "http://scottlogic.github.io/StockFlux/develop/favicon.ico" }, "runtime": { - "arguments": "", + "arguments": "--enable-aggressive-domstorage-flushing", "version": "stable" }, "shortcut": { "company": "ScottLogic", "description": "Hosts BitFlux as an OpenFin application.", - "icon": "http://scottlogic.github.io/StockFlux/favicon.ico", + "icon": "http://scottlogic.github.io/StockFlux/develop/favicon.ico", "name": "StockFlux" } } diff --git a/src/assets/styles/custom-scroll.less b/src/assets/styles/custom-scroll.less index b6ae6ef03..d3dfe419c 100644 --- a/src/assets/styles/custom-scroll.less +++ b/src/assets/styles/custom-scroll.less @@ -12,7 +12,7 @@ margin-bottom: 10px; } - #favourite-scroll { + &#favourite-scroll { top: @toolbar-height; bottom: @bottom-tab-height; position: absolute; diff --git a/src/sidebars/favourites/favourite-controller.js b/src/sidebars/favourites/favourite-controller.js index a85676865..1bb2865c1 100644 --- a/src/sidebars/favourites/favourite-controller.js +++ b/src/sidebars/favourites/favourite-controller.js @@ -132,16 +132,14 @@ // Repeat the check as in the mean time a stock for this favourite could have been added. if (this.stocks.map((stock1) => { return stock1.code; }).indexOf(favourite) === -1) { var data = stock && stock.data && stock.data[0], - price, - delta, - percentage; + delta = data.close - data.open; if (data) { this.stocks.push({ favourite: true, name: stock.name, code: stock.code, price: data.close, - delta: data.close - data.open, + delta: delta, percentage: delta / data.open * 100, index: this.stockSortFunction(stock) }); diff --git a/src/version-value.js b/src/version-value.js index 1da7e2779..9743b1f79 100644 --- a/src/version-value.js +++ b/src/version-value.js @@ -1,7 +1,7 @@ (function() { 'use strict'; - const VERSION = { version: '10.0.0-rc.1' }; + const VERSION = { version: '10.0.0-rc.2' }; angular.module('stockflux.version') .value('Version', VERSION.version);