03.12.2015 Views

laravel4cookbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Deployment 104<br />

14 {<br />

15 $target = $this->option("target");<br />

16<br />

17 if (!$target)<br />

18 {<br />

19 $target = "../distribution";<br />

20 }<br />

21<br />

22 File::copyDirectory("./", $target);<br />

23<br />

24 $this->line(trim("<br />

25 Successfully copied source files to<br />

26 " . realpath($target) . "<br />

27 .<br />

28 "));<br />

29 }<br />

30<br />

31 protected function getArguments()<br />

32 {<br />

33 return [];<br />

34 }<br />

35<br />

36 protected function getOptions()<br />

37 {<br />

38 return [<br />

39 [<br />

40 "target",<br />

41 null,<br />

42 InputOption::VALUE_OPTIONAL,<br />

43 "Distribution path.",<br />

44 null<br />

45 ]<br />

46 ];<br />

47 }<br />

48 }<br />

.<br />

This file should be saved as app/commands/CopyCommand.php.<br />

The copy command uses Laravel 4’s File methods to copy the source directly recursively. It initially<br />

targets ../distribute but this can be changed with the –target option.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!