Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
/python-vuejsPublic archive

Commitef3a0cd

Browse files
authored
Merge pull request#30 from cstrap/develop
Fixing context when calling djangofy
2 parents7634726 +af1a6a3 commitef3a0cd

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

‎python_vuejs/django.py‎

Lines changed: 4 additions & 2 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-
defdjstartvueapp(project):
93+
@click.pass_context
94+
defdjstartvueapp(ctx,project):
9495
"""
9596
Run click commands on bash.
9697
"""
9798
click.echo(click.style('Creating {project}'.format(project=project),fg='green'))
9899
ifos.path.isfile('manage.py')andVueJsBuilder.startproject(project).status:
99-
djangofy()
100+
ctx.forward(djangofy)
101+
ctx.invoke(djangofy,project=project)
100102
else:
101103
click.echo(click.style('Invalid django project directory',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
defproject_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
definstall_dependencies(project):
5051
withcd(project):
52+
click.echo(click.style('running `npm install`',fg='yellow'))
5153
run('npm install'.split())
5254

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

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

6165

‎tests/test_django_cli.py‎

Lines changed: 2 additions & 4 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-
deftest_djstartvueapp_django_ok(self,mock_djangofy):
122+
deftest_djstartvueapp_django_ok(self):
124123
withself.runner.isolated_filesystem():
125124
# Given
126125
open('manage.py','a').close()
@@ -132,8 +131,7 @@ 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
deftest_djstartvueapp_django_ko(self):
139137
result=self.runner.invoke(cli.cli, ['djstartvueapp','myapp'])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp