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):
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 :
101103 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():
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
Original file line number Diff line number Diff line change @@ -119,8 +119,7 @@ def test_djangofy_already_executed(self):
119119 # Then
120120 self .assertEqual ('Making Vue.js myapp into django app\n Command 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,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\n Making 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' ])
You can’t perform that action at this time.
0 commit comments