Write a book about Ruby and run the code embedded in it

Hi! In my local Ruby user group we're planning to write a book about Ruby.
It'll contain snippets of code and we'd like to be hable to run those
snippets in order to "test" the book and ensure all examples run with
different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

Thanks in advance!

···

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:
http://www.juanjoconti.com.ar/xolopes

Xmp was written for exactly this purpose.

···

On Dec 13, 2014, at 15:31, Juanjo Conti <jjconti@gmail.com> wrote:

Hi! In my local Ruby user group we're planning to write a book about Ruby. It'll contain snippets of code and we'd like to be hable to run those snippets in order to "test" the book and ensure all examples run with different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

Thanks in advance!

--
Juanjo Conti
Mi primer novela ya se puede conseguir en: juanjoconti.com.ar

If you treat each snippet as a test case, wouldn't any test case framework
do the job? (i.e. minitest, rspec, etc)

-Raj

···

On Sat, Dec 13, 2014 at 4:09 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

Xmp was written for exactly this purpose.

On Dec 13, 2014, at 15:31, Juanjo Conti <jjconti@gmail.com> wrote:

Hi! In my local Ruby user group we're planning to write a book about Ruby.
It'll contain snippets of code and we'd like to be hable to run those
snippets in order to "test" the book and ensure all examples run with
different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

Thanks in advance!

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:
juanjoconti.com.ar

This one? GitHub - amberbit/xmp: Extensible Metadata Platform (XMP) parser

···

2014-12-13 21:09 GMT-03:00 Ryan Davis <ryand-ruby@zenspider.com>:

Xmp was written for exactly this purpose.

On Dec 13, 2014, at 15:31, Juanjo Conti <jjconti@gmail.com> wrote:

Hi! In my local Ruby user group we're planning to write a book about Ruby.
It'll contain snippets of code and we'd like to be hable to run those
snippets in order to "test" the book and ensure all examples run with
different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

Thanks in advance!

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:
juanjoconti.com.ar

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:

That's one of the ideas, yes. Even rubydoctest. But I was wondering if
there is something already set up, a framework (?) for the job.

···

2014-12-13 21:22 GMT-03:00 Raj Sahae <rajsahae@gmail.com>:

If you treat each snippet as a test case, wouldn't any test case framework
do the job? (i.e. minitest, rspec, etc)

-Raj

On Sat, Dec 13, 2014 at 4:09 PM, Ryan Davis <ryand-ruby@zenspider.com> > wrote:

Xmp was written for exactly this purpose.

On Dec 13, 2014, at 15:31, Juanjo Conti <jjconti@gmail.com> wrote:

Hi! In my local Ruby user group we're planning to write a book about
Ruby. It'll contain snippets of code and we'd like to be hable to run those
snippets in order to "test" the book and ensure all examples run with
different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

Thanks in advance!

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:
juanjoconti.com.ar

--
Juanjo Conti
Mi primer novela ya se puede conseguir en:

Are you talking about Literate programming - Wikipedia ?

Cheers

robert

···

On Sun, Dec 14, 2014 at 12:31 AM, Juanjo Conti <jjconti@gmail.com> wrote:

Hi! In my local Ruby user group we're planning to write a book about Ruby.
It'll contain snippets of code and we'd like to be hable to run those
snippets in order to "test" the book and ensure all examples run with
different versions or Ruby.

Could you recommend me any tool or workflow to achieve this goal?

--
[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}
http://blog.rubybestpractices.com/

No.

gem which irb/xmp

···

On Dec 13, 2014, at 16:21, Juanjo Conti <jjconti@gmail.com> wrote:

This one? GitHub - amberbit/xmp: Extensible Metadata Platform (XMP) parser

This one? https://github.com/amberbit/xmp

No.

gem which irb/xmp

Example:

10004 % cat blah.rb
  foo = "bar"
  baz = 42
10005 % irb --prompt xmp blah.rb

  foo = "bar"

=> "bar"

  baz = 42

=> 42

···

On Dec 15, 2014, at 17:08, Ryan Davis <ryand-ruby@zenspider.com> wrote:

On Dec 13, 2014, at 16:21, Juanjo Conti <jjconti@gmail.com> wrote: