Skip to content

Commit 9b089ec

Browse files
committed
Supported for linux based development
1 parent 39b2693 commit 9b089ec

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

src/Generators/FileGenerator.php

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ public function setClass($classname)
7070
*/
7171
public function setNamespace($namespace)
7272
{
73+
if (DIRECTORY_SEPARATOR == '/') {
74+
$namespace = str_replace('/', '\\', $namespace);
75+
}
76+
77+
// if (DIRECTORY_SEPARATOR == '\\') {
78+
// // windows
79+
// }
7380
$this->namespace = $namespace;
7481
return $this;
7582
}
@@ -98,9 +105,9 @@ public function setPath($path)
98105
public function MakeController($resource=false)
99106
{
100107
if($resource)
101-
$filename = __DIR__.'\..\stubs\module\Controllers\ModuleRController.stub';
108+
$filename = __DIR__.'/../stubs/module/Controllers/ModuleRController.stub';
102109
else
103-
$filename = __DIR__.'\..\stubs\module\Controllers\ModuleController.stub';
110+
$filename = __DIR__.'/../stubs/module/Controllers/ModuleController.stub';
104111

105112
$contents = File::get($filename);
106113
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Controllers');
@@ -118,7 +125,7 @@ public function MakeController($resource=false)
118125

119126
public function MakeModel()
120127
{
121-
$filename = __DIR__.'\..\stubs\module\Models\Model.stub';
128+
$filename = __DIR__.'/../stubs/module/Models/Model.stub';
122129

123130
$contents = File::get($filename);
124131
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Models');
@@ -139,14 +146,14 @@ public function MakeMigration($create=false,$table=false)
139146
{
140147
if($create){
141148
$this->tablename = $create;
142-
$filename = __DIR__.'\..\stubs\module\Database\Migration\createmigtration.stub';
149+
$filename = __DIR__.'/../stubs/module/Database/Migration/createmigtration.stub';
143150
}
144151
elseif ($table) {
145152
$this->tablename = $table;
146-
$filename = __DIR__.'\..\stubs\module\Database\Migration\tablemigration.stub';
153+
$filename = __DIR__.'/../stubs/module/Database/Migration/tablemigration.stub';
147154
}
148155
else
149-
$filename = __DIR__.'\..\stubs\module\Database\Migration\Migration.stub';
156+
$filename = __DIR__.'/../stubs/module/Database/Migration/Migration.stub';
150157

151158
$contents = File::get($filename);
152159
$this->temprory = $this->classname;
@@ -166,7 +173,7 @@ public function MakeMigration($create=false,$table=false)
166173
*/
167174
public function MakeCommand()
168175
{
169-
$filename = __DIR__.'\..\stubs\module\Console\Commands\command.stub';
176+
$filename = __DIR__.'/../stubs/module/Console/Commands/command.stub';
170177

171178
$contents = File::get($filename);
172179
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Console'.DIRECTORY_SEPARATOR.'Commands');
@@ -184,7 +191,7 @@ public function MakeCommand()
184191
*/
185192
public function MakeEvent()
186193
{
187-
$filename = __DIR__.'\..\stubs\module\Events\event.stub';
194+
$filename = __DIR__.'/../stubs/module/Events/event.stub';
188195

189196
$contents = File::get($filename);
190197
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Events');
@@ -202,7 +209,7 @@ public function MakeEvent()
202209
*/
203210
public function MakeJob()
204211
{
205-
$filename = __DIR__.'\..\stubs\module\Jobs\job.stub';
212+
$filename = __DIR__.'/../stubs/module/Jobs/job.stub';
206213

207214
$contents = File::get($filename);
208215
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Jobs');
@@ -220,7 +227,7 @@ public function MakeJob()
220227
*/
221228
public function MakeListener()
222229
{
223-
$filename = __DIR__.'\..\stubs\module\Listeners\listener.stub';
230+
$filename = __DIR__.'/../stubs/module/Listeners/listener.stub';
224231

225232
$contents = File::get($filename);
226233
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Listeners');
@@ -240,7 +247,7 @@ public function MakeListener()
240247
*/
241248
public function MakeMail($view='view.name',$markdown=false)
242249
{
243-
$filename = __DIR__.'\..\stubs\module\Mail\mail.stub';
250+
$filename = __DIR__.'/../stubs/module/Mail/mail.stub';
244251

245252
$contents = File::get($filename);
246253
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Mail');
@@ -264,7 +271,7 @@ public function MakeMail($view='view.name',$markdown=false)
264271
*/
265272
public function MakeNotification($markdown=false)
266273
{
267-
$filename = __DIR__.'\..\stubs\module\Notifications\notification.stub';
274+
$filename = __DIR__.'/../stubs/module/Notifications/notification.stub';
268275

269276
$contents = File::get($filename);
270277
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Notifications');
@@ -292,7 +299,7 @@ public function MakeNotification($markdown=false)
292299
*/
293300
public function MakeMiddleware()
294301
{
295-
$filename = __DIR__.'\..\stubs\module\Middleware\middleware.stub';
302+
$filename = __DIR__.'/../stubs/module/Middleware/middleware.stub';
296303

297304
$contents = File::get($filename);
298305
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Middleware');
@@ -310,7 +317,7 @@ public function MakeMiddleware()
310317
*/
311318
public function MakeProvider()
312319
{
313-
$filename = __DIR__.'\..\stubs\module\Providers\provider.stub';
320+
$filename = __DIR__.'/../stubs/module/Providers/provider.stub';
314321

315322
$contents = File::get($filename);
316323
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Providers');
@@ -329,7 +336,7 @@ public function MakeProvider()
329336
*/
330337
public function MakeSeeder()
331338
{
332-
$filename = __DIR__.'\..\stubs\module\Database\Seeds\seeder.stub';
339+
$filename = __DIR__.'/../stubs/module/Database/Seeds/seeder.stub';
333340

334341
$contents = File::get($filename);
335342
$this->setNamespace('cms'.DIRECTORY_SEPARATOR.Cms::getModulesPath().DIRECTORY_SEPARATOR.Cms::getCurrentTheme().DIRECTORY_SEPARATOR.$this->modulename.DIRECTORY_SEPARATOR.'Database'.DIRECTORY_SEPARATOR.'seeds');
@@ -347,7 +354,7 @@ public function MakeSeeder()
347354
*/
348355
public function makeModuleJson()
349356
{
350-
$filename = __DIR__.'\..\stubs\module\module.stub';
357+
$filename = __DIR__.'/../stubs/module/module.stub';
351358

352359
$contents = File::get($filename);
353360
$contents = $this->changeClass($contents);
@@ -363,7 +370,7 @@ public function makeModuleJson()
363370
*/
364371
public function makeModuleComposer()
365372
{
366-
$filename = __DIR__.'\..\stubs\module\composer.stub';
373+
$filename = __DIR__.'/../stubs/module/composer.stub';
367374

368375
$contents = File::get($filename);
369376
$contents = $this->changeClass($contents);
@@ -462,4 +469,4 @@ protected function dashesToCamelCase($string)
462469
return $str;
463470
}
464471

465-
}
472+
}

0 commit comments

Comments
 (0)