Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into pyup-update-wheel-0.29.0-to-0.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cstrap committed Oct 3, 2017
2 parents 2e15425 + 37a1e8d commit 0b5680e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
8 changes: 5 additions & 3 deletions python_vuejs/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ def djangofy(project):

@cli.command()
@click.argument('project')
def djstartvueapp(project):
@click.pass_context
def djstartvueapp(ctx, project):
"""
Run click commands on bash.
"""
click.echo(click.style('Creating {project}'.format(project=project), fg='green'))
if os.path.isfile('manage.py') and VueJsBuilder.startproject(project).status:
djangofy()
ctx.forward(djangofy)
ctx.invoke(djangofy, project=project)
else:
click.echo(click.style('Invalid django project directory', fg='red'))
click.echo(click.style('Invalid django project directory. `manage.py` not found.', fg='red'))
4 changes: 4 additions & 0 deletions python_vuejs/vuejs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,23 @@ def install_cli():

@staticmethod
def project_setup(project):
click.echo(click.style('running `vue init webpack {project}`'.format(project=project), fg='yellow'))
run('vue init webpack {project}'.format(project=project).split())

@staticmethod
def install_dependencies(project):
with cd(project):
click.echo(click.style('running `npm install`', fg='yellow'))
run('npm install'.split())

@staticmethod
def dev():
click.echo(click.style('running `npm run dev`', fg='yellow'))
run('npm run dev'.split())

@staticmethod
def build():
click.echo(click.style('running `npm run build`', fg='yellow'))
run('npm run build'.split())


Expand Down
7 changes: 3 additions & 4 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
pip==9.0.1
punch.py==1.4.0
wheel==0.30.0
punch.py==1.4.1
watchdog==0.8.3
flake8==3.4.1
tox==2.7.0
tox==2.9.1
coverage==4.4.1
Sphinx==1.6.3
Sphinx==1.6.4
isort==4.2.15
8 changes: 3 additions & 5 deletions tests/test_django_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ def test_djangofy_already_executed(self):
# Then
self.assertEqual('Making Vue.js myapp into django app\nCommand already executed\n', result.output)

@patch('python_vuejs.django.djangofy')
def test_djstartvueapp_django_ok(self, mock_djangofy):
def test_djstartvueapp_django_ok(self):
with self.runner.isolated_filesystem():
# Given
open('manage.py', 'a').close()
Expand All @@ -132,9 +131,8 @@ def test_djstartvueapp_django_ok(self, mock_djangofy):
result = self.runner.invoke(cli.cli, ['djstartvueapp', 'myapp'])
# Then
mock_vuejsbuilder.assert_called_once()
mock_djangofy.assert_called_once()
self.assertEqual('Creating myapp\n', result.output)
self.assertEqual('Creating myapp\nMaking Vue.js myapp into django app\n', result.output)

def test_djstartvueapp_django_ko(self):
result = self.runner.invoke(cli.cli, ['djstartvueapp', 'myapp'])
self.assertEqual('Creating myapp\nInvalid django project directory\n', result.output)
self.assertEqual('Creating myapp\nInvalid django project directory. `manage.py` not found.\n', result.output)

0 comments on commit 0b5680e

Please sign in to comment.