The files in this directory are for primary use by me, the maintainer
of Locale::Codes to prepare a new release.

There is no reason for an end user to need to do this. However, it
is documented for the sake of completeness, and to remind me of the
steps I need to do.

It's also available in case someone ever chooses to fork the
module (though I hope that won't be necessary).

#########################################################################
Get the newest codes. Be sure to read the entire diff to make sure that
no HTML is getting added to a code.

debug=0

codes () {
   t=$1

   if   [ "$t" = "country" ]; then
      tt=Country
      sets="alpha-2 alpha-3 numeric dom"
      opt='-c'
   elif [ "$t" = "language" ]; then
      tt=Language
      sets="alpha-2 alpha-3 term"
      opt='-l'
   elif [ "$t" = "currency" ]; then
      tt=Currency
      sets="alpha num"
      opt='-r'
   elif [ "$t" = "script" ]; then
      tt=Script
      sets="alpha num"
      opt='-s'
   elif [ "$t" = "langext" ]; then
      tt=LangExt
      sets="alpha"
      opt='-L'
   elif [ "$t" = "langvar" ]; then
      tt=LangVar
      sets="alpha"
      opt='-V'
   elif [ "$t" = "langfam" ]; then
      tt=LangFam
      sets="alpha"
      opt='-F'
   fi
   mod=Locale::Codes::$tt
   f="lib/Locale/Codes/${tt}_Codes.pm"

   echo "###########################################################"
   echo "$tt"
   echo "###########################################################"

   cat <<EOF > /tmp/z.pl
use ${mod};
for my \$set (qw(${sets})) {
  @c = all_${t}_codes(\$set);
  \$num = @c;
  print "\$set = \$num\\n";
}
EOF

   if [ -f "$f.bak" ]; then
      mv $f.bak $f
   fi

   PERL5LIB="./lib" perl /tmp/z.pl > /tmp/z.orig

   cp $f $f.bak

   if [ "$debug" = "1" ]; then
      deb=-d
   else
      deb=
   fi

   perl $deb ./internal/get_codes $opt
   diff $f.bak $f

   echo "##########################"
   echo "OLD"
   cat /tmp/z.orig
   echo "NEW"

   PERL5LIB="./lib" perl /tmp/z.pl
}

   codes country
   codes language
   codes currency
   codes script
   codes langext
   codes langvar
   codes langfam


   ./internal/get_codes -C
   rm lib/Locale/Codes/*.bak

#########################################################################
Update documentation

   sed -e 's,Locale::Codes::Country,Locale::Country,g' \
       lib/Locale/Codes/Country.pod > lib/Locale/Country.pod

   sed -e 's,Locale::Codes::Language,Locale::Language,g' \
       lib/Locale/Codes/Language.pod > lib/Locale/Language.pod

   sed -e 's,Locale::Codes::Currency,Locale::Currency,g' \
       lib/Locale/Codes/Currency.pod > lib/Locale/Currency.pod

   sed -e 's,Locale::Codes::Script,Locale::Script,g' \
       lib/Locale/Codes/Script.pod > lib/Locale/Script.pod

#########################################################################
Update the copyright

   y=`date '+%Y'`
   for i in `find . -type f | xargs egrep -l 'Copyright \(c\) ....\-.... Sullivan Beck'` ;do
     sed -e "s,\(Copyright (c) ....\)\-.... \(Sullivan Beck\),\1-$y \2," $i > z
     mv z $i
   done

#########################################################################
Set the release version

   v=`cat internal/VERSION`
   for i in \
       Makefile.PL \
       Build.PL \
       internal/get_codes \
       internal/deprecate_codes \
       `find lib -name \*.pm` \
   ;do
      sed -e "s,VERSION *=.*;,VERSION='$v';," $i > z
      mv z $i
   done
   chmod +x internal/get_codes internal/deprecate_codes

#########################################################################
Before every release, spellcheck the documents:

   for i in `find lib -type f -name \*.pod` ;do
      podspell $i > $i.txt
      ispell -p internal/ispell.isp $i.txt
      rm -f $i.txt $i.txt.bak
   done

#########################################################################
*** MAKE SURE TESTS PASS BEFORE DOING THIS ***

Update the deprecated codes modules.  Don't do this until certain that
the changes are good.

   ./internal/dump_curr
   ./internal/deprecate_codes

#########################################################################
Update the Change file with the date

#########################################################################
Regenerate the MANIFEST, Build.PL, Makefile.PL
Run the kwalitee tests

#########################################################################
To create a patch for perl:

   cd /tmp
   git clone git://perl5.git.perl.org/perl.git perl-git
   cd perl-git

   git branch sbeck
   git checkout sbeck

Update Porting/Maintainers.pl

Copy in the modified files.

   cd cpan/Locale-Codes
   dir=`find ~/perl-modules -type d -name Locale-Codes\*`

   for i in `find . -type f` ;do
      if [ ! -e $dir/$i ]; then
         echo "Remove: $i"
         git rm $i
      else
         cp -p ~/perl-modules/Locale-Codes-*/$i $i
      fi
   done

   for i in `cd $dir; find . -type f` ;do
      tmp=`echo $i | sed -e 's,\(examples\|internal\)/,,'`
      if [ "$tmp" != "$i" -o \
           "$tmp"  = "./README" -o \
           "$tmp"  = "./INSTALL" -o \
           "$tmp"  = "./Build.PL" -o \
           "$tmp"  = "./Makefile.PL" -o \
           "$tmp"  = "./MANIFEST" -o \
           "$tmp"  = "./META.yml" -o \
           "$tmp"  = "./META.json" -o \
           "$tmp"  = "./t/runtests.bat" -o \
           "$tmp"  = "./t/runtests" -o \
           "$tmp"  = "./t/pod.t" -o \
           "$tmp"  = "./t/pod_coverage.t" \
         ]; then
         continue
      fi

      if [ ! -e $i ]; then
         echo "Added: $i"
         cp -p ~/perl-modules/Locale-Codes-*/$i $i
         git add $i
      fi
   done

   chmod -x t/*
   cd ../..

Modify the MANIFEST file if any files are added/removed.

Create the patch (NOTE: fix the version numbers):

   git config --global user.name "Sullivan Beck"
   git config --global user.email 'sbeck@cpan.org'

   git commit -a -m 'Bump Locale-Codes from 3.15 to 3.16'
   git format-patch origin
   mv 0001* /tmp

Modify the patch to include the correct email address at the top
(and make sure it didn't modify Porters/Maintainers.pl except
for my change). Also, make sure there are no permission changes
in the patch.

   ./Configure -des -Dusedevel
   make test

and make sure that the tests all succeed. Then submit the patch.

====

To: perl5-porters@perl.org
Subject: PATCH: Bump Locale-Codes from 3.20 to 3.21

I just released Locale-Codes-3.21 which contains the core modules Locale::Country, Locale::Language, and Locale::Currency.  Due to the size of the patch (due to adding some new codesets), I'm including a link here instead of sending it as an attachment:

http://sullybeck.com/0001-Bump-Locale-Codes-from-3.16-to-3.17.patch

OR

I just released Locale-Codes-3.21 which contains the core modules Locale::Country, Locale::Language, and Locale::Currency.  The patch is attached here.

====
Background:

The core modules Locale::Country, Locale::Language, and Locale::Currency
(all part of the Locale-Codes distribution) should be updated on a
regular basis. They contain "codes" from various internet standards
which change over time.

I plan on releasing new versions at 4 times a year to keep the codes
up-to-date. At this point, I'm not planning on any significant code
changes (other than bug fixes), so the only significant changes
between releases should be to update the codes.


