background preloader

Ruby

Facebook Twitter

Jason Seifer - Pentadactyl. If you’re developing with Rails you’ve probably encountered rake once or twice.

Jason Seifer - Pentadactyl

This blog post aims to walk you through where rake came from and an introduction on how to use it effectively in your Rails apps. A Little Bit of History Rake is the project of Jim Weirich. It’s a build tool. For a good laugh and an even more in depth history check out the "rational.rdoc" from the Rake documentation. What’s the need for an automated build system at all?

Historically, developers used build automation to call compilers and linkers from inside a build script versus attempting to make the compiler calls from the command line. It’s about Dependencies This may be a bit of a stretch to say but build tools are about dependencies. What we’re saying here is that the file named “hello.tmp” depends on the directory "tmp".

If you were to look at the "hello.tmp" file you would see the phrase "Hello". Now if you were to run it twice you would see something like this: Running Other Tasks Namespaces Refactoring. Cloud Application Platform - Pentadactyl. Start - 2011 Rubyist's guide to a Mac OS X development environment — giant robots smashing into other giant robots - Pentadactyl. It's been two and a half years since my last laptop.

Start - 2011 Rubyist's guide to a Mac OS X development environment — giant robots smashing into other giant robots - Pentadactyl

It's neat to look back and see how much has improved since then for setting up a Ruby development environment. Of particular note, Homebrew, RVM, and Bundler did not exist back then. Here's how I set up an OS X 10.7 (Lion) thoughtbot laptop in 2011. I need GCC to help install everything else so I downloaded GCC for Lion. We used to have to install XCode to get GCC when OS X wasn't for developers, which was a 3-4GB download and took 10GB+ of space.

However, Kenneth Reitz, one of the Readability guys, fixed this with his OS X GCC installer, which is a comparatively svelte 272MB download. Later on, when we're installing things using Homebrew, we'll see warnings like: Xcode is not installed! But, the builds will build fine. While that's installing, we'll customize our environment a little. I need a public key to get access to private Github repositories. ssh-keygen -t rsa I'm kept hitting "enter" until it was done. Dotfiles I cloned the repo: Start - How to create a Ruby extension in C in under 5 minutes - Pentadactyl. Many coders will reach a situation where developing a C extension makes sense, whether for doing 'heavy lifting', diving into assembly language, interfacing with other C code, etc.

Start - How to create a Ruby extension in C in under 5 minutes - Pentadactyl

Luckily, developing a basic Ruby extension in C is easy. Note: This article assumes you are using a UNIX of some sort (this was all tested on OS X) and that you have Ruby installed properly (from source, ideally, so you have ruby.h available). If not, you may be stuck. First, create a directory called MyTest (or whatever you want your extension to be called) and in there create two files, extconf.rb and MyTest.c (if you want to download pre-written sources, they're in this tar file). In extconf.rb, put the following: require 'mkmf' extension_name = 'mytest' dir_config(extension_name) create_makefile(extension_name) This code is pretty self descriptive. For C, it's reasonably simple code. Next we need to compile our hard work.

Et voila! Start - RedHanded » sneaking Ruby through the system - Pentadactyl. In an article posted entitled What’s Wrong With Ruby?

Start - RedHanded » sneaking Ruby through the system - Pentadactyl

, the author cites me as one of the main problems: If I was put off Ruby by the hype, I was put off more by the many cutesy introductory tutorials I encountered when trying to get into it. Why’s (Poignant) Guide is a particular horrid example… I don’t want someone chatting away to me and telling me how “cool” it all is (I’ve lived long enough as a computer programmer to know it’ll never really be “cool” to be one). I just want the straight facts, plainly put. These are such great points and so well-put. If I may build on his argument for just a sec.

The problem here is: the author of the article is trying to do academics, to gain knowledge, to build a career. Programming is for world commerce. Fortunately, as I’ve mentioned before, I have a strong feeling that I will die young without artifact. Start - ruby - Redcar Install through RVM - Super User - Pentadactyl.