Skip to content

Commit

Permalink
Console bin wrapper, make file, readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tedivm committed Jun 13, 2016
1 parent 5ca6990 commit ce8388d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ any html tags and adds colors.

## Installation

1. Download this package, either from the Releases page or from a git clone.
1. Make sure `virtualenv` is installed- `pip install virtualenv`

2. Install dependencies using `pip`. While not required, it's recommended that
you use [virtualenv](http://www.bogotobogo.com/python/python_virtualenv_virtualenvwrapper.php)
rather than installing your repositories globally.
2. Run `make`

```
pip install -r requirements.txt
```
3. Run `make install`

4. Create settings (as per the instructions below).

5. Run `screepsconsole` from inside the terminal.


## Settings
Expand Down
20 changes: 20 additions & 0 deletions bin/screepsconsole.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

# Get real directory in case of symlink
if [[ -L "${BASH_SOURCE[0]}" ]]
then
DIR="$( cd "$( dirname $( readlink "${BASH_SOURCE[0]}" ) )" && pwd )"
else
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
fi
cd $DIR

ENV="$DIR/../env/bin/activate"
if [ ! -f $ENV ]; then
echo 'Virtual Environment Not Installed'
exit -1
fi

SCRIPT="$DIR/../screeps_console/interactive.py"
source $ENV
$SCRIPT "$@"
35 changes: 35 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

SHELL:=/bin/bash
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

.PHONY: all fresh dependencies install fulluninstall uninstall removedeps

all: dependencies

fresh: fulluninstall dependencies

fulluninstall: uninstall cleancode

install:
# Create link in /usr/local/bin to screeps stats program.
ln -s -f $(ROOT_DIR)/bin/screepsconsole.sh /usr/local/bin/screepsconsole

dependencies:
if [ ! -d $(ROOT_DIR)/env ]; then virtualenv $(ROOT_DIR)/env; fi
source $(ROOT_DIR)/env/bin/activate; yes w | pip install -r $(ROOT_DIR)/requirements.txt

uninstall:
# Remove screepsstats link in /user/local/bin
if [ -L /usr/local/bin/screepsconsole.sh ]; then \
rm /usr/local/bin/screepsconsole; \
fi;

cleancode:
# Remove existing environment
if [ -d $(ROOT_DIR)/env ]; then \
rm -rf $(ROOT_DIR)/env; \
fi;
# Remove compiled python files
if [ -d $(ROOT_DIR)/screep_etl ]; then \
rm -f $(ROOT_DIR)/screep_etl/*.pyc; \
fi;

0 comments on commit ce8388d

Please sign in to comment.