#!/bin/sh # Creates an HTML table listing core modules and associated resource pages. # # This script should be run either from an empty directory or from one which # contains the checked-out git repositories for the desired Drupal versions. # # After completion, a file called "core_modules.html" should be created. # # In addition to a bourne-compatible shell, the following standard Unix # utility programs are required: # - curl, wget, lynx, or similar command-line url fetch tool. # - sed # - git # - echo # - find # - tee # - sort # - rm # - grep # # Arguments: # - A list of Drupal versions to check out. Defaults to "6.x 7.x 8.x". # # Configurable options: FETCH="curl -s" #FETCH="wget -q -O -" #FETCH="lynx -source" SED=sed GIT=git DRUPAL=git://drupalcode.org/project/drupal.git #DRUPAL=http://drupalcode.org/project/drupal.git #DRUPAL=https://drupalcode.org/project/drupal.git ECHO=echo OUTPUT=core_modules.html FIND=find TEE=tee SORT=sort RM=rm GREP=grep HEAD="curl -sI -A 'Mozilla/4.0'" #HEAD="wget -q -S -O /dev/null -U 'Mozilla/4.0'" #HEAD="lynx -source -head -useragent=Mozilla/4.0" # # No user-serviceable parts beyond this point. # $FETCH http://drupal.org/project/issues/drupal | $SED -e '/]*name="component"/ { s/]\+>]*value="//i;s/"[^>]*>[^<]*<\/option>]*value="/\n/gi;s/".*$//;s/ /+/g; p }; d' > components.list if [ "$#" -gt "0" ] then VERSIONS="$*" else VERSIONS="6.x 7.x 8.x" fi for version in $VERSIONS do if [ -d "${version}" ] then cd "${version}" && $GIT pull -q & else $GIT clone -qb "${version}" $DRUPAL "${version}" fi done $ECHO '' > $OUTPUT for module in $( $FIND *.x/modules -name "*.info" | $TEE modules.list | $SED -e 's|^.*/\([^/.]\+\)\.info$|\1|' | $SORT -u ) do $RM -f "${module}.api" "${module}.issues" info=$( $GREP -m 1 "/${module}\.info\$" modules.list ) module_name=$( $SED -e '/^name\b/I { s/^name[[:space:]]*=[[:space:]]*\(["]*\)\(.*\)\1/\2/i;p }; d;' "${info}" ) module_desc=$( $SED -e '/^description\b/I { s/^description[[:space:]]*=[[:space:]]*\(["]*\)\(.*\)\1/\2/i;p }; d;' "${info}" ) $ECHO -n "' >> $OUTPUT done $ECHO '
ModuleDocAPIIssues
${module}" >> $OUTPUT if $HEAD "http://drupal.org/documentation/modules/${module}" | $GREP -q 'HTTP/1.1 200 OK' then $ECHO -n "Doc" >> $OUTPUT fi $ECHO -n '' >> $OUTPUT for info in $( $GREP "/${module}.info" modules.list ) do module_ver=$( $ECHO "${info}" | $SED -e 's|^\([^/]\+\)/.*|\1|' ) api_url=$( $ECHO "${info}" | $SED -e 's/\.info$/.module/;s|/|--|g;s|^\([^.]\+\)\.x--\(.*\)$|http://api.drupal.org/api/drupal/\2/\1|' ) if [ -f "${module}.api" ] then $ECHO -n '/' >> "${module}.api" fi $ECHO -n "${module_ver}" >> "${module}.api" component=$( $GREP "^${module}\.module\$" components.list ) if [ -z "${component}" ] then component=$( $GREP "^${module}+system\$" components.list ) fi if [ -n "{$component}" ] then component_url="http://drupal.org/project/issues/drupal?component=${component}&version=${module_ver}" if [ -f "${module}.issues" ] then $ECHO -n '/' >> "${module}.issues" fi $ECHO -n "${module_ver}" >> "${module}.issues" fi done cat "${module}.api" >> $OUTPUT 2>/dev/null $ECHO -n '' >> $OUTPUT cat "${module}.issues" >> $OUTPUT 2>/dev/null $ECHO '
' >> $OUTPUT