@@ -59,6 +59,7 @@ class NewCommand extends Command
5959 public $ baseInstallSuccessful ;
6060 public $ shouldUpdateCliToVersion = false ;
6161 public $ makeUser = false ;
62+ public $ pro = true ;
6263
6364 /**
6465 * Configure the command options.
@@ -77,6 +78,7 @@ protected function configure()
7778 ->addOption ('local ' , null , InputOption::VALUE_NONE , 'Optionally install from local repo configured in composer config.json ' )
7879 ->addOption ('with-config ' , null , InputOption::VALUE_NONE , 'Optionally copy starter-kit.yaml config for local development ' )
7980 ->addOption ('without-dependencies ' , null , InputOption::VALUE_NONE , 'Optionally install starter kit without dependencies ' )
81+ ->addOption ('pro ' , null , InputOption::VALUE_NONE , 'Enable Statamic Pro for additional features ' )
8082 ->addOption ('addon ' , 'p ' , InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY , 'Install first-party addons? ' , [])
8183 ->addOption ('force ' , 'f ' , InputOption::VALUE_NONE , 'Force install even if the directory already exists ' );
8284 }
@@ -122,11 +124,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
122124 ->validateArguments ()
123125 ->askForRepo ()
124126 ->validateStarterKitLicense ()
127+ ->askToEnableStatamicPro ()
125128 ->askToInstallAddons ()
126129 ->askToMakeSuperUser ()
127130 ->askToSpreadJoy ()
128131 ->installBaseProject ()
129132 ->installStarterKit ()
133+ ->enableStatamicPro ()
130134 ->makeSuperUser ()
131135 ->installAddons ()
132136 ->notifyIfOldCliVersion ()
@@ -250,7 +254,7 @@ protected function processArguments()
250254 $ this ->local = $ this ->input ->getOption ('local ' );
251255 $ this ->withConfig = $ this ->input ->getOption ('with-config ' );
252256 $ this ->withoutDependencies = $ this ->input ->getOption ('without-dependencies ' );
253-
257+ $ this -> pro = $ this -> input -> getOption ( ' pro ' ) ?? true ;
254258 $ this ->addons = $ this ->input ->getOption ('addon ' );
255259 $ this ->force = $ this ->input ->getOption ('force ' );
256260
@@ -731,6 +735,42 @@ protected function validatePassword($password)
731735 return false ;
732736 }
733737
738+ protected function askToEnableStatamicPro ()
739+ {
740+ if ($ this ->input ->getOption ('pro ' ) !== false || ! $ this ->input ->isInteractive ()) {
741+ return $ this ;
742+ }
743+
744+ $ this ->pro = confirm (
745+ label: 'Do you want to enable Statamic Pro? ' ,
746+ default: true ,
747+ hint: "Statamic Pro is required for some features. Like Multi-site, the Git integration, and more. "
748+ );
749+
750+ if ($ this ->pro ) {
751+ $ this ->output ->write (" Before your site goes live, you will need to purchase a license on <info>statamic.com</info>. " .PHP_EOL .PHP_EOL );
752+ }
753+
754+ return $ this ;
755+ }
756+
757+ protected function enableStatamicPro ()
758+ {
759+ if (! $ this ->pro ) {
760+ return $ this ;
761+ }
762+
763+ $ statusCode = (new Please ($ this ->output ))
764+ ->cwd ($ this ->absolutePath )
765+ ->run ('pro:enable ' );
766+
767+ if ($ statusCode !== 0 ) {
768+ throw new RuntimeException ('There was a problem enabling Statamic Pro! ' );
769+ }
770+
771+ return $ this ;
772+ }
773+
734774 /**
735775 * Show success message.
736776 *
0 commit comments