diff --git a/.gitignore b/.gitignore index 46e91b3dd..eb73895c6 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ Session.vim .netrwhist *~ tags + +config/config.secret.json diff --git a/Makefile b/Makefile index 6901a4544..23a809d50 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,4 @@ -.PHONY: build run clean test - -check-style: .npminstall - @echo Checking for style guide compliance - - npm run check +.PHONY: run check-style test clean .npminstall: package.json @echo Getting dependencies using npm @@ -12,25 +7,25 @@ check-style: .npminstall touch $@ -build: .npminstall - @echo Building Mobile app +config/config.secret.json: + @echo Generating default config/config.secret.json + @echo '{}' > config/config.secret.json - rm -rf dist - - npm run build - -run: .npminstall +run: .npminstall config/config.secret.json @echo Running Mobile iOS Apps for development react-native run-ios +test: .npminstall config/config.secret.json + npm test + +check-style: .npminstall + @echo Checking for style guide compliance + + npm run check + clean: @echo Cleaning app - rm -rf dist rm -rf node_modules - rm -f .npminstall - - -test: .npminstall - npm test \ No newline at end of file + rm -f .npminstall \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..f06dba37f --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Mattermost Mobile + +This project is the Mattermost mobile client from [https://mattermost.org](https://mattermost.org). + +It's written in JavaScript using React Native. \ No newline at end of file diff --git a/config/config.json b/config/config.json new file mode 100644 index 000000000..760a3f15c --- /dev/null +++ b/config/config.json @@ -0,0 +1,3 @@ +{ + "DefaultServerUrl": "http://localhost:8065" +} diff --git a/src/components/select_server_view.js b/src/components/select_server_view.js index 0704cf24c..27c6b0759 100644 --- a/src/components/select_server_view.js +++ b/src/components/select_server_view.js @@ -4,6 +4,7 @@ import React, {Component} from 'react'; import Client from 'client/client_instance.js'; +import Config from 'config/config.js'; import {connect} from 'react-redux'; import {getPing} from 'actions/general.js'; @@ -41,7 +42,7 @@ class SelectServerView extends Component { super(props); this.state = { - serverUrl: 'http://localhost:8065' + serverUrl: Config.DefaultServerUrl }; } diff --git a/src/config/config.js b/src/config/config.js new file mode 100644 index 000000000..4ec1886d5 --- /dev/null +++ b/src/config/config.js @@ -0,0 +1,12 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import BaseConfig from '../../config/config.json'; +import SecretConfig from '../../config/config.secret.json'; + +const Config = { + ...BaseConfig, + ...SecretConfig +}; + +export default Config; \ No newline at end of file diff --git a/test/test_helper.js b/test/test_helper.js index c34de9818..4f1fe2925 100644 --- a/test/test_helper.js +++ b/test/test_helper.js @@ -4,6 +4,7 @@ import assert from 'assert'; import Client from 'client/client.js'; +import Config from 'config/config.js'; const PASSWORD = 'password1'; @@ -45,7 +46,7 @@ class TestHelper { createClient = () => { const client = new Client(); - client.setUrl('http://localhost:8065'); + client.setUrl(Config.DefaultServerUrl); return client; } @@ -94,7 +95,7 @@ class TestHelper { } initClient = (client, callback) => { - client.setUrl('http://localhost:8065'); + client.setUrl(Config.DefaultServerUrl); client.createUser( this.fakeUser(), @@ -173,4 +174,4 @@ class TestHelper { } } -export default new TestHelper(); \ No newline at end of file +export default new TestHelper();