Hello

object :
+++++

 I never made a script with Ruby (and with python !).
I would like to translate a little script from python to ruby to insert it
 inside a bundle made with ruby and I would like with this try to work
 a little with ruby. I work with OS X and I have ruby 1.8.7.

the script in python :
++++++++++++++++++

--------------------------------------------------------------------------------
#!/usr/bin/env 

python -u
# -*- coding: utf-8 -*-

import glob

HEADER = r"""\input{Vorspann.ltx}

\begin{document}

%s
\end{document}
"""

texFiles = glob.glob('*.tex')

for fname in texFiles[:]:
    #print fname

    text = file(fname, 'rb').read()

    text2 = HEADER % text

    fh = file('new/%s' % fname, 'wb')
    fh.write(text2)
    fh.close()
--------------------------------------------------------------------------------

Explanation 

:
+++++++++

The script is in a folder F with text (here it's tex) files (utf8 files)
The script reads the  LaTeX  files inside F  , then
 it adds the line :   \input{preamble.ltx}

and to finish it puts around the initial lines two lines:

\begin{document}

\end{document}

Example :
+++++++

test.tex is a text file which contains :

I'm a file test.

the result is a file with the same name in a subfolder named "new"
and text.tex now contains ::

\input{preamble.ltx}
\begin{document}
I'm a file test.
\end{document}

I hope someone can help me

Thanks and best regards

AM

PS : What is the better book to learn how to script with ruby ?