Skip to content

Commit

Permalink
Updated make files/scripts to accomodate execution/building in window…
Browse files Browse the repository at this point in the history
…s in addition to linux/mac (mattermost#4135)
  • Loading branch information
shieldsjared authored and crspeller committed Oct 4, 2016
1 parent 4f19c7c commit 7a8ace8
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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\""
}
Expand Down
13 changes: 7 additions & 6 deletions tests/client_emoji.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -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) {
Expand Down
36 changes: 19 additions & 17 deletions tests/client_file.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@ 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) {
TestHelper.initBasic(() => {
const clientId = TestHelper.generateId();

TestHelper.basicClient().uploadFile(
fs.createReadStream('test.gif'),
'test.gif',
fs.createReadStream(testGifFileName),
testGifFileName,
TestHelper.basicChannel().id,
clientId,
function(resp) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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();
},
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 7a8ace8

Please sign in to comment.