diff --git a/bin/gpm b/bin/gpm index b2790279e..fa5910192 100755 --- a/bin/gpm +++ b/bin/gpm @@ -7,6 +7,7 @@ if (!file_exists(__DIR__ . '/../vendor')){ } use Grav\Common\Composer; +use Grav\Common\Config\Setup; if (!file_exists(__DIR__ . '/../vendor')){ // Before we can even start, we need to run composer first @@ -37,9 +38,24 @@ if (!function_exists('curl_version')) { exit('FATAL: GPM requires PHP Curl module to be installed'); } +$climate = new League\CLImate\CLImate; +$climate->arguments->add([ + 'environment' => [ + 'prefix' => 'e', + 'longPrefix' => 'env', + 'description' => 'Configuration Environment', + 'defaultValue' => 'localhost' + ] +]); +$climate->arguments->parse(); +$environment = $climate->arguments->get('environment'); + +// Set up environment based on params. +Setup::$environment = $environment; + $grav = Grav::instance(array('loader' => $autoload)); -$grav['config']->init(); $grav['uri']->init(); +$grav['config']->init(); $grav['streams']; $app = new Application('Grav Package Manager', GRAV_VERSION); diff --git a/bin/plugin b/bin/plugin index 03737ff4f..c740f818c 100755 --- a/bin/plugin +++ b/bin/plugin @@ -38,15 +38,29 @@ if (!file_exists(ROOT_DIR . 'index.php')) { exit('FATAL: Must be run from ROOT directory of Grav!'); } -// Set up environment. -Setup::$environment = 'localhost'; +$climate = new League\CLImate\CLImate; +$climate->arguments->add([ + 'environment' => [ + 'prefix' => 'e', + 'longPrefix' => 'env', + 'description' => 'Configuration Environment', + 'defaultValue' => 'localhost' + ] +]); +$climate->arguments->parse(); +$environment = $climate->arguments->get('environment'); + +// Set up environment based on params. +Setup::$environment = $environment; $grav = Grav::instance(array('loader' => $autoload)); +$grav['uri']->init(); $grav['config']->init(); $grav['streams']; $grav['plugins']->init(); $grav['themes']->init(); + $app = new Application('Grav Plugins Commands', GRAV_VERSION); $pattern = '([A-Z]\w+Command\.php)';