summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Shields <shieldsjared@gmail.com>2016-10-04 08:56:01 -0400
committerChristopher Speller <crspeller@gmail.com>2016-10-04 08:56:01 -0400
commit3bac3a006128ebcb4a6ea6dd5e2aa2f8614cb434 (patch)
treec63b2ea94d2de3463137c91d40bc405452637039
parent1a5a6244701615b4f085bb5337d92c2809ac95d3 (diff)
downloadchat-3bac3a006128ebcb4a6ea6dd5e2aa2f8614cb434.tar.gz
chat-3bac3a006128ebcb4a6ea6dd5e2aa2f8614cb434.tar.bz2
chat-3bac3a006128ebcb4a6ea6dd5e2aa2f8614cb434.zip
Updated make files/scripts to accomodate execution/building in windows in addition to linux/mac (#4135)
-rw-r--r--Makefile7
-rw-r--r--webapp/Makefile4
-rw-r--r--webapp/package.json7
-rw-r--r--webapp/tests/client_emoji.test.jsx13
-rw-r--r--webapp/tests/client_file.test.jsx36
-rw-r--r--webapp/webpack.config.js2
6 files changed, 40 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index e3ed6e1a5..ba8321b67 100644
--- a/Makefile
+++ b/Makefile
@@ -377,22 +377,25 @@ run-fullmap: run-server run-client-fullmap
stop-server:
@echo Stopping mattermost
+ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
+ wmic process where "Caption='go.exe' and CommandLine like '%go.exe run%'" call terminate
+ wmic process where "Caption='mattermost.exe' and CommandLine like '%go-build%'" call terminate
+else
@for PID in $$(ps -ef | grep "[g]o run" | awk '{ print $$2 }'); do \
echo stopping go $$PID; \
kill $$PID; \
done
-
@for PID in $$(ps -ef | grep "[g]o-build" | awk '{ print $$2 }'); do \
echo stopping mattermost $$PID; \
kill $$PID; \
done
+endif
stop-client:
@echo Stopping mattermost client
cd $(BUILD_WEBAPP_DIR) && $(MAKE) stop
-
stop: stop-server stop-client
restart: restart-server restart-client
diff --git a/webapp/Makefile b/webapp/Makefile
index 10712deff..5e117989d 100644
--- a/webapp/Makefile
+++ b/webapp/Makefile
@@ -37,10 +37,14 @@ run-fullmap: .npminstall
stop:
@echo Stopping changes watching
+ifeq ($(OS),Windows_NT)
+ wmic process where "Caption='node.exe' and CommandLine like '%webpack%'" call terminate
+else
@for PROCID in $$(ps -ef | grep "[n]ode.*[w]ebpack" | awk '{ print $$2 }'); do \
echo stopping webpack watch $$PROCID; \
kill $$PROCID; \
done
+endif
clean:
@echo Cleaning Webapp
diff --git a/webapp/package.json b/webapp/package.json
index 8ffe0a8f5..085375e5c 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -46,6 +46,7 @@
"babel-preset-react": "6.11.1",
"babel-preset-stage-0": "6.5.0",
"copy-webpack-plugin": "3.0.1",
+ "cross-env": "3.0.0",
"css-loader": "0.25.0",
"eslint": "3.5.0",
"eslint-plugin-react": "6.3.0",
@@ -54,8 +55,8 @@
"file-loader": "0.9.0",
"html-loader": "0.4.4",
"html-webpack-plugin": "2.22.0",
- "imports-loader": "0.6.5",
"image-webpack-loader": "2.0.0",
+ "imports-loader": "0.6.5",
"jquery-deferred": "0.3.1",
"jsdom": "9.5.0",
"jsdom-global": "2.1.0",
@@ -74,8 +75,8 @@
},
"scripts": {
"check": "eslint --ext \".jsx\" --ignore-pattern node_modules --quiet .",
- "build": "NODE_ENV=production webpack",
- "run": "NODE_ENV=production webpack --progress --watch",
+ "build": "cross-env NODE_ENV=production webpack",
+ "run": "cross-env NODE_ENV=production webpack --progress --watch",
"run-fullmap": "webpack --progress --watch",
"test": "mocha-webpack --webpack-config webpack.config.js \"**/*.test.jsx\""
}
diff --git a/webapp/tests/client_emoji.test.jsx b/webapp/tests/client_emoji.test.jsx
index 6370be256..ddded4ff8 100644
--- a/webapp/tests/client_emoji.test.jsx
+++ b/webapp/tests/client_emoji.test.jsx
@@ -9,16 +9,17 @@ const fs = require('fs');
describe('Client.Emoji', function() {
this.timeout(100000);
+ const testGifFileName = 'testEmoji.gif';
+
before(function() {
// write a temporary file so that we have something to upload for testing
const buffer = new Buffer('R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=', 'base64');
-
- const testGif = fs.openSync('test.gif', 'w+');
+ const testGif = fs.openSync(testGifFileName, 'w+');
fs.writeFileSync(testGif, buffer);
});
after(function() {
- fs.unlinkSync('test.gif');
+ fs.unlinkSync(testGifFileName);
});
it('addEmoji', function(done) {
@@ -27,7 +28,7 @@ describe('Client.Emoji', function() {
TestHelper.basicClient().addEmoji(
{creator_id: TestHelper.basicUser().id, name},
- fs.createReadStream('test.gif'),
+ fs.createReadStream(testGifFileName),
function(data) {
assert.equal(data.name, name);
assert.notEqual(data.id, null);
@@ -46,7 +47,7 @@ describe('Client.Emoji', function() {
TestHelper.initBasic(() => {
TestHelper.basicClient().addEmoji(
{creator_id: TestHelper.basicUser().id, name: TestHelper.generateId()},
- fs.createReadStream('test.gif'),
+ fs.createReadStream(testGifFileName),
function(data) {
TestHelper.basicClient().deleteEmoji(
data.id,
@@ -70,7 +71,7 @@ describe('Client.Emoji', function() {
const name = TestHelper.generateId();
TestHelper.basicClient().addEmoji(
{creator_id: TestHelper.basicUser().id, name},
- fs.createReadStream('test.gif'),
+ fs.createReadStream(testGifFileName),
function() {
TestHelper.basicClient().listEmoji(
function(data) {
diff --git a/webapp/tests/client_file.test.jsx b/webapp/tests/client_file.test.jsx
index fac70d19c..171df701b 100644
--- a/webapp/tests/client_file.test.jsx
+++ b/webapp/tests/client_file.test.jsx
@@ -9,16 +9,18 @@ const fs = require('fs');
describe('Client.File', function() {
this.timeout(100000);
+ const testGifFileName = 'testFile.gif';
+
before(function() {
// write a temporary file so that we have something to upload for testing
const buffer = new Buffer('R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=', 'base64');
- const testGif = fs.openSync('test.gif', 'w+');
+ const testGif = fs.openSync(testGifFileName, 'w+');
fs.writeFileSync(testGif, buffer);
});
after(function() {
- fs.unlinkSync('test.gif');
+ fs.unlinkSync(testGifFileName);
});
it('uploadFile', function(done) {
@@ -26,8 +28,8 @@ describe('Client.File', function() {
const clientId = TestHelper.generateId();
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
clientId,
function(resp) {
@@ -47,8 +49,8 @@ describe('Client.File', function() {
it('getFile', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
@@ -72,8 +74,8 @@ describe('Client.File', function() {
it('getFileThumbnail', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
@@ -97,8 +99,8 @@ describe('Client.File', function() {
it('getFilePreview', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
@@ -122,8 +124,8 @@ describe('Client.File', function() {
it('getFileInfo', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
@@ -133,7 +135,7 @@ describe('Client.File', function() {
fileId,
function(info) {
assert.equal(info.id, fileId);
- assert.equal(info.name, 'test.gif');
+ assert.equal(info.name, testGifFileName);
done();
},
@@ -152,8 +154,8 @@ describe('Client.File', function() {
it('getPublicLink', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
@@ -206,8 +208,8 @@ describe('Client.File', function() {
it('getFileInfosForPost', function(done) {
TestHelper.initBasic(() => {
TestHelper.basicClient().uploadFile(
- fs.createReadStream('test.gif'),
- 'test.gif',
+ fs.createReadStream(testGifFileName),
+ testGifFileName,
TestHelper.basicChannel().id,
'',
function(resp) {
diff --git a/webapp/webpack.config.js b/webapp/webpack.config.js
index 153b07339..4058abbd2 100644
--- a/webapp/webpack.config.js
+++ b/webapp/webpack.config.js
@@ -56,7 +56,7 @@ var config = {
loader: 'file?name=files/[hash].[ext]'
},
{
- test: /(node_modules|non_npm_dependencies)\/.+\.(js|jsx)$/,
+ test: /(node_modules|non_npm_dependencies)(\\|\/).+\.(js|jsx)$/,
loader: 'imports',
query: {
$: 'jquery',