Efficiently\Larasset\Commands\CleanAssetsCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed
    public function fire()
    {
        parent::fire();
        $environment = "production";
        $gemFilePath = $this->normalizePath($this->option('gemfile-path'));
        $packagePath = $this->packagePath();
        if ($this->useWindows()) {
            putenv('BUNDLE_GEMFILE=' . $gemFilePath);
            $bundleGemfile = 'setx BUNDLE_GEMFILE "' . $gemFilePath . '" > nul';
        } else {
            $bundleGemfile = 'BUNDLE_GEMFILE "' . $gemFilePath . '"';
        }
        $this->envs = array_add($this->envs, 'BUNDLE_GEMFILE', $gemFilePath);
        $assetsCleanCommand = $bundleGemfile . " && " . $this->getRakeCommand() . " assets:clean RAILS_ENV=" . $environment;
        // Clean assets
        system("cd " . $packagePath . " && " . $assetsCleanCommand);
        $destination = $this->normalizePath(public_path('assets'));
        // Delete old assets
        if (File::isDirectory($destination)) {
            $this->deleteTree($destination);
        }
        $this->copyAssets();
    }