This repository was archived by the owner on Feb 26, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -90,12 +90,14 @@ def djangofy(project):
90
90
91
91
@cli .command ()
92
92
@click .argument ('project' )
93
- def djstartvueapp (project ):
93
+ @click .pass_context
94
+ def djstartvueapp (ctx , project ):
94
95
"""
95
96
Run click commands on bash.
96
97
"""
97
98
click .echo (click .style ('Creating {project}' .format (project = project ), fg = 'green' ))
98
99
if os .path .isfile ('manage.py' ) and VueJsBuilder .startproject (project ).status :
99
- djangofy ()
100
+ ctx .forward (djangofy )
101
+ ctx .invoke (djangofy , project = project )
100
102
else :
101
103
click .echo (click .style ('Invalid django project directory' , fg = 'red' ))
Original file line number Diff line number Diff line change @@ -43,19 +43,23 @@ def install_cli():
43
43
44
44
@staticmethod
45
45
def project_setup (project ):
46
+ click .echo (click .style ('running `vue init webpack {project}`' .format (project = project ), fg = 'yellow' ))
46
47
run ('vue init webpack {project}' .format (project = project ).split ())
47
48
48
49
@staticmethod
49
50
def install_dependencies (project ):
50
51
with cd (project ):
52
+ click .echo (click .style ('running `npm install`' , fg = 'yellow' ))
51
53
run ('npm install' .split ())
52
54
53
55
@staticmethod
54
56
def dev ():
57
+ click .echo (click .style ('running `npm run dev`' , fg = 'yellow' ))
55
58
run ('npm run dev' .split ())
56
59
57
60
@staticmethod
58
61
def build ():
62
+ click .echo (click .style ('running `npm run build`' , fg = 'yellow' ))
59
63
run ('npm run build' .split ())
60
64
61
65
Original file line number Diff line number Diff line change @@ -119,8 +119,7 @@ def test_djangofy_already_executed(self):
119
119
# Then
120
120
self .assertEqual ('Making Vue.js myapp into django app\n Command already executed\n ' , result .output )
121
121
122
- @patch ('python_vuejs.django.djangofy' )
123
- def test_djstartvueapp_django_ok (self , mock_djangofy ):
122
+ def test_djstartvueapp_django_ok (self ):
124
123
with self .runner .isolated_filesystem ():
125
124
# Given
126
125
open ('manage.py' , 'a' ).close ()
@@ -132,8 +131,7 @@ def test_djstartvueapp_django_ok(self, mock_djangofy):
132
131
result = self .runner .invoke (cli .cli , ['djstartvueapp' , 'myapp' ])
133
132
# Then
134
133
mock_vuejsbuilder .assert_called_once ()
135
- mock_djangofy .assert_called_once ()
136
- self .assertEqual ('Creating myapp\n ' , result .output )
134
+ self .assertEqual ('Creating myapp\n Making Vue.js myapp into django app\n ' , result .output )
137
135
138
136
def test_djstartvueapp_django_ko (self ):
139
137
result = self .runner .invoke (cli .cli , ['djstartvueapp' , 'myapp' ])
You can’t perform that action at this time.
0 commit comments