03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Deployment 107<br />

43 " . $pattern . "<br />

44 .<br />

45 "));<br />

46 }<br />

47 }<br />

48<br />

49 protected function getArguments()<br />

50 {<br />

51 return [];<br />

52 }<br />

53<br />

54 protected function getOptions()<br />

55 {<br />

56 return [<br />

57 [<br />

58 "target",<br />

59 null,<br />

60 InputOption::VALUE_OPTIONAL,<br />

61 "Distribution path.",<br />

62 null<br />

63 ]<br />

64 ];<br />

65 }<br />

66 }<br />

.<br />

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

The CleanCommand class gets all files matching the patterns in app/config/clean.php and deletes<br />

them. It handles folders as well.<br />

.<br />

Be very careful when deleting files. It’s always advisable to make a full backup before you test<br />

these kinds of scripts. I nearly nuked all the tutorial code because I didn’t make a backup!<br />

Synchronising Files To A Remote Server<br />

We’ve set up SSH access and we have code ready for deployment. Before we sync, we should set up<br />

a config file for target remote servers:

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

Saved successfully!

Ooh no, something went wrong!