Skip to content

Debugging

John Pagonis edited this page Jul 4, 2017 · 3 revisions

Rethoth comes with baked-in support for debugging via irb. To launch your Thoth blog in irb, use the following code:

$ cd my_thoth_blog
$ thoth --irb
irb(main):001:0>

At this point you have a bare Rethoth environment, but it has not yet been initialised. If you need to do any debugging before setting up the Rethoth environment, do it now.

Most people will just proceed to the next step:

irb(main):002:0> Thoth::init_thoth
I [2010-09-05 18:56:18 $11360]  INFO | : Thoth home: /Users/bklang/src/verendus-blog
I [2010-09-05 18:56:18 $11360]  INFO | : Thoth lib : /opt/local/lib/ruby/gems/1.8/gems/thoth-0.3.0.dev.2010083101/lib/thoth
I [2010-09-05 18:56:18 $11360]  INFO | : Running in dev mode
=> [Innate::Cache, Innate::Node, Ramaze::Controller, Ramaze::Plugin, Thoth]
irb(main):003:0>

The above initialises the Rethoth environment including caching and other plugin hooks, but does not start the server just yet.

At this point you can safely make calls into plugins. For example, using the Tags plugin:

irb(main):004:0> Thoth::Plugin::Tags.top_tags
I [2010-09-05 18:56:36 $11360]  INFO | : Loaded plugin: thoth_tags
=> '[[#"sparklystuff", :id=>1}>, 1], [#"shinystuff", :id=>2}>, 1]]

When you are ready to start the Rethoth server:

irb(main):005:0> Thoth::run
I [2010-09-05 20:08:01 $11360]  INFO | : Thoth home: /Users/bklang/src/my_thoth_blog
I [2010-09-05 20:08:01 $11360]  INFO | : Thoth lib : /opt/local/lib/ruby/gems/1.8/gems/thoth-0.3.0.dev.2010083101/lib/thoth
I [2010-09-05 20:08:01 $11360]  INFO | : Running in dev mode
D [2010-09-05 20:08:01 $11360] DEBUG | : Using webrick
I [2010-09-05 20:08:01 $11360]  INFO | : WEBrick 1.3.1
I [2010-09-05 20:08:01 $11360]  INFO | : ruby 1.8.7 (2010-01-10) [x86_64-darwin10]
D [2010-09-05 20:08:01 $11360] DEBUG | : TCPServer.new(0.0.0.0, 7000)
Clone this wiki locally