-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEATURE: Do not install demo site and instead offer a choice #42
base: 5.2
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,96 @@ | ||||||
<?php | ||||||
namespace Neos\BaseDistribution\Composer; | ||||||
|
||||||
use Composer\Console\Application; | ||||||
use Composer\DependencyResolver\Operation\InstallOperation; | ||||||
use Composer\DependencyResolver\Operation\UpdateOperation; | ||||||
use Composer\Composer; | ||||||
use Composer\Factory; | ||||||
use Composer\Json\JsonFile; | ||||||
use Composer\Package\Version\VersionParser; | ||||||
use Composer\Repository\CompositeRepository; | ||||||
use Composer\Repository\PlatformRepository; | ||||||
use Composer\Script\Event; | ||||||
use Composer\Installer\PackageEvent; | ||||||
use Composer\Util\Silencer; | ||||||
use Symfony\Component\Console\Input\ArrayInput; | ||||||
use Symfony\Component\Console\Output\ConsoleOutput; | ||||||
use Symfony\Component\Yaml\Yaml; | ||||||
use Neos\Utility\Files; | ||||||
use Neos\Utility\Arrays; | ||||||
use Neos\Splash\DistributionBuilder\Service\PackageService; | ||||||
use Neos\Splash\DistributionBuilder\Service\JsonFileService; | ||||||
use Neos\Splash\DistributionBuilder\Domain\ValueObjects\PackageRequirement; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are those used at all? |
||||||
|
||||||
/** | ||||||
* | ||||||
*/ | ||||||
class InstallSitePackage | ||||||
{ | ||||||
const LOCAL_SRC_PATH = 'DistributionPackages'; | ||||||
kitsunet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
/** | ||||||
* Setup the neos distribution | ||||||
* | ||||||
* @param Event $event | ||||||
* @throws \Neos\Utility\Exception\FilesException | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
*/ | ||||||
public static function setupDistribution(Event $event) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
if (!defined('FLOW_PATH_ROOT')) { | ||||||
define('FLOW_PATH_ROOT', Files::getUnixStylePath(getcwd()) . '/'); | ||||||
} | ||||||
$composer = $event->getComposer(); | ||||||
$io = $event->getIO(); | ||||||
|
||||||
$distributionReadyMessagesBase = [ | ||||||
'', | ||||||
'Your Neos was prepared successfully.', | ||||||
'', | ||||||
'For local development you still have to:', | ||||||
'1. Add database credentials to Configuration/Development/Settings.yaml (or start the setup by calling the /setup url)', | ||||||
kitsunet marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
'2. Migrate database "./flow doctrine:migrate"', | ||||||
]; | ||||||
|
||||||
$io->write([ | ||||||
'', | ||||||
'Welcome to Neos', | ||||||
'' | ||||||
]); | ||||||
|
||||||
if (!$io->isInteractive()) { | ||||||
$io->write('Non-Interacctive installation, installing no additional package(s).'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
$io->write($distributionReadyMessagesBase); | ||||||
return; | ||||||
} | ||||||
|
||||||
$choices = [ | ||||||
'start with the Neos Demo content', | ||||||
'empty Neos' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a mini suggestion: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ..I guess it was an intentional decision to keep the current behavior the default, makes sense I guess! But it could be the default and not be the first option, too |
||||||
]; | ||||||
|
||||||
$packages = [ | ||||||
'neos/demo', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we make this a 1:n map we can easily add new distributions |
||||||
'' | ||||||
]; | ||||||
|
||||||
$selection = $io->select('How would you like your Neos configured?', $choices, 1); | ||||||
if ((int)$selection === 1) { | ||||||
$io->write('No package will be installed.'); | ||||||
$io->write($distributionReadyMessagesBase); | ||||||
$io->write('3. Create your site package "./flow site:create"'); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||
return; | ||||||
} | ||||||
|
||||||
$output = new ConsoleOutput(); | ||||||
$composerApplication = new Application(); | ||||||
$composerApplication->doRun(new ArrayInput([ | ||||||
'command' => 'require', | ||||||
'packages' => [$packages[(int)$selection]] | ||||||
]), $output); | ||||||
|
||||||
// success | ||||||
$io->write($distributionReadyMessagesBase); | ||||||
$io->write('3. Import site data "./flow site:import --package-key <Package.Name>" (where Package.Name could be Neos.Demo for example)'); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)