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 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 ?
I am not sure of your level when you say "real beginner". Do you mean
beginner in programming or in ruby ?
Perhaps you can start with ruby tutorials. Ruby is not very different
from python. The tutorials (ruby-lang.org) should get you comfortable
with ruby syntax, control flow and other basics.
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 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 ?
Some month ago, To help somebody (N.K.) to switch from its
Tool Command Language, I translated a tcl script (from N.K.)
to Ruby.
The script was aimed to add some LaTeX glue around a Tikz
image, then compile it to produce a pdf file.
The principle is to provide a LaTeX proto with some erb
encapsuled Ruby code, then generate a LaTeX file from the
script options, then compile it to produice (e)pdf,
the (if OK) remove temporary files.
I write several versions from the same tcl model (with the same
API): from the most basic one (for somebody who doesn't like
the magic Ruby style) to a more generic (i.e. standard) one
which could be use for other similar applications.
Hello
I know a little more python but I can only build very little script.
Thanks for the suggestion, I need to put myself in total immersion to learn
the syntax and others basics.
Alain
···
On 2010-12-29 17:27:02 +0100, Rahul Kumar said:
I am not sure of your level when you say "real beginner". Do you mean
beginner in programming or in ruby ?
Perhaps you can start with ruby tutorials. Ruby is not very different
from python. The tutorials (ruby-lang.org) should get you comfortable
with ruby syntax, control flow and other basics.
My question about the script in ruby is to complete my last packages
and documentations with some independent files. It' to help the readers
with some ready examples. The reader has only to compile the example
and the name of the example corresponding to the section, subsection of
the doc.
Obviously, the packages are about tikz ! (euclidean geometry and functions)
P.S.2 (for Alain)
Do you know that Hans Hagen (ConTeXt author) has switch from
Perl to Ruby for it full TeX (ConTeXt) build system some year
ago?
No but now I found : /usr/local/texlive/2010/texmf-dist/scripts/context/ruby/
and it's very interesting. Thanks!
In the first case, I'd suggest Chris Pine's excellent Learn To
Program, which is an expanded version of this website: http://pine.fm/LearnToProgram/
Coincidentally, Mr Pine saw fit to teach programming with the help of
Ruby. It's a two for one deal for you.
Then you should get the also excellent PickAxe (aka Programming Ruby)
by Dave Thomas (et al. by now, I guess).
In the second case, just get the PickAxe and the
excellent-by-reputation (I don't own a copy myself) The Ruby
Programming Language by our own Matz.
And books of general interest: Hal Fulton's (et al.) The Ruby Way is a
good buy, and so seems to be The Ruby Cookbook and Ruby Best Practices
(the book's available for free, but I'm sure Gregory would appreciate
if you got the deadtree edition, too ) and so is Agile Web
Development with Rails (if you want to dip your toes into those
waters, anyway)
Hope this helps you a bit.
···
On Wed, Dec 29, 2010 at 5:05 PM, Alain Matthes <al.ma@pomme.com> wrote:
I get the book named "Everyday Scripting with Ruby" but I am a real
beginner
so I need to learn a lot of things before to build a script.
--
Phillip Gawlowski
Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
Hello Phillip,
I'm a beginner with Ruby/Python. I can understand the code, read the
code but I'm not able to build something actually.
I learned Pascal
I'm a beginner with object-oriented programming language
In the first case, I'd suggest Chris Pine's excellent Learn To
Program, which is an expanded version of this website: http://pine.fm/LearnToProgram/
Coincidentally, Mr Pine saw fit to teach programming with the help of
Ruby. It's a two for one deal for you.
Thanks I bought this book but I only read the first chapters. I like this book
anf the way use by Chris Pine to teach Ruby. (sorry for my english language)
Then you should get the also excellent PickAxe (aka Programming Ruby)
by Dave Thomas (et al. by now, I guess).
In the second case, just get the PickAxe and the
excellent-by-reputation (I don't own a copy myself) The Ruby
Programming Language by our own Matz.
Ok but PickAxe covers 1.9 or I've 1.8.7 with OS X. Is this a problem?
I'm afraid to install 1.9 because I work with TextMate and this soft is very
dependent of Ruby.
And books of general interest: Hal Fulton's (et al.) The Ruby Way is a
good buy, and so seems to be The Ruby Cookbook and Ruby Best Practices
(the book's available for free, but I'm sure Gregory would appreciate
if you got the deadtree edition, too ) and so is Agile Web
Development with Rails (if you want to dip your toes into those
waters, anyway)
Hope this helps you a bit.
Thanks for all your suggestions
AM
···
On 2010-12-29 17:28:08 +0100, Phillip Gawlowski said:
Hello Phillip,
I'm a beginner with Ruby/Python. I can understand the code, read the
code but I'm not able to build something actually.
I learned Pascal
I'm a beginner with object-oriented programming language
Thanks I bought this book but I only read the first chapters. I like this
book
anf the way use by Chris Pine to teach Ruby. (sorry for my english
language)
Chris Pine covers object-oriented programming in his book, as well,
and so does the PickAxe.
Mind, you don't *have* to use Ruby in an object-oriented fashion,
since Ruby supports procedural programming just as well.
Ok but PickAxe covers 1.9 or I've 1.8.7 with OS X. Is this a problem?
I'm afraid to install 1.9 because I work with TextMate and this soft is very
dependent of Ruby.
Well, you could try to find the 2nd Edition of the PickAxe, or upgrade
your Ruby. To do that, you'll have to ask Google, since I have no idea
what the recommended way would be (I guess rvm or Homebrew).
As far as TextMAte is concerned: I have no idea if it'll work with
Ruby 1.9, too.
···
On Thu, Dec 30, 2010 at 9:40 AM, Alain Matthes <al.ma@pomme.com> wrote:
On 2010-12-29 17:28:08 +0100, Phillip Gawlowski said:
--
Phillip Gawlowski
Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.