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

Commit 75c3128

Browse files
committed
Merge
2 parents 01ce5ae + 22e631d commit 75c3128

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

python_vuejs/django.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ def djangofy(project):
9090

9191
@cli.command()
9292
@click.argument('project')
93-
def djstartvueapp(project):
93+
@click.pass_context
94+
def djstartvueapp(ctx, project):
9495
"""
9596
Run click commands on bash.
9697
"""
9798
click.echo(click.style('Creating {project}'.format(project=project), fg='green'))
9899
if os.path.isfile('manage.py') and VueJsBuilder.startproject(project).status:
99-
djangofy()
100+
ctx.forward(djangofy)
101+
ctx.invoke(djangofy, project=project)
100102
else:
101-
click.echo(click.style('Invalid django project directory', fg='red'))
103+
click.echo(click.style('Invalid django project directory. `manage.py` not found.', fg='red'))

python_vuejs/vuejs.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,23 @@ def install_cli():
4343

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

4849
@staticmethod
4950
def install_dependencies(project):
5051
with cd(project):
52+
click.echo(click.style('running `npm install`', fg='yellow'))
5153
run('npm install'.split())
5254

5355
@staticmethod
5456
def dev():
57+
click.echo(click.style('running `npm run dev`', fg='yellow'))
5558
run('npm run dev'.split())
5659

5760
@staticmethod
5861
def build():
62+
click.echo(click.style('running `npm run build`', fg='yellow'))
5963
run('npm run build'.split())
6064

6165

requirements_dev.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
pip==9.0.1
2-
punch.py==1.4.0
3-
wheel==0.29.0
2+
punch.py==1.4.1
43
watchdog==0.8.3
54
flake8==3.4.1
6-
tox==2.7.0
5+
tox==2.9.1
76
coverage==4.4.1
8-
Sphinx==1.6.3
7+
Sphinx==1.6.4
98
isort==4.2.15

tests/test_django_cli.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ def test_djangofy_already_executed(self):
119119
# Then
120120
self.assertEqual('Making Vue.js myapp into django app\nCommand already executed\n', result.output)
121121

122-
@patch('python_vuejs.django.djangofy')
123-
def test_djstartvueapp_django_ok(self, mock_djangofy):
122+
def test_djstartvueapp_django_ok(self):
124123
with self.runner.isolated_filesystem():
125124
# Given
126125
open('manage.py', 'a').close()
@@ -132,9 +131,8 @@ def test_djstartvueapp_django_ok(self, mock_djangofy):
132131
result = self.runner.invoke(cli.cli, ['djstartvueapp', 'myapp'])
133132
# Then
134133
mock_vuejsbuilder.assert_called_once()
135-
mock_djangofy.assert_called_once()
136-
self.assertEqual('Creating myapp\n', result.output)
134+
self.assertEqual('Creating myapp\nMaking Vue.js myapp into django app\n', result.output)
137135

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

0 commit comments

Comments
 (0)