Skip to content

Installation

Fortunate-MAN edited this page Mar 24, 2017 · 14 revisions

#Building the Swift version on macOS

To build, you need to have Xcode, openssl, and libwebsockets installed. You can install Xcode from the Mac App Store and openssl with Homebrew, but you'll have to compile libwebsockets yourself since the version installed by Homebrew is ancient.

In a terminal, run:

$ brew install openssl
$ git clone -b v2.1-stable https://github.com/warmcat/libwebsockets.git
$ cd libwebsockets
$ mkdir build
$ cd build
$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/usr/local/opt/openssl -DLWS_WITH_HTTP2=1
$ make
$ make install

To build FireAlarm on OS X, use build.sh. project.sh generates an Xcode project, and clean.sh cleans the project.

#Running the bot on macOS

Once you've built the bot, you've got to make a few more changes before you can run the bot. Now, open a command prompt or a terminal. FireAlarm looks for many of it's files in the ~/.firealarm directory, which we have to create.

First, let's go to the home directory

cd ~/

now let's create the directory and change our directory to it

mkdir .firealarm
cd .firealarm

Now, we need to copy some files. Some of them are optional while some are not.

We need to copy three files, filter.json, reports.json, and blacklisted_users.json. All these three files are there in the repository on GH, so we'll copy them from the repository to the .firealarm directory:

cp /path/to/repo/filter.json filter.json
cp /path/to/repo/reports.json reports.json
cp /path/to/repo/blacklisted_users.json blacklisted_users.json

Once these files are copied, we need to manually create a file called location.txt which is optional, but is highly recommended. Now open a file called location.txt using vi, nano or whatever text editor you want to use. Now we need to enter a suitable location in it.

As you're going to be running this on StackOverflow chat, you are expected to have a StackOverflow account. Now, enter your username first and then a descriptive name for the device you are going to run FireAlarm on.

<username> <name of device>

Please remove any spaces in your username before entering your username in the file. It should be something like:

AshishAhuja Mac

do not forget the space in the middle.

Once this is done, you need to specify an environment variable to tell which rooms should FireAlarm join. If you're in the terminal, do this:

export DEVELOPMENT=<enter room id here>

If you're in Xcode, edit the product's scheme and add an environment variable known as DEVELOPMENT with it's content as the room id you want it to join.

If you don't want to enter the password and email each and every time you run the bot, you can put them in two environment variables:

export ChatBotEmail="<enter email here>"
export ChatBotPass="<enter password here>"
Clone this wiki locally