Skip to content

Commit

Permalink
Merge pull request #34 from mattjegan/pre-release/1.1.0
Browse files Browse the repository at this point in the history
update version, requirements, docs, fix chaining in load_default
  • Loading branch information
Matthew Egan committed Oct 13, 2017
2 parents c15fbcd + b498d05 commit b5495c2
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 10 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: python
python:
- 3.5
- 3.6
install:
- pip install -r requirements.txt
- pip install -r tests/requirements.txt
Expand Down
5 changes: 5 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ashishkg0022
mattjegan
taml
the-c0der

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This is the full documentation of [RanCat](https://github.com/mattjegan/rancat),

RanCat is a string generator that can use multiple text sources, including files and native Python lists and tuples. What constitutes a word in a word list is simply an atomic entity in the source, e.g. a line in a file, or a value in a list. RanCat will generate pseudo-random strings that are suitable for use as :

* CVS Branch Names
* VCS Branch Names
* Database Names
* Project/Repository Names
* Online Avatar Names
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# RanCat 1.1.0
* Implements `Rancat().load_default()` which will use lorem ipsum as default text.
* Urls can now be passed to `.load`. E.g. `Rancat().load('https://myurl.com')`

# RanCat 1.0.0
* Added better user documentation
* Allows custom phrase structure via `RanCat().load_structure(*args)` where args are either filepaths (str) or iterables of strings (tuples, lists)
Expand Down
12 changes: 12 additions & 0 deletions docs/RanCat.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,28 @@ r = RanCat(read_size=5)
[Semi-lazily loads](https://thedevmatt.wordpress.com/2016/08/12/semi-lazy-loading-in-rancat/) a data source into RanCat. The data source may be any:

* Filepath (string)
* Url (string)
* List
* Tuple

```python
r = RanCat()
r.load('path/to/file.txt')
r.load('http://www.sample-videos.com/text/Sample-text-file-10kb.txt')
r.load(['cat', 'dog'])
r.load(('cat', 'dog'))
```

### RanCat.load_default()
*returns RanCat*

Similar to `Rancat.load` but does not take an argument, simply loads some lorem ipsum text.

```python
r = RanCat()
r.load_default()
```

### RanCat.next()
*returns string*

Expand Down
6 changes: 4 additions & 2 deletions rancat/RanCat.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"""

from collections import OrderedDict
import random
import os
import random
from time import time

from .conversions import default_conversion
from .Handler import Handler
Expand All @@ -26,7 +27,6 @@ class RanCat(object):
def __init__(self, seed=None, unique=False, read_size=1000):
self.files = OrderedDict()

from time import time
self.seed = time() if not seed else seed
random.seed(self.seed)

Expand Down Expand Up @@ -168,3 +168,5 @@ def load_default(self):
Loads the lorem ipsum text from assets/lorem_ipsum.txt
"""
self.load(self._assets_path + "lorem_ipsum.txt")

return self
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-e .
requests==2.11.0
70 changes: 63 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,66 @@
from distutils.core import setup
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# This setup.py is based off https://github.com/kennethreitz/setup.py

import os
import sys
from shutil import rmtree

from setuptools import find_packages, setup, Command

# Package meta-data.
NAME = 'RanCat'
DESCRIPTION = 'A random string generator'
URL = 'https://github.com/mattjegan/rancat'
AUTHOR = 'Matthew Egan'

REQUIRED = []

here = os.path.abspath(os.path.dirname(__file__))


class PublishCommand(Command):
"""Support setup.py publish."""

description = 'Build and publish the package.'
user_options = []

@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except FileNotFoundError:
pass

self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))

self.status('Uploading the package to PyPi via Twine…')
os.system('twine upload --repository-url https://upload.pypi.org/legacy/ dist/*')

sys.exit()

setup(
name='RanCat',
version='1.0.0',
description='A random string generator',
author='Matthew Egan',
url='https://github.com/mattjegan/rancat',
packages=['rancat']
name=NAME,
version='1.1.0',
description=DESCRIPTION,
author=AUTHOR,
url=URL,
packages=['rancat'],
include_package_data=True,
cmdclass={
'publish': PublishCommand,
},
)

0 comments on commit b5495c2

Please sign in to comment.