Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #76 from ipunkt/gvvs-update
Browse files Browse the repository at this point in the history
Rancherize with dev versions
  • Loading branch information
Sven Speckmaier authored Nov 27, 2017
2 parents 36a87e5 + 22a6622 commit 2179acd
Show file tree
Hide file tree
Showing 19 changed files with 208 additions and 219 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Dockerfile
.gitignore
.git
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ RUN curl -sSL "https://github.com/rancher/rancher-compose/releases/download/v$RA
&& mv rancher-compose-*/rancher-compose /usr/local/bin/ \
&& cp /usr/local/bin/rancher-compose /usr/local/bin/rancher-compose-$RANCHER_COMPOSE_VERSION

COPY [".", "/opt/rancherize"]
COPY ["docker", "/opt/rancherize"]
COPY [".", "/opt/rancherize-package"]
WORKDIR /opt/rancherize

# install composer packages
RUN curl -sSL "https://gist.githubusercontent.com/justb81/1006b89e41e41e1c848fe91969af7a0b/raw/c12faf968e659356ec1cb53f313e7f8383836be3/getcomposer.sh" | sh \
&& COMPOSER_ALLOW_SUPERUSER=1 ./composer.phar install --no-dev && rm composer.phar
&& COMPOSER_ALLOW_SUPERUSER=1 ./composer.phar install \
&& rm composer.phar

ENTRYPOINT ["/bin/sh", "/opt/rancherize/docker-entrypoint.sh"]
6 changes: 4 additions & 2 deletions app/Application/Rancherize.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

use Exception;
use Rancherize\Blueprint\Validation\Exceptions\ValidationFailedException;
use Rancherize\Plugin\Loader\ExtraPluginLoaderDecorator;
use Rancherize\Plugin\Loader\PluginLoader;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
Expand Down Expand Up @@ -81,7 +83,7 @@ public function boot() {
});

$internalPlugins = require_once __DIR__.'/../lists/plugins.php';
$pluginLoaderExtra = container('plugin-loader-extra');
$pluginLoaderExtra = container(ExtraPluginLoaderDecorator::class);
foreach($internalPlugins as $internalPlugin) {
/**
* @var \Rancherize\Plugin\Loader\ExtraPluginLoaderDecorator $pluginLoaderExtra
Expand All @@ -94,7 +96,7 @@ public function boot() {
/**
* @var \Rancherize\Plugin\Loader\PluginLoader $pluginLoader
*/
$pluginLoader = container('plugin-loader');
$pluginLoader = container(PluginLoader::class);
$pluginLoader->load( $this->application, container() );

} catch(Exception $e) {
Expand Down
81 changes: 0 additions & 81 deletions app/Blueprint/Commands/BlueprintAdd.php

This file was deleted.

4 changes: 0 additions & 4 deletions app/Blueprint/Commands/BlueprintList.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ protected function configure() {
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$projectConfig = $this->projectConfiguration;
$configuration = $this->configurable;
$configuration = $projectConfig->load($configuration);
container()->offsetSet('project-configuration', $configuration);

$blueprints = $this->blueprintFactory->available();

Expand Down
21 changes: 8 additions & 13 deletions app/Commands/CommandsProvider.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php namespace Rancherize\Commands;

use Rancherize\Blueprint\Commands\BlueprintAdd;
use Rancherize\Blueprint\Commands\BlueprintList;
use Rancherize\Blueprint\Factory\BlueprintFactory;
use Rancherize\Configuration\Services\EnvironmentConfigurationService;
use Rancherize\Configuration\Services\ProjectConfiguration;
use Rancherize\Docker\DockerAccessService;
use Rancherize\Plugin\Commands\PluginInstallCommand;
use Rancherize\Plugin\Commands\PluginRegisterCommand;
use Rancherize\Plugin\Installer\PluginInstaller;
use Rancherize\Plugin\Loader\PluginLoader;
use Rancherize\Plugin\Provider;
use Rancherize\Plugin\ProviderTrait;
use Rancherize\RancherAccess\InServiceChecker;
Expand Down Expand Up @@ -82,14 +84,8 @@ public function register() {
return $restartCommand;
};

$this->container['command.blueprint.add'] = function($c) {
$blueprintAddCommand = new BlueprintAdd( $c[BlueprintFactory::class] );

return $blueprintAddCommand;
};

$this->container['command.blueprint.list'] = function($c) {
$blueprintListCommand = new BlueprintList( $c[BlueprintFactory::class], $c['project-config-service'], $c['configuration'] );
$blueprintListCommand = new BlueprintList( $c[BlueprintFactory::class], $c[ProjectConfiguration::class], $c['configuration'] );

return $blueprintListCommand;
};
Expand All @@ -102,12 +98,12 @@ public function register() {
return new RancherAccessCommand();
};

$this->container['command.plugin.install'] = function() {
return new PluginInstallCommand();
$this->container['command.plugin.install'] = function($c) {
return new PluginInstallCommand( $c[PluginLoader::class], $c[PluginInstaller::class] );
};

$this->container['command.plugin.register'] = function() {
return new PluginRegisterCommand();
$this->container['command.plugin.register'] = function($c) {
return new PluginRegisterCommand( $c[PluginLoader::class], $c[PluginInstaller::class] );
};
}

Expand All @@ -126,7 +122,6 @@ public function boot() {
$app->add( $this->container['command.restart'] );
$app->add( $this->container['command.validate'] );
$app->add( $this->container['command.init'] );
$app->add( $this->container['command.blueprint.add'] );
$app->add( $this->container['command.blueprint.list'] );
$app->add( $this->container['command.environment.set'] );
$app->add( $this->container['command.rancher.access'] );
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/RancherAccessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
/**
* @var GlobalConfiguration $globalConfiguration
*/
$globalConfiguration = container('global-config-service');
$globalConfiguration = container(GlobalConfiguration::class);

$this->validateGlobalConfiguration( $globalConfiguration, $configuration);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ private function loadConfiguration() {
$this->configWrapper->loadGlobalConfig($config);
$this->configWrapper->loadProjectConfig($config);

/**
* @var EventDispatcher $eventSystem
*/
$eventSystem = container('event');
$event = new ConfigurationLoadedEvent();
$event->setConfiguration($config);
$eventSystem->dispatch($event::NAME, $event);
$this->eventDispatcher->dispatch($event::NAME, $event);

return $config;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Rancherize\EnvironmentAccessConfig;

use Rancherize\Configuration\Services\GlobalConfiguration;
use Rancherize\Docker\DockerAccessService;
use Rancherize\Plugin\Provider;
use Rancherize\Plugin\ProviderTrait;
Expand Down Expand Up @@ -34,7 +35,7 @@ function register()
return new RancherAccessEnvironmentService();
};

$this->container['global-config-service'] = function($c) {
$this->container[GlobalConfiguration::class] = function($c) {
return new \Rancherize\Configuration\Services\GlobalConfiguration(
new \Rancherize\Configuration\Loader\NullLoader(),
$c['writer']
Expand Down
33 changes: 24 additions & 9 deletions app/Plugin/Commands/PluginInstallCommand.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
<?php namespace Rancherize\Plugin\Commands;

use Rancherize\Plugin\Traits\UsesPluginInstaller;
use Rancherize\Plugin\Traits\UsesPluginLoader;
use Rancherize\Plugin\Installer\PluginInstaller;
use Rancherize\Plugin\Loader\PluginLoader;
use Symfony\Component\Console\Command\Command;

/**
* Class PluginInstallCommand
*/
class PluginInstallCommand extends Command {

use UsesPluginInstaller;
use UsesPluginLoader;
/**
* @var PluginInstaller
*/
private $pluginInstaller;
/**
* @var PluginLoader
*/
private $pluginLoader;

/**
* PluginInstallCommand constructor.
* @param PluginInstaller $pluginInstaller
* @param PluginLoader $pluginLoader
*/
public function __construct( PluginLoader $pluginLoader, PluginInstaller $pluginInstaller ) {
parent::__construct();
$this->pluginInstaller = $pluginInstaller;
$this->pluginLoader = $pluginLoader;
}

/**
*
Expand All @@ -30,12 +47,10 @@ protected function configure() {
protected function execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) {
$pluginName = $input->getArgument('plugin name');

$pluginInstaller = $this->getPluginInstaller();
$pluginInstaller->install($pluginName, $input, $output);
$classPath = $pluginInstaller->getClasspath($pluginName);
$this->pluginInstaller->install($pluginName, $input, $output);
$classPath = $this->pluginInstaller->getClasspath($pluginName);

$pluginLoader = $this->getPluginLoader();
$pluginLoader->register($pluginName, $classPath);
$this->pluginLoader->register($pluginName, $classPath);
}


Expand Down
30 changes: 22 additions & 8 deletions app/Plugin/Commands/PluginRegisterCommand.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
<?php namespace Rancherize\Plugin\Commands;

use Rancherize\Plugin\Traits\UsesPluginInstaller;
use Rancherize\Plugin\Traits\UsesPluginLoader;
use Rancherize\Plugin\Installer\PluginInstaller;
use Rancherize\Plugin\Loader\PluginLoader;
use Symfony\Component\Console\Command\Command;

/**
* Class PluginRegisterCommand
*/
class PluginRegisterCommand extends Command {
/**
* @var PluginLoader
*/
private $pluginLoader;
/**
* @var PluginInstaller
*/
private $pluginInstaller;

use UsesPluginInstaller;
use UsesPluginLoader;
/**
* PluginRegisterCommand constructor.
* @param PluginLoader $pluginLoader
* @param PluginInstaller $pluginInstaller
*/
public function __construct( PluginLoader $pluginLoader, PluginInstaller $pluginInstaller) {
$this->pluginLoader = $pluginLoader;
$this->pluginInstaller = $pluginInstaller;
parent::__construct();
}

/**
*
Expand All @@ -31,11 +47,9 @@ protected function configure() {
protected function execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) {
$pluginName = $input->getArgument('plugin name');

$pluginInstaller = $this->getPluginInstaller();
$pluginLoader = $this->getPluginLoader();

$classPath = $pluginInstaller->getClasspath($pluginName);
$pluginLoader->register($pluginName, $classPath);
$classPath = $this->pluginInstaller->getClasspath($pluginName);
$this->pluginLoader->register($pluginName, $classPath);


}
Expand Down
Loading

0 comments on commit 2179acd

Please sign in to comment.