public function update($name, $version, $migrate = true, $seed = true, $publish = true, $force = false)
    {
        // Check if hook exists
        if (!$this->downloaded($name)) {
            throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
        }

        // Check if installed
        if (!$this->installed($name)) {
            throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
        }

        event(new Events\UpdatingHook($this->hooks[$name]));

        if (is_null($version)) {
            if (static::$useVersionWildcardOnUpdate) {
                $version = static::$versionWildcard;
            }

            // Prepare a repository if the hook is located locally
            if ($this->local($name)) {
                $version = static::$localVersion;
            }
        }

        if (!$force) {
            $this->makeTemponaryBackup($this->hooks[$name]);
        }

        // Require hook
        if (is_null($version)) {
            $this->composerRequire([$name]); // TODO: Save Composer output somewhere
        } else {
            $this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
        }

        // TODO: Handle the case when Composer outputs:
        // Your requirements could not be resolved to an installable set of packages.
        //
        //      Problem 1
        //        - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
        //          but these are rejected by your constraint.

        // TODO: Move to Composer Plugin
        $this->readJsonFile();
        $this->remakeJson();

        if ($migrate) {
            $this->migrateHook($this->hooks[$name]);
        }

        if ($seed) {
            $this->seedHook($this->hooks[$name]);
        }

        if ($publish) {
            $this->publishHook($this->hooks[$name], $force);
        }

        $this->clearTemponaryFiles();

        event(new Events\UpdatedHook($this->hooks[$name]));

        return true;
    }
public function update($name, $version, $migrate = true, $seed = true, $publish = true, $force = false)
    {
        // Check if hook exists
        if (!$this->downloaded($name)) {
            throw new Exceptions\HookNotFoundException("Hook [{$name}] not found.");
        }

        // Check if installed
        if (!$this->installed($name)) {
            throw new Exceptions\HookNotInstalledException("Hook [{$name}] not installed.");
        }

        event(new Events\UpdatingHook($this->hooks[$name]));

        if (is_null($version)) {
            if (static::$useVersionWildcardOnUpdate) {
                $version = static::$versionWildcard;
            }

            // Prepare a repository if the hook is located locally
            if ($this->local($name)) {
                $version = static::$localVersion;
            }
        }

        if (!$force) {
            $this->makeTemponaryBackup($this->hooks[$name]);
        }

        // Require hook
        if (is_null($version)) {
            $this->composerRequire([$name]); // TODO: Save Composer output somewhere
        } else {
            $this->composerRequire([$name.':'.$version]); // TODO: Save Composer output somewhere
        }

        // TODO: Handle the case when Composer outputs:
        // Your requirements could not be resolved to an installable set of packages.
        //
        //      Problem 1
        //        - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master]
        //          but these are rejected by your constraint.

        // TODO: Move to Composer Plugin
        $this->readJsonFile();
        $this->remakeJson();

        if ($migrate) {
            $this->migrateHook($this->hooks[$name]);
        }

        if ($seed) {
            $this->seedHook($this->hooks[$name]);
        }

        if ($publish) {
            $this->publishHook($this->hooks[$name], $force);
        }

        $this->clearTemponaryFiles();

        event(new Events\UpdatedHook($this->hooks[$name]));

        return true;
    }
public function update ( $ name , $ version , $ migrate = true , $ seed = true , $ publish = true , $ force = false ) { // Check if hook exists if ( ! $ this -> downloaded ( $ name ) ) { throw new Exceptions \ HookNotFoundException ( "Hook [{$name}] not found." ) ; } // Check if installed if ( ! $ this -> installed ( $ name ) ) { throw new Exceptions \ HookNotInstalledException ( "Hook [{$name}] not installed." ) ; } event ( new Events \ UpdatingHook ( $ this -> hooks [ $ name ] ) ) ; if ( is_null ( $ version ) ) { if ( static :: $ useVersionWildcardOnUpdate ) { $ version = static :: $ versionWildcard ; } // Prepare a repository if the hook is located locally if ( $ this -> local ( $ name ) ) { $ version = static :: $ localVersion ; } } if ( ! $ force ) { $ this -> makeTemponaryBackup ( $ this -> hooks [ $ name ] ) ; } // Require hook if ( is_null ( $ version ) ) { $ this -> composerRequire ( [ $ name ] ) ; // TODO: Save Composer output somewhere } else { $ this -> composerRequire ( [ $ name . ':' . $ version ] ) ; // TODO: Save Composer output somewhere } // TODO: Handle the case when Composer outputs: // Your requirements could not be resolved to an installable set of packages. // //      Problem 1 //        - The requested package composer-github-hook v0.0.1 exists as composer-github-hook[dev-master] //          but these are rejected by your constraint. // TODO: Move to Composer Plugin $ this -> readJsonFile ( ) ; $ this -> remakeJson ( ) ; if ( $ migrate ) { $ this -> migrateHook ( $ this -> hooks [ $ name ] ) ; } if ( $ seed ) { $ this -> seedHook ( $ this -> hooks [ $ name ] ) ; } if ( $ publish ) { $ this -> publishHook ( $ this -> hooks [ $ name ] , $ force ) ; } $ this -> clearTemponaryFiles ( ) ; event ( new Events \ UpdatedHook ( $ this -> hooks [ $ name ] ) ) ; return true ; }
Update hook.

@param $name
@param string|null $version
@param bool        $migrate
@param bool        $seed
@param bool        $publish
@param bool        $force

@throws \Larapack\Hooks\Exceptions\HookNotFoundException
@throws \Larapack\Hooks\Exceptions\HookNotInstalledException

@return bool
Update hook .