diff -u project_verify_package/project_verify_package.module project_verify_package/project_verify_package.module --- project_verify_package/project_verify_package.module 2010-01-18 18:34:37 +0000 +++ project_verify_package/project_verify_package.module 19 Jan 2010 08:15:17 -0000 @@ -10,31 +10,19 @@ * require some custom hacking to work in any other environment. */ -// -------------------- -// BEGIN CONFIGURATION. -// -------------------- - -// The name of the .make file to convert to or verify. -define('PROJECT_VERIFY_PACKAGE_MAKE_FILE', 'drupal-org.make'); +// ------------------- +// BEGIN CONFIGURATION +// ------------------- // The term ID that a release node must have in order to require verification. define('PROJECT_VERIFY_PACKAGE_PROJECT_TYPE_TID', 96); -// ------------------ -// END CONFIGURATION. -// ------------------ +// NOTE: Other configuration settings need to be defined at the top of the +// project_verify_package.pages.inc file. -/** - * Implement hook_help(). - */ -function project_verify_package_help($path, $arg) { - switch ($path) { - case 'node/%/verify-make-file': - return t("This form allows you to verify that your %makefile file is in the correct format. Paste the contents of the file below and click 'Verify'. To learn more about building a compatible .make file, visit How to package a profile.", array('%makefile' => PROJECT_VERIFY_PACKAGE_MAKE_FILE, '!doc_link' => DOCUMENTATION_LINK)); - case 'node/%/convert-make-file': - return t("This form allows you to convert an existing .make file into the %makefile file format. Disallowed .make file attributes will be automatically removed, and the most up to date official releases of all projects will be output in the result. Paste the contents of the file below and click 'Convert'. To learn more about building a compatible .make file, visit How to package a profile.", array('%makefile' => PROJECT_VERIFY_PACKAGE_MAKE_FILE, '!doc_link' => DOCUMENTATION_LINK)); - } -} +// ----------------- +// END CONFIGURATION +// ----------------- /** * Implement hook_form_alter(). @@ -58,7 +46,7 @@ // 'Verify .make files' link on profile project pages. $items['node/%project_node/verify-make-file'] = array( - 'title' => 'Verify ' . PROJECT_VERIFY_PACKAGE_MAKE_FILE . ' files', + 'title' => 'Verify drupal-org.make files', 'page callback' => 'drupal_get_form', 'page arguments' => array('project_verify_package_convert_verify_make_file_form', 1, 'verify'), 'access callback' => 'node_access', @@ -69,7 +57,7 @@ // 'Convert .make files' link on profile project pages. $items['node/%project_node/convert-make-file'] = array( - 'title' => 'Convert .make files to ' . PROJECT_VERIFY_PACKAGE_MAKE_FILE . ' format', + 'title' => 'Convert .make files to drupal-org.make format', 'page callback' => 'drupal_get_form', 'page arguments' => array('project_verify_package_convert_verify_make_file_form', 1, 'convert'), 'access callback' => 'node_access', diff -u project_verify_package/project_verify_package.pages.inc project_verify_package/project_verify_package.pages.inc --- project_verify_package/project_verify_package.pages.inc 2010-01-18 18:57:38 +0000 +++ project_verify_package/project_verify_package.pages.inc 19 Jan 2010 08:24:09 -0000 @@ -7,9 +7,9 @@ * packaging system. */ -// -------------------- -// BEGIN CONFIGURATION. -// -------------------- +// ------------------- +// BEGIN CONFIGURATION +// ------------------- // The full path of the drush executable. define('PROJECT_VERIFY_PACKAGE_DRUSH_BIN', ''); @@ -33,9 +33,13 @@ // URI of the 'How to package a profile' handbook page. define('DOCUMENTATION_LINK', 'http://drupal.org/node/642116'); -// ------------------ -// END CONFIGURATION. -// ------------------ +// The name of the .make file to convert to or verify. +define('PROJECT_VERIFY_PACKAGE_MAKE_FILE', 'drupal-org.make'); + +// ----------------- +// END CONFIGURATION +// ----------------- + /** * Builds a form used to submit .make files to be converted/verified. @@ -49,12 +53,16 @@ $button_text = t('Verify'); $output_title = t('Verification messages'); $makefile_title = t('Paste the contents of the .make file to be verified'); + $help_text = t("This form allows you to verify that your %makefile file is in the correct format. Paste the contents of the file below and click 'Verify'. To learn more about building a compatible .make file, visit How to package a profile.", array('%makefile' => PROJECT_VERIFY_PACKAGE_MAKE_FILE, '!doc_link' => DOCUMENTATION_LINK)); break; + case 'convert': $button_text = t('Convert'); $output_title = t('Conversion messages'); $makefile_title = t('Paste the contents of the .make file to be converted'); + $help_text = t("This form allows you to convert an existing .make file into the %makefile file format. Disallowed .make file attributes will be automatically removed, and the most up to date official releases of all projects will be output in the result. Paste the contents of the file below and click 'Convert'. To learn more about building a compatible .make file, visit How to package a profile.", array('%makefile' => PROJECT_VERIFY_PACKAGE_MAKE_FILE, '!doc_link' => DOCUMENTATION_LINK)); break; + } $form = array(); @@ -63,6 +71,10 @@ '#type' => 'value', '#value' => $operation, ); + $form['help'] = array( + '#type' => 'markup', + '#value' => $help_text, + ); // The form is being redisplayed after running a drush command. if (isset($form_state['storage']['return'])) { // Special case for successful conversions -- put them in a textarea to aid @@ -163,7 +175,7 @@ /** * Runs a drush command via pipes, so that nothing touches the I/O subsystem. * - * @param $ommand + * @param $command * The drush command to send. * @param $input * The input to pipe to the drush command. @@ -174,9 +186,9 @@ function project_verify_package_run_drush_via_pipe($command, $input) { $descriptorspec = array( - 0 => array("pipe", "r"), // STDIN is a pipe that the child will read from. - 1 => array("pipe", "w"), // STDOUT is a pipe that the child will write to. - 2 => array("pipe", "w"), // STDERR is a pipe that the child will write to. + 0 => array("pipe", "r"), // STDIN + 1 => array("pipe", "w"), // STDOUT + 2 => array("pipe", "w"), // STDERR ); // drush expects a terminal, so give it one. @@ -189,7 +201,6 @@ // 0 => writeable handle connected to child STDIN. // 1 => readable handle connected to child STDOUT. // 2 => readable handle connected to child STDERR. - fwrite($pipes[0], $input); fclose($pipes[0]); @@ -206,10 +217,9 @@ else { $output = ''; $errors = t('Unable to open drush process.'); - $return = 1; + $return_value = 1; } - return array($output, $errors, $return_value); }