As I’ve told in the previous post about StrokeDB, we’ve added a simplistic test console to StrokeDB recently.
Here is an instruction how to use it.
First, you’ll need StrokeDB :) You can get it easily with Git:
$ git clone git://gitorious.org/strokedb/mainline.git strokedb
Then, change your work directory and start console:
$ cd strokedb/strokedb-ruby
$ ./test/console --prompt xmp
(—prompt xmp isn’t obligatory)
Now you can play with it:
$ ./test/console --prompt xmp
StrokeDB 0.0.1 Console
Type 'h' for help
User = Meta.new # here we define User
==>{User meta module}
User.create! :login => "test", :email => "test@foobar.com"
==>#<{User} __version__: 3c3c..., login: "test", email: "test@foobar.com">
save!
==>true
quit
$ ./test/console --prompt xmp
StrokeDB 0.0.1 Console
Type 'h' for help
User = Meta.new # here we define User
==>{User meta module}
User.find(:login => "test") # let's fine Users by login
==>[#<{User} __version__: 3c3c..., login: "test", email: "test@foobar.com">]
u = _.first
==>#<{User} __version__: 3c3c..., login: "test", email: "test@foobar.com">
u.name = "John Doe" # update user's name
==>"John Doe"
u.save! # save user
==>#<{User} name: "John Doe", __version__: 1e50..., __previous_version__: 3c3c..., login: "test", email: "test@foobar.com">
u.name = "John Doe" # get name
==>"John Doe"
u.email
==>"test@foobar.com" # get email
clear! # wipe out database
==>true
User.find(:login => "test")
==>[] # nobody found!
quit
You can also type ‘h’ to get some help.
Hope you’ll enjoy.




