Completed
Push — feature/composer-home-checking ( fae764 )
by Steven
03:52
created
src/Magestead/Command/Cache/EnableCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
     protected $_config;
16 16
     protected $_projectPath;
17 17
 
18
-    protected function configure()
19
-    {
18
+    protected function configure() {
20 19
         $this->_projectPath = getcwd();
21 20
         $this->setName("cache:disable");
22 21
         $this->setDescription("Disable cache types");
@@ -28,8 +27,7 @@  discard block
 block discarded – undo
28 27
      * @param OutputInterface $output
29 28
      * @return ProcessCommand
30 29
      */
31
-    protected function execute(InputInterface $input, OutputInterface $output)
32
-    {
30
+    protected function execute(InputInterface $input, OutputInterface $output) {
33 31
         $output->writeln('<info>Disabling all cache types</info>');
34 32
 
35 33
         $cacheType = $input->getArgument('type');
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      * @param Config $config
43 41
      * @return bool|string
44 42
      */
45
-    protected function getCommand(Config $config, $cacheType)
46
-    {
43
+    protected function getCommand(Config $config, $cacheType) {
47 44
         $type = $config->type;
48 45
         switch ($type) {
49 46
             case 'magento':
Please login to merge, or discard this patch.
src/Magestead/Command/Cache/CleanCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
     protected $_config;
16 16
     protected $_projectPath;
17 17
 
18
-    protected function configure()
19
-    {
18
+    protected function configure() {
20 19
         $this->_projectPath = getcwd();
21 20
         $this->setName("cache:disable");
22 21
         $this->setDescription("Disable cache types");
@@ -28,8 +27,7 @@  discard block
 block discarded – undo
28 27
      * @param OutputInterface $output
29 28
      * @return ProcessCommand
30 29
      */
31
-    protected function execute(InputInterface $input, OutputInterface $output)
32
-    {
30
+    protected function execute(InputInterface $input, OutputInterface $output) {
33 31
         $output->writeln('<info>Disabling all cache types</info>');
34 32
 
35 33
         $cacheType = $input->getArgument('type');
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      * @param Config $config
43 41
      * @return bool|string
44 42
      */
45
-    protected function getCommand(Config $config, $cacheType)
46
-    {
43
+    protected function getCommand(Config $config, $cacheType) {
47 44
         $type = $config->type;
48 45
         switch ($type) {
49 46
             case 'magento':
Please login to merge, or discard this patch.
src/Magestead/Command/Cache/FlushCommand.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@  discard block
 block discarded – undo
15 15
     protected $_config;
16 16
     protected $_projectPath;
17 17
 
18
-    protected function configure()
19
-    {
18
+    protected function configure() {
20 19
         $this->_projectPath = getcwd();
21 20
         $this->setName("cache:disable");
22 21
         $this->setDescription("Disable cache types");
@@ -28,8 +27,7 @@  discard block
 block discarded – undo
28 27
      * @param OutputInterface $output
29 28
      * @return ProcessCommand
30 29
      */
31
-    protected function execute(InputInterface $input, OutputInterface $output)
32
-    {
30
+    protected function execute(InputInterface $input, OutputInterface $output) {
33 31
         $output->writeln('<info>Disabling all cache types</info>');
34 32
 
35 33
         $cacheType = $input->getArgument('type');
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      * @param Config $config
43 41
      * @return bool|string
44 42
      */
45
-    protected function getCommand(Config $config, $cacheType)
46
-    {
43
+    protected function getCommand(Config $config, $cacheType) {
47 44
         $type = $config->type;
48 45
         switch ($type) {
49 46
             case 'magento':
Please login to merge, or discard this patch.
src/Magestead/Command/UpdateCommand.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
     /**
17 17
      * Configure the command and description
18 18
      */
19
-    public function configure()
20
-    {
19
+    public function configure() {
21 20
         $this->projectPath = getcwd();
22 21
 
23 22
         $this->setName("self-update");
@@ -31,8 +30,7 @@  discard block
 block discarded – undo
31 30
      * @param OutputInterface $output
32 31
      * @return ProcessCommand
33 32
      */
34
-    protected function execute(InputInterface $input, OutputInterface $output)
35
-    {
33
+    protected function execute(InputInterface $input, OutputInterface $output) {
36 34
         $output->writeln('<info>Checking for Updates</info>');
37 35
         return new ProcessCommand('composer global update richdynamix/magestead', $this->projectPath, $output);
38 36
     }
Please login to merge, or discard this patch.
src/Magestead/Helper/Options.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
      * @param OutputInterface $output
38 38
      * @param $project
39 39
      */
40
-    public function __construct($helper, InputInterface $input, OutputInterface $output, $project)
41
-    {
40
+    public function __construct($helper, InputInterface $input, OutputInterface $output, $project) {
42 41
         $this->setVagrantSettings($helper, $input, $output);
43 42
 
44 43
         $this->setServerConfig($helper, $input, $output);
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
     /**
54 53
      * @return array
55 54
      */
56
-    public function getAllOptions()
57
-    {
55
+    public function getAllOptions() {
58 56
         return [
59 57
           'app' => $this->_app,
60 58
           'server' => $this->_server,
@@ -79,8 +77,7 @@  discard block
 block discarded – undo
79 77
      * @param InputInterface $input
80 78
      * @param OutputInterface $output
81 79
      */
82
-    protected function setVagrantSettings($helper, InputInterface $input, OutputInterface $output)
83
-    {
80
+    protected function setVagrantSettings($helper, InputInterface $input, OutputInterface $output) {
84 81
         $output->writeln('<comment>Lets configure your project\'s VM</comment>');
85 82
 
86 83
         $ipQuestion       = new Question("Configure the IP for your VM (192.168.47.47): ", '192.168.47.47');
@@ -99,8 +96,7 @@  discard block
 block discarded – undo
99 96
      * @param OutputInterface $output
100 97
      * @param $project
101 98
      */
102
-    protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output, $project)
103
-    {
99
+    protected function setApplicationSettings($helper, InputInterface $input, OutputInterface $output, $project) {
104 100
         $output->writeln('<comment>Lets configure your project\'s application</comment>');
105 101
         $appQuestion = new ChoiceQuestion(
106 102
             "Which application do you want to install?",
@@ -126,8 +122,7 @@  discard block
 block discarded – undo
126 122
      * @param OutputInterface $output
127 123
      * @return boolean|integer
128 124
      */
129
-    protected function setMagento2Settings($helper, InputInterface $input, OutputInterface $output)
130
-    {
125
+    protected function setMagento2Settings($helper, InputInterface $input, OutputInterface $output) {
131 126
         if ($this->_app === 'magento2') {
132 127
             $this->installSampleData($helper, $input, $output);
133 128
             return $this->verifyAuth($helper, $input, $output);
@@ -141,8 +136,7 @@  discard block
 block discarded – undo
141 136
      * @param InputInterface $input
142 137
      * @param OutputInterface $output
143 138
      */
144
-    protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output)
145
-    {
139
+    protected function setVersionControlSettings($helper, InputInterface $input, OutputInterface $output) {
146 140
         $versionControl = new ConfirmationQuestion("Would you like to add your project to GIT? (no/yes) ", false);
147 141
         $versioning     = $helper->ask($input, $output, $versionControl);
148 142
         if ($versioning) {
@@ -151,8 +145,7 @@  discard block
 block discarded – undo
151 145
         }
152 146
     }
153 147
 
154
-    protected function installSampleData($helper, InputInterface $input, OutputInterface $output)
155
-    {
148
+    protected function installSampleData($helper, InputInterface $input, OutputInterface $output) {
156 149
         $sampleInstall = new ConfirmationQuestion("Would you like to install sample data? (no/yes) ", false);
157 150
         $this->installSampleData = $helper->ask($input, $output, $sampleInstall);
158 151
     }
@@ -162,8 +155,7 @@  discard block
 block discarded – undo
162 155
      * @param InputInterface $input
163 156
      * @param OutputInterface $output
164 157
      */
165
-    protected function askForAuth($helper, InputInterface $input, OutputInterface $output)
166
-    {
158
+    protected function askForAuth($helper, InputInterface $input, OutputInterface $output) {
167 159
         $username          = new Question("Please enter your Magento username (public key): ", '');
168 160
         $this->_m2Username = $helper->ask($input, $output, $username);
169 161
 
@@ -177,8 +169,7 @@  discard block
 block discarded – undo
177 169
      * @param OutputInterface $output
178 170
      * @return boolean|integer
179 171
      */
180
-    protected function verifyAuth($helper, InputInterface $input, OutputInterface $output)
181
-    {
172
+    protected function verifyAuth($helper, InputInterface $input, OutputInterface $output) {
182 173
         $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
183 174
 
184 175
         $authObj = [];
@@ -205,8 +196,7 @@  discard block
 block discarded – undo
205 196
      * @param InputInterface $input
206 197
      * @param OutputInterface $output
207 198
      */
208
-    protected function setPhp($helper, InputInterface $input, OutputInterface $output)
209
-    {
199
+    protected function setPhp($helper, InputInterface $input, OutputInterface $output) {
210 200
         $phpVerQuestion = new ChoiceQuestion(
211 201
             "Which version of PHP should be installed?",
212 202
             ['56', '70'],
@@ -219,8 +209,7 @@  discard block
 block discarded – undo
219 209
     /**
220 210
      * Set box name from concat user options
221 211
      */
222
-    protected function setVagrantBox()
223
-    {
212
+    protected function setVagrantBox() {
224 213
         $this->_box = self::BOX_PREFIX . $this->_os . "-$this->_server-php$this->_phpVer";
225 214
     }
226 215
 
@@ -229,8 +218,7 @@  discard block
 block discarded – undo
229 218
      * @param InputInterface $input
230 219
      * @param OutputInterface $output
231 220
      */
232
-    protected function setServerConfig($helper, InputInterface $input, OutputInterface $output)
233
-    {
221
+    protected function setServerConfig($helper, InputInterface $input, OutputInterface $output) {
234 222
         $output->writeln('<comment>Lets configure your server</comment>');
235 223
         $this->setOperatingSystem($helper, $input, $output);
236 224
         $this->setWebServer($helper, $input, $output);
@@ -242,8 +230,7 @@  discard block
 block discarded – undo
242 230
      * @param InputInterface $input
243 231
      * @param OutputInterface $output
244 232
      */
245
-    protected function setWebServer($helper, InputInterface $input, OutputInterface $output)
246
-    {
233
+    protected function setWebServer($helper, InputInterface $input, OutputInterface $output) {
247 234
         $serverQuestion = new ChoiceQuestion(
248 235
             "Which webserver would you like?",
249 236
             ['NGINX', 'Apache'],
@@ -258,8 +245,7 @@  discard block
 block discarded – undo
258 245
      * @param InputInterface $input
259 246
      * @param OutputInterface $output
260 247
      */
261
-    protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output)
262
-    {
248
+    protected function setOperatingSystem($helper, InputInterface $input, OutputInterface $output) {
263 249
         $osQuestion = new ChoiceQuestion(
264 250
             "Which OS would you like to install?",
265 251
             ['CentOS 6.5', 'Ubuntu 14'],
Please login to merge, or discard this patch.
src/Magestead/Installers/Magento2Project.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
      * @param $projectPath
21 21
      * @param OutputInterface $output
22 22
      */
23
-    public function __construct(array $options, array $config, $projectPath, OutputInterface $output)
24
-    {
23
+    public function __construct(array $options, array $config, $projectPath, OutputInterface $output) {
25 24
         $this->composerInstall($projectPath, $output);
26 25
         $this->installMagento($config, $options, $projectPath, $output);
27 26
         $this->finaliseSetup($options, $projectPath, $output);
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
      * @param $projectPath
35 34
      * @param OutputInterface $output
36 35
      */
37
-    protected function composerInstall($projectPath, OutputInterface $output)
38
-    {
36
+    protected function composerInstall($projectPath, OutputInterface $output) {
39 37
         $output->writeln('<info>Installing Magento 2 with Composer</info>');
40 38
         $command = 'composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition public';
41 39
         new ProcessCommand($command, $projectPath, $output);
@@ -50,8 +48,7 @@  discard block
 block discarded – undo
50 48
      * @param $destination
51 49
      * @return bool
52 50
      */
53
-    protected function copyAuthFile($destination)
54
-    {
51
+    protected function copyAuthFile($destination) {
55 52
         $authFile = $_SERVER['HOME'] . "/.composer/auth.json";
56 53
         return copy($authFile, $destination . '/public/auth.json');
57 54
     }
@@ -60,8 +57,7 @@  discard block
 block discarded – undo
60 57
      * @param $projectPath
61 58
      * @param OutputInterface $output
62 59
      */
63
-    protected function addPhpSpecPackage($projectPath, OutputInterface $output)
64
-    {
60
+    protected function addPhpSpecPackage($projectPath, OutputInterface $output) {
65 61
         $output->writeln('<comment>Installing PHPSpec</comment>');
66 62
         $command = 'cd '.$projectPath.'/public; composer require phpspec/phpspec --dev;';
67 63
         new ProcessCommand($command, $projectPath, $output);
@@ -73,8 +69,7 @@  discard block
 block discarded – undo
73 69
      * @param $projectPath
74 70
      * @param OutputInterface $output
75 71
      */
76
-    protected function addBehatPackage($projectPath, OutputInterface $output)
77
-    {
72
+    protected function addBehatPackage($projectPath, OutputInterface $output) {
78 73
         $output->writeln('<comment>Installing Behat</comment>');
79 74
         $command = 'cd '.$projectPath.'/public; composer require behat/behat --dev;';
80 75
         new ProcessCommand($command, $projectPath, $output);
@@ -88,8 +83,7 @@  discard block
 block discarded – undo
88 83
      * @param $projectPath
89 84
      * @param OutputInterface $output
90 85
      */
91
-    protected function installMagento(array $config, array $options, $projectPath, OutputInterface $output)
92
-    {
86
+    protected function installMagento(array $config, array $options, $projectPath, OutputInterface $output) {
93 87
         $this->setPermissions($projectPath, $output);
94 88
 
95 89
         $this->installSampleData($options, $projectPath, $output);
@@ -125,8 +119,7 @@  discard block
 block discarded – undo
125 119
      * @param $projectPath
126 120
      * @param OutputInterface $output
127 121
      */
128
-    protected function installSampleData($options, $projectPath, OutputInterface $output)
129
-    {
122
+    protected function installSampleData($options, $projectPath, OutputInterface $output) {
130 123
         if (true === $options['installSampleData']) {
131 124
             $output->writeln('<info>Installing Magento 2 Sample Data</info>');
132 125
             $deployCommand = 'vagrant ssh -c \'cd /var/www/public; bin/magento sampledata:deploy \'';
@@ -138,8 +131,7 @@  discard block
 block discarded – undo
138 131
      * @param $projectPath
139 132
      * @param OutputInterface $output
140 133
      */
141
-    protected function setPermissions($projectPath, OutputInterface $output)
142
-    {
134
+    protected function setPermissions($projectPath, OutputInterface $output) {
143 135
         $output->writeln('<info>Setting Permissions</info>');
144 136
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo find . -type d -exec chmod 700 {} \;\'';
145 137
         new ProcessCommand($command, $projectPath, $output);
@@ -158,8 +150,7 @@  discard block
 block discarded – undo
158 150
      * @param $projectPath
159 151
      * @param OutputInterface $output
160 152
      */
161
-    protected function configureRedis($projectPath, OutputInterface $output)
162
-    {
153
+    protected function configureRedis($projectPath, OutputInterface $output) {
163 154
         $output->writeln('<comment>Configuring Redis Cache</comment>');
164 155
         $file = "$projectPath/public/app/etc/env.php";
165 156
         $env  = include $file;
@@ -211,8 +202,7 @@  discard block
 block discarded – undo
211 202
      * @param $projectPath
212 203
      * @param OutputInterface $output
213 204
      */
214
-    protected function finaliseSetup(array $options, $projectPath, OutputInterface $output)
215
-    {
205
+    protected function finaliseSetup(array $options, $projectPath, OutputInterface $output) {
216 206
         $command = 'vagrant ssh -c \'cd /var/www/public; bin/magento indexer:reindex; \'';
217 207
         $output->writeln('<comment>Reindexing Tables</comment>');
218 208
         new ProcessCommand($command, $projectPath, $output);
@@ -229,8 +219,7 @@  discard block
 block discarded – undo
229 219
      * @param array $options
230 220
      * @param OutputInterface $output
231 221
      */
232
-    protected function showCredentials(array $options, OutputInterface $output)
233
-    {
222
+    protected function showCredentials(array $options, OutputInterface $output) {
234 223
         $output->writeln('<info>SUCCESS: Magestead has finished installing Magento 2!</info>');
235 224
         $table = new Table($output);
236 225
         $table
@@ -249,8 +238,7 @@  discard block
 block discarded – undo
249 238
      * @param OutputInterface $output
250 239
      * @return VersionControl|null
251 240
      */
252
-    protected function processVcs(array $options, $projectPath, OutputInterface $output)
253
-    {
241
+    protected function processVcs(array $options, $projectPath, OutputInterface $output) {
254 242
         if (!empty($options['repo_url'])) {
255 243
             copy($projectPath . "/puphpet/magestead/magento2/stubs/gitignore.tmp", $projectPath . "/.gitignore");
256 244
             return new VersionControl($options['repo_url'], $projectPath, $output);
@@ -260,8 +248,7 @@  discard block
 block discarded – undo
260 248
     /**
261 249
      * @param $projectPath
262 250
      */
263
-    protected function setComposerBinDir($projectPath)
264
-    {
251
+    protected function setComposerBinDir($projectPath) {
265 252
         $file     = "$projectPath/public/composer.json";
266 253
         $composer = json_decode(file_get_contents($file), true);
267 254
 
@@ -273,8 +260,7 @@  discard block
 block discarded – undo
273 260
      * @param $projectPath
274 261
      * @param OutputInterface $output
275 262
      */
276
-    protected function setPhpSpecPermissions($projectPath, OutputInterface $output)
277
-    {
263
+    protected function setPhpSpecPermissions($projectPath, OutputInterface $output) {
278 264
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/phpspec; bin/phpspec run\'';
279 265
         new ProcessCommand($command, $projectPath, $output);
280 266
     }
@@ -283,8 +269,7 @@  discard block
 block discarded – undo
283 269
      * @param $projectPath
284 270
      * @param OutputInterface $output
285 271
      */
286
-    protected function setBehatPermissions($projectPath, OutputInterface $output)
287
-    {
272
+    protected function setBehatPermissions($projectPath, OutputInterface $output) {
288 273
         $command = 'vagrant ssh -c \'cd /var/www/public; sudo chmod 755 bin/behat; bin/behat --init\'';
289 274
         new ProcessCommand($command, $projectPath, $output);
290 275
     }
Please login to merge, or discard this patch.
src/Magestead/Exceptions/MissingComposerHomeException.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,6 @@
 block discarded – undo
4 4
  * Class MissingComposerHomeException
5 5
  * @package Magestead\Exceptions
6 6
  */
7
-class MissingComposerHomeException extends \Exception {}
8 7
\ No newline at end of file
8
+class MissingComposerHomeException extends \Exception
9
+{
10
+}
9 11
\ No newline at end of file
Please login to merge, or discard this patch.
src/Magestead/Helper/Config.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
      * Config constructor.
22 22
      * @param OutputInterface $output
23 23
      */
24
-    public function __construct(OutputInterface $output)
25
-    {
24
+    public function __construct(OutputInterface $output) {
26 25
         $this->_projectPath = getcwd();
27 26
         $this->output = $output;
28 27
     }
@@ -31,8 +30,7 @@  discard block
 block discarded – undo
31 30
      * @param $name
32 31
      * @return mixed
33 32
      */
34
-    function __get($name)
35
-    {
33
+    function __get($name) {
36 34
         $this->_config = $this->getConfigFile($this->output);
37 35
         return $this->_config['magestead']['apps']['mba_12345'][$name];
38 36
     }
@@ -41,8 +39,7 @@  discard block
 block discarded – undo
41 39
      * @param OutputInterface $output
42 40
      * @return bool|mixed
43 41
      */
44
-    protected function getConfigFile(OutputInterface $output)
45
-    {
42
+    protected function getConfigFile(OutputInterface $output) {
46 43
         $config = new Parser();
47 44
         try {
48 45
             return $config->parse($this->readConfigFile());
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
      * @return string
58 55
      * @throws MissingConfigFileException
59 56
      */
60
-    protected function readConfigFile()
61
-    {
57
+    protected function readConfigFile() {
62 58
         if (!file_exists($this->_projectPath . '/magestead.yaml')) {
63 59
             throw new MissingConfigFileException('No config file was found, are you in the project root?');
64 60
         }
@@ -72,8 +68,7 @@  discard block
 block discarded – undo
72 68
      * @return string
73 69
      * @throws MissingComposerHomeException
74 70
      */
75
-    public function getComposerHomeDir()
76
-    {
71
+    public function getComposerHomeDir() {
77 72
         $composerConfig = shell_exec('composer config --list --global | grep home');
78 73
 
79 74
         if (is_null($composerConfig)) {
Please login to merge, or discard this patch.