Articles

Syspec: System Specifications & Tests using a Rake-like batch file

Syspec lets you write a batch file a lot like a Rake file, but in common HTTP-style language, to test the existence and proper functioning of all the domains, subdomains, their pages and responses. This project is still very much in its infancy, but I decided to get it out there to get some feedback while I use it to track production servers. This is a sample Syspecfile:

ANSI Strings (2nd Edition)

I had a couple of instances where I was adding to the ANSI_CODES constant and creating all sorts of ugly errors. Then a script of mine whispered in my ear its desire for meta-aliases. That prompted a small rewrite of the library.

ANSI Strings: your fun-loving, colourful pal (quick-fix colour library)

You can make your command line interface look a little better than just a bungle of white on black (or however you or your users set your terminal). In my on-going development of a few little open source projects, all of them with CLIs, I abstracted this cute addition to the Ruby snippets junkyard and decided to air it.

With it, you can wrap any string with ANSI codes like this:

After Rails Edge Reston

Well, one more Rails Edge conference came to a close yesterday. This was an especially fun conference, with a lot of great people and some really interesting new material by my fellow speakers. The feedback has been excellent, really hammering home what’s been becoming more and more obvious – this conference format really works.

So, my thanks to those of you who made the conference such a success – the attendees!

After my presentation on Building UI Frameworks, I received a large amount

MicroTest 1.3 / MicroStub 1.1: still under 4KB

MicroTest has had a few tweaks, making it more brief and efficient at what it does. Also, I added a setup and teardown interface which can be used. For example, I removed the use of ObjectSpace and squeezed a few percent of performance just from that. On my 1.83GHz, the 6 tests of the self test now consistently take around 500 microseconds (or 0.0005 seconds). Pretty nippy.

MicroTest 1.2 & MicroStub 1.0: Your microscopic testing pals

Just after writing the previous post, I discovered the need for a little bit of method stubbing and promptly fell upon the task with MicroStyle1. Also, I will officially keep MicroTest under 4 kilobytes2.

MicroTest just got smaller

My little library (the smallest ever?) for bootstrapping and lightning-fast testing has just become smaller. I changed the interface a little: now everything is dependent on method name! So you still have two tests, one which expects true and the other false, and which one is determined by using ‘def should_’ or ‘def should_not_’. Oh happy days!

Ch-Ch-Ch-Chia!

I’ve never had long hair. I grew up in a family where haircuts where performed on a nearly flawless bi-weekly schedule, and my service in the Air Force really put the nail in the coffin – even the thought of having hair over my ears and down my neck makes me a little crazy, not to mention a bit itchy.

Regardless, as of today I am resolved to grow my hair to a minimum length of at least 10 inches.

Surprise 10min Benchmark: eval, class_eval, instance_eval, define_method, bind

What is the fastest way to dynamically define a method? define_method? class_eval? instance_eval? With strings or procs? Maybe we can pull out some arcane magic and use instance_method and bind (depending on what we want to do).

Introducing: MicroTest

Something I cooked up in an hour for bootstrap testing a testing framework.

If anyone actually wants me to maintain it, just give a shout and I’ll gemify it.

Ruby Tuesdays: RBP Chapter 4 | Rails Fire

Ruby Tuesdays: RBP Chapter 4

Send to friend

If you’re reading this blog, you probably know that the Ruby Best Practices book exists. Even if you haven’t read it, you might have a sense for the sort of topics we cover based on the content you’ve seen on this blog. But now, everyone is going to get a chance to read RBP the way its meant to be read: as a conversation.

Progress To Date

We’ve already released the first three chapters, and discussion has been great. If you haven’t seen them already, check out the first week’s discussion on testing, and then head over and look at the double header on API design and metaprogramming. These discussions should give you a sense of the wide range of ideas our readers have been sharing as a result of this book study.

How To Read RBP

Readers are encouraged to fight RBP as they read it, rather than just soaking up the information. Although I claim this book is about “Best Practices”, the only reason that is true is that it’s a result of countless conversations with folks who are deep in the Ruby trenches getting stuff done. The only way for RBP to remain current and relevant is to continue these discussions, using its content as a jumping off point for fresh ideas.

Today’s Topic

If you’re willing to participate in the discussion afterwards, go ahead and download Chapter 4 now. Don’t worry if it takes you more than a few days finish reading it, you can come back and comment any time.

While chapters 2 and 3 were about somewhat subtle features, this chapter is as concrete as they come. Those with some Perl blood in them should find it familiar, as it’s all about how to munge text and move stuff around on your filesystem. But those who struggle with the scripting side of Ruby should find a number of techniques that will make their job easier.

Enjoy, and come back next Tuesday (2010.02.23) for Chapter 5, “Functional Programming Techniques”.

For Your Consideration

O’Reilly is being really nice to me by letting me give away my book, especially considering that I haven’t quite cleared my advance yet. So if you like what you see, and want to be able to read it all now instead of waiting several more weeks for it, please consider buying the book. You can get it directly from the publisher or via amazon. While I do make a little more money when you buy from O’Reilly, I wasn’t expecting to get rich off of RBP, so don’t feel bad buying the discounted copies from Amazon. But I’m pretty sure that seeing a spike in sales would encourage them to do more open source books, so… keep that in mind.

For those wishing to do interesting things with this material, note that it is released under the Creative Commons NC-SA license. This will become immensely more useful once the source documents are posted in late March, but if you’ve got any questions at all about this, you can ask me, and I’ll ask my publisher, and we’ll get back to you.