123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php namespace Laravel\CLI\Tasks\Bundle;
- use Laravel\File;
- use Laravel\Bundle;
- use FilesystemIterator;
- class Publisher {
- /**
- * Publish a bundle's assets to the public directory.
- *
- * @param string $bundle
- * @return void
- */
- public function publish($bundle)
- {
- $path = Bundle::path($bundle);
- $this->move($path.'public', PUBLIC_PATH.'bundles'.DS.$bundle);
- $this->move($path.'tests', TESTS_PATH.'cases'.DS.'bundles'.DS.$bundle);
- echo "Assets and tests published for bundle [$bundle].".PHP_EOL;
- }
- /**
- * Copy the contents of a bundle's assets to the public folder.
- *
- * @param string $source
- * @param string $destination
- * @return void
- */
- protected function move($source, $destination)
- {
- File::copy_dir($source, $destination);
- }
- /**
- * Get the "to" location of the bundle's assets.
- *
- * @param string $bundle
- * @return string
- */
- protected function to($bundle)
- {
- return PUBLIC_PATH.'bundles'.DS.$bundle.DS;
- }
- /**
- * Get the "from" location of the bundle's assets.
- *
- * @param string $bundle
- * @return string
- */
- protected function from($bundle)
- {
- return Bundle::path($bundle).'public';
- }
- }
|