Skip to content

Commit

Permalink
Add starter code from cookiecutter
Browse files Browse the repository at this point in the history
  • Loading branch information
SaladRaider committed May 27, 2017
1 parent d234117 commit 35e92c9
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.pyc

dist/
build/
*.egg-info/

.tox/
.coverage

.DS_Store
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# gitautosync
# gitautosync

Synchronizes a github repository with a local repository. Automatically deals with conflicts and produces useful output to stdout.


# Installation

If you don't use `pipsi`, you're missing out.
Here are [installation instructions](https://github.com/mitsuhiko/pipsi#readme).

Simply run:

$ pipsi install .


# Usage

To use it:

$ gitautosync --help

Empty file added gitautosync/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions gitautosync/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import click


@click.command()
@click.option('--as-cowboy', '-c', is_flag=True, help='Greet as a cowboy.')
@click.argument('name', default='world', required=False)
def main(name, as_cowboy):
"""Synchronizes a github repository with a local repository. Automatically deals with conflicts and produces useful output to stdout."""
greet = 'Howdy' if as_cowboy else 'Hello'
click.echo('{0}, {1}.'.format(greet, name))
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[wheel]
universal = 1
48 changes: 48 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
Synchronizes a github repository with a local repository. Automatically deals with conflicts and produces useful output to stdout.
"""
from setuptools import find_packages, setup

dependencies = ['click']

setup(
name='gitautosync',
version='0.0.1',
url='https://github.com/SaladRaider/gitautosync',
license='BSD',
author='Peter Veerman',
author_email='[email protected]',
description='Synchronizes a github repository with a local repository. Automatically deals with conflicts and produces useful output to stdout.',
long_description=__doc__,
packages=find_packages(exclude=['tests']),
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=dependencies,
entry_points={
'console_scripts': [
'gitautosync = gitautosync.cli:main',
],
},
classifiers=[
# As from http://pypi.python.org/pypi?%3Aaction=list_classifiers
# 'Development Status :: 1 - Planning',
# 'Development Status :: 2 - Pre-Alpha',
# 'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
# 'Development Status :: 5 - Production/Stable',
# 'Development Status :: 6 - Mature',
# 'Development Status :: 7 - Inactive',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Operating System :: Unix',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

29 changes: 29 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest
from click.testing import CliRunner
from gitautosync import cli


@pytest.fixture
def runner():
return CliRunner()


def test_cli(runner):
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == 'Hello, world.'


def test_cli_with_option(runner):
result = runner.invoke(cli.main, ['--as-cowboy'])
assert not result.exception
assert result.exit_code == 0
assert result.output.strip() == 'Howdy, world.'


def test_cli_with_arg(runner):
result = runner.invoke(cli.main, ['Peter'])
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == 'Hello, Peter.'
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tox]
envlist=py26, py27, py33, py34, pypy, flake8

[testenv]
commands=py.test --cov gitautosync {posargs}
deps=
pytest
pytest-cov

[testenv:flake8]
basepython = python2.7
deps =
flake8
commands =
flake8 gitautosync tests --max-line-length=120

0 comments on commit 35e92c9

Please sign in to comment.