From 9cba3b2819e7de661da690ccc63c2e576dacf972 Mon Sep 17 00:00:00 2001 From: Luke Martin Date: Sun, 22 Mar 2015 16:09:27 -0500 Subject: [PATCH 1/4] initiate drush valkyrie upgrade --- valkyrie.drush.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/valkyrie.drush.inc b/valkyrie.drush.inc index 2096e03..2de7d3c 100644 --- a/valkyrie.drush.inc +++ b/valkyrie.drush.inc @@ -121,7 +121,14 @@ function valkyrie_drush_command() { 'aliases' => array('vup'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap at all. ); - + $items['valkyrie-upgrade'] = array( + 'description' => 'Upgrade global Valkyrie extension and all of the submodules.', + 'options' => array( + 'reload' => 'Reload and run provisioners after updating code. Default to TRUE.', + ), + 'aliases' => array('vug'), + 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap at all. + ); $items['valkyrie-platform-add'] = array( 'description' => 'Register an existing platform with Valkyrie', 'arguments' => array( @@ -346,6 +353,9 @@ function drush_valkyrie_update() { } } } +function drush_valkyrie_upgrade() { + drush_log(dt('Valkyrie extension updates here.'), 'ok'); +} /** * Command callback for the 'valkyrie-snapshot' command. From a953e9bd4e1a5e9534592a6754224d483015d74e Mon Sep 17 00:00:00 2001 From: Luke Martin Date: Sun, 22 Mar 2015 22:58:21 -0500 Subject: [PATCH 2/4] add git commands --- valkyrie.drush.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/valkyrie.drush.inc b/valkyrie.drush.inc index 2de7d3c..0ff2b6c 100644 --- a/valkyrie.drush.inc +++ b/valkyrie.drush.inc @@ -354,7 +354,14 @@ function drush_valkyrie_update() { } } function drush_valkyrie_upgrade() { - drush_log(dt('Valkyrie extension updates here.'), 'ok'); + $initial_path = getcwd(); + $src = dirname(__FILE__); + + drush_print('Updating Valkyrie...'); + drush_shell_proc_open('git pull https://github.com/RealLukeMartin/valkyrie.git'); + drush_print('Updating submodules...'); + drush_shell_proc_open('git submodule update --init --recursive'); + drush_log(dt('Valkyrie has succesfully updated'), 'ok'); } /** From c256fa61d10a6d14582597612dee1b56735939c3 Mon Sep 17 00:00:00 2001 From: Luke Martin Date: Sun, 22 Mar 2015 23:14:11 -0500 Subject: [PATCH 3/4] check for correct global valkyrie path before running --- valkyrie.drush.inc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/valkyrie.drush.inc b/valkyrie.drush.inc index 0ff2b6c..82a13ec 100644 --- a/valkyrie.drush.inc +++ b/valkyrie.drush.inc @@ -354,14 +354,17 @@ function drush_valkyrie_update() { } } function drush_valkyrie_upgrade() { - $initial_path = getcwd(); + $current_path = getcwd(); $src = dirname(__FILE__); - - drush_print('Updating Valkyrie...'); - drush_shell_proc_open('git pull https://github.com/RealLukeMartin/valkyrie.git'); - drush_print('Updating submodules...'); - drush_shell_proc_open('git submodule update --init --recursive'); - drush_log(dt('Valkyrie has succesfully updated'), 'ok'); + if($src != $current_path) { + drush_print('You need to be in (~/.drush/valkyrie) to do this'); + } + else { + drush_print('Checking updates for Valkyrie...'); + drush_shell_proc_open('git pull https://github.com/RealLukeMartin/valkyrie.git'); + drush_print('Checking updates for submodules...'); + drush_shell_proc_open('git submodule update --init --recursive'); + } } /** From 1d8c76d3758c6d178f05779131e2d259458088c2 Mon Sep 17 00:00:00 2001 From: Luke Martin Date: Sun, 22 Mar 2015 23:28:17 -0500 Subject: [PATCH 4/4] refactor and clean up --- valkyrie.drush.inc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/valkyrie.drush.inc b/valkyrie.drush.inc index 82a13ec..a4e6415 100644 --- a/valkyrie.drush.inc +++ b/valkyrie.drush.inc @@ -123,9 +123,6 @@ function valkyrie_drush_command() { ); $items['valkyrie-upgrade'] = array( 'description' => 'Upgrade global Valkyrie extension and all of the submodules.', - 'options' => array( - 'reload' => 'Reload and run provisioners after updating code. Default to TRUE.', - ), 'aliases' => array('vug'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, // No bootstrap at all. ); @@ -360,10 +357,11 @@ function drush_valkyrie_upgrade() { drush_print('You need to be in (~/.drush/valkyrie) to do this'); } else { - drush_print('Checking updates for Valkyrie...'); - drush_shell_proc_open('git pull https://github.com/RealLukeMartin/valkyrie.git'); - drush_print('Checking updates for submodules...'); + drush_print('Checking for updates...'); + drush_shell_proc_open('git pull'); + drush_print('Checking submodule updates...'); drush_shell_proc_open('git submodule update --init --recursive'); + drush_log('Upgrade Finished', 'ok'); } }