Skip to content

Commit

Permalink
PayPal as donate method
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Oct 16, 2017
1 parent 708cfcf commit 842c4ba
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This project is free and open sourced, you can use it, spread the word, contribu

:Ether: 0x566d41b925ed1d9f643748d652f4e66593cba9c9
:Bitcoin: 1Jtj2m65DN2UsUzxXhr355x38T6pPGhqiA
:PayPal: barrenerobot@gmail.com

Requirements
------------
Expand Down
1 change: 1 addition & 0 deletions doc/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ This project is free and open sourced, you can use it, spread the word, contribu

:Ether: 0x566d41b925ed1d9f643748d652f4e66593cba9c9
:Bitcoin: 1Jtj2m65DN2UsUzxXhr355x38T6pPGhqiA
:PayPal: barrenerobot@gmail.com
24 changes: 24 additions & 0 deletions make
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ except ImportError:

logger = logging.getLogger('cli')

DONATE_TEXT = '''
This project is free and open sourced, you can use it, spread the word, contribute to the codebase and help us donating:
* Ether: 0x566d41b925ed1d9f643748d652f4e66593cba9c9
* Bitcoin: 1Jtj2m65DN2UsUzxXhr355x38T6pPGhqiA
* PayPal: barrenerobot@gmail.com
'''

SERVICES = {
'api': {
'url': 'https://github.com/PeRDy/barrenero-api',
Expand Down Expand Up @@ -64,6 +71,18 @@ def superuser(func):

return wrapper


def donate(func):
@wraps(func)
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)

logger.info(DONATE_TEXT)

return result
return wrapper


def default_input(input_str, default=None):
input_str = input_str + ' [{}]: '.format(default)
return input(input_str) or default
Expand Down Expand Up @@ -146,6 +165,7 @@ def build_service(service, path):
args=((('service',), {'help': 'Services to update', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
(('--path',), {'help': 'Barrenero full path', 'default': '/usr/local/lib'}),),
parser_opts={'help': 'Update Barrenero services'})
@donate
@superuser
def update(*args, **kwargs):
for service in kwargs['service']:
Expand All @@ -156,6 +176,7 @@ def update(*args, **kwargs):
args=((('service',), {'help': 'Services to install', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
(('--path',), {'help': 'Barrenero full path', 'default': '/usr/local/lib'}),),
parser_opts={'help': 'Install Barrenero services'})
@donate
@superuser
def install(*args, **kwargs):
barrenero_path = os.path.abspath(os.path.join(kwargs['path'], 'barrenero'))
Expand Down Expand Up @@ -185,6 +206,7 @@ def install(*args, **kwargs):
args=((('service',), {'help': 'Services to install', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
(('--path',), {'help': 'Barrenero full path', 'default': '/usr/local/lib'}),),
parser_opts={'help': 'Restart Barrenero services'})
@donate
@superuser
def restart(*args, **kwargs):
for service in kwargs['service']:
Expand All @@ -195,13 +217,15 @@ def restart(*args, **kwargs):
args=((('service',), {'help': 'Services to build', 'nargs': '+', 'choices': tuple(SERVICES.keys())}),
(('--path',), {'help': 'Barrenero full path', 'default': '/usr/local/lib'}),),
parser_opts={'help': 'Build Barrenero services'})
@donate
@superuser
def build(*args, **kwargs):
for service in kwargs['service']:
build_service(service, kwargs['path'])


@command(command_type=CommandType.PYTHON, parser_opts={'help': 'Clean installer'})
@donate
def clean(*args, **kwargs):
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-miner')), ignore_errors=True)
shutil.rmtree(os.path.abspath(os.path.join(os.getcwd(), 'barrenero-api')), ignore_errors=True)
Expand Down

0 comments on commit 842c4ba

Please sign in to comment.