public function install($name, $version = null, $migrate = true, $seed = true, $publish = true)
    {
        // Check if already installed
        if ($this->installed($name)) {
            throw new Exceptions\HookAlreadyInstalledException("Hook [{$name}] is already installed.");
        }

        event(new Events\InstallingHook($name));

        // Prepare a repository if the hook is located locally
        if ($this->local($name)) {
            $this->prepareLocalInstallation($name);

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

        // 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([$name]);
        $this->remakeJson();

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

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

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

        event(new Events\InstalledHook($this->hooks[$name]));
    }
public function install($name, $version = null, $migrate = true, $seed = true, $publish = true)
    {
        // Check if already installed
        if ($this->installed($name)) {
            throw new Exceptions\HookAlreadyInstalledException("Hook [{$name}] is already installed.");
        }

        event(new Events\InstallingHook($name));

        // Prepare a repository if the hook is located locally
        if ($this->local($name)) {
            $this->prepareLocalInstallation($name);

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

        // 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([$name]);
        $this->remakeJson();

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

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

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

        event(new Events\InstalledHook($this->hooks[$name]));
    }
public function install ( $ name , $ version = null , $ migrate = true , $ seed = true , $ publish = true ) { // Check if already installed if ( $ this -> installed ( $ name ) ) { throw new Exceptions \ HookAlreadyInstalledException ( "Hook [{$name}] is already installed." ) ; } event ( new Events \ InstallingHook ( $ name ) ) ; // Prepare a repository if the hook is located locally if ( $ this -> local ( $ name ) ) { $ this -> prepareLocalInstallation ( $ name ) ; if ( is_null ( $ version ) ) { $ version = static :: $ localVersion ; } } // 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 ( [ $ name ] ) ; $ this -> remakeJson ( ) ; if ( $ migrate ) { $ this -> migrateHook ( $ this -> hooks [ $ name ] ) ; } if ( $ seed ) { $ this -> seedHook ( $ this -> hooks [ $ name ] ) ; } if ( $ publish ) { $ this -> publishHook ( $ this -> hooks [ $ name ] ) ; } event ( new Events \ InstalledHook ( $ this -> hooks [ $ name ] ) ) ; }
Install hook.

@param $name

@throws \Larapack\Hooks\Exceptions\HookAlreadyInstalledException
Install hook .