Skip to content

Commit

Permalink
Merge branch 'master' into pyup-update-mkdocs-1.0.3-to-1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
maebert committed Sep 10, 2018
2 parents acdaaec + 1f0fcf4 commit c540ea6
Show file tree
Hide file tree
Showing 15 changed files with 930 additions and 25 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ docs/modules.rst

test.json
site/

.DS_Store
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ clean-test: ## remove test and coverage artifacts
lint: ## check style with flake8
flake8 shellcraft tests src

test: ## run tests quickly with the default Python
pytest
test:
pytest

test-all: ## run tests on every Python version with tox
tox
Expand All @@ -62,23 +62,21 @@ coverage: ## check code coverage quickly with the default Python
coverage html
$(BROWSER) htmlcov/index.html

docs: ## generate Sphinx HTML documentation, including API docs
docs:
mkdocs build --clean
$(BROWSER) site/index.html

servedocs: docs ## compile the docs watching for changes
servedocs:
mkdocs serve

release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload
mkdocs gh-deploy

dist: clean ## builds source and wheel package
dist: clean lint test## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist

release: dist ## package and upload a release
twine upload dist/*

install: clean ## install the package to the active Python's site-packages
python setup.py install

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
![Cover Image](https://raw.githubusercontent.com/maebert/shellcraft/HEAD/docs/img/cover.png)

ShellCraft is a game about mining, crafting, and puzzling, loosely based on Ted Chiang's short story *[Seventy-Two Letters](https://maebert.github.io/shellcraft/72letters)

```sh
# Install ShellCraft
$ pip install shellcraft

# Run ShellCraft:
$ shellcraft
```

Read the [full documentation here](https://maebert.github.io/shellcraft).

![PYPI](https://img.shields.io/pypi/v/shellcraft.svg)
![Travis](https://img.shields.io/travis/maebert/shellcraft.svg)
![PyUp](https://pyup.io/repos/github/maebert/shellcraft/shield.svg)
884 changes: 884 additions & 0 deletions docs/72letters.md

Large diffs are not rendered by default.

Binary file removed docs/img/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tox>=2.3.1
coverage>=4.1
pytest>=2.9.2
mkdocs==1.0.4
twine>=1.11.0
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.7
current_version = 0.9.9
commit = False
allow_dirty = True
tag = False
Expand All @@ -12,7 +12,7 @@ replace = __version__ = '{new_version}'
universal = 1

[flake8]
exclude = docs
exclude = docs, *pb2.py
ignore = E501

[metadata]
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open("src/shellcraft/__init__.py") as f:
VERSION = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M).group(1)

with open('README.rst') as readme_file:
with open('README.md') as readme_file:
readme = readme_file.read()

requirements = ['Click>=6.0', 'protobuf>=3.3.0', 'future>=0.16.0', 'PyYAML>=3.12']
Expand All @@ -24,7 +24,7 @@
long_description=readme,
author="Manuel Ebert",
author_email='manuel@1450.me',
url='https://github.com/maebert/shellcraft',
url='https://maebert.github.io/shellcraft',
packages=find_packages("src"),
package_dir={'': 'src'},
entry_points={
Expand Down
2 changes: 1 addition & 1 deletion src/shellcraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = 'Manuel Ebert'
__email__ = 'manuel@1450.me'
__version__ = '0.9.8'
__version__ = '0.9.9'
8 changes: 3 additions & 5 deletions src/shellcraft/_cli_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _color_in(match):


def _format_str(s):
return re.sub(r'(([\$\*%`])[{};:.a-z0-9_\- ]+(\2))', _color_in, s)
return re.sub(r'(([\$\*%`])[{};:.a-z0-9_\- \n]+(\2))', _color_in, s)


def _unformat_str(s):
Expand Down Expand Up @@ -187,17 +187,15 @@ def echo(s, *vals, **kwargs):
result = ""
for line in s.splitlines():
if not line.startswith(">"):
for l in textwrap.wrap(line, width=min(60, term_width - 2)):
if l.startswith("`"):
l = "\n " + l + "\n"
for l in textwrap.wrap(line, width=min(80, term_width - 2)):
result += l + "\n"
result += "\n"
else:
# Format letter

line = line.replace("> > ", "\n")
line = line.replace("> ", "")
w = min(50, term_width - 12)
w = min(60, term_width - 12)
result += Color.paper(" ╭┄┬┄" + "┄" * w + "┄╮\n")
result += Color.paper(" ╰┄┤ " + " " * w + " ┊\n")
for paragraph in filter(bool, line.splitlines()):
Expand Down
2 changes: 1 addition & 1 deletion src/shellcraft/_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def _round(i):
r, g, b = map(_round, rgb)
return 16 + r * 36 + g * 6 + b


@property
def ansi(self):
"""Generate ANSI escape sequence for color."""
Expand Down Expand Up @@ -89,6 +88,7 @@ def __call__(self, text, ratio=.5):
mix = self._generate(ratio)
return mix.ansi + text + mix.clear


Color.yellow = Color('F5C065')
Color.green = Color('58BD86')
Color.blue = Color('798BDF')
Expand Down
9 changes: 7 additions & 2 deletions src/shellcraft/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import datetime
import os
import sys
import traceback

click.disable_unicode_literals_warning = True

Expand Down Expand Up @@ -37,7 +38,10 @@ def inner(**kwargs):
game.tutorial.cont()
game.save()
except Exception as e:
handle_exception(e)
if game.state.debug:
traceback.print_exc()
else:
handle_exception(e)
return inner


Expand Down Expand Up @@ -111,7 +115,6 @@ def mine(game, resource):
if resource not in game.state.resources_enabled:
raise ResourceNotAvailable(resource)


duration, quantity = game.mine(resource)
game.save()

Expand Down Expand Up @@ -179,6 +182,7 @@ def inventory(game):
echo(str(item))
# echo("${}$ ({:.0%})", item.name, item.condition / item.durability)


@cli.command(options_metavar='')
@click.pass_obj
def automata(game):
Expand All @@ -190,6 +194,7 @@ def automata(game):
echo(str(item))
# echo("${}$ ({:.0%})", item.name, item.condition / item.durability)


@cli.command(options_metavar='')
@click.argument("projects", nargs=-1, type=str, metavar="<project>")
@click.pass_obj
Expand Down
2 changes: 1 addition & 1 deletion src/shellcraft/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __bool__(self):
@property
def is_empty(self):
"""True if the proxy does not contain any items."""
return not self._filtered_items
return not list(self._filtered_items)

def __repr__(self):
"""String representation of item proxy."""
Expand Down
2 changes: 1 addition & 1 deletion src/shellcraft/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Exceptions."""

from __future__ import absolute_import, division, print_function, unicode_literals

import datetime
from shellcraft.grammar import VERBS


Expand Down

0 comments on commit c540ea6

Please sign in to comment.