 Who am I? My name is Rogelio J. Somewhere. You can't pronounce my first name. You can just call me Ro. I am a solutions barista. I made that up, by the way. They don't. You can make up your own titles. Hashtag rocket. At Hashtag rocket, of course. I have been a Linux sys admin, a software engineer, and tall for a longish time. That's my Twitter. That's my email, my blog, all five posts. I let them, I make them count. And my GitHub's, and that's it for me. So now, feast your eyes on this. Medium turkey chili. Ham crab bisque. Just forget it, let it go. I think you forgot my bread. Bread, $2 extra. $2, but everyone in front of me got free bread. You want bread? Yes, please. $3. What? No soup for you. So you may be wondering what that clip had anything to do with my talk. Absolutely nothing to show about nothing anyway, right? Anyway, no soup for you. Here's what we're going to accomplish. You ready? Today's mission, a soup final from here. For a near-perfect development environment, to seek out cases for Sudo, to boldly go where no developer has gone before, star. Not really, but it sounded good. Well, you may learn some other things along the way. So anyway, Sudo, I guess it has its place, right? Mostly in the enterprise multi-user environments. It allows for logins. I'm going to zoom into this. So these are two commands, right? You can run Sudo, mySQL status, or you can run SU-C, and then the command that you're going to run. What that's doing, wait, I have a pointer. No, I don't have a pointer. Do I? Yes? No? I don't. That's right. I don't. Yes, please. The top, and the top. Let's try to get the batteries. No worries. OK, it doesn't work. All right, it doesn't work. So if you see up there, it says the first one is with Sudo. So it's telling you that the user fry was running it. There you go. He ran the command, mySQL status. So you know that it was fry, and you know that it was he ran this command as root. With this, all you know is in the logs back, whenever you come back and check it out, is that the user fry ran something as root, but not what it did. So it's not entirely useless, right? There's nothing really wrong with it. And I use it to install tools that I trust, because there's a lot of crazy stuff that could happen if you have a make file that just says rm-rf slash. That can delete your crap pretty quickly. So the question is, why no Sudo? All right, Sudo has no place in the Ruby development environment. The part of the problem is most of us, who's using Ubuntu or some sort of Linux and OS 10, or Enddoor OS 10? So most everybody, I think I saw a couple of Windows machines here and there. I forgive you. Well, Ubuntu and OS 10 specifically don't really set a default password for root, so that's bad because that forces us to use weak passwords, right? And like I said earlier, Sudo can potentially wreak havoc in your box. And Sudo, if you run Sudo gem install, it'll install Ruby in your system Ruby, which we'll get to this later. But that makes it incompatible with RBM. And it's also not ideal for homebrew in OS 10. So here it is, what I think should be perfect as a development environment. The cool thing is Debian folks have apt Gentoo guys, peeps, persons, have portage, which is, to me, one of the best package dealy boppers. And then Macaulay's 10 people, nothing. Pure crap, right? Until, of course, homebrew came along to say the day. And it really is the amazing package manager for OS 10. Now you may be saying, oh, what about Mac ports? If you have Mac ports installed right now, uninstall it. Go ahead, I'll wait. OK, fine, don't. The thing about, let me camp out here with this guy, homebrew. Homebrew, I believe that as craftsmen, this right here is our tool, this guy. So our development environment should be ours, right? Fine, if you share your computer with your wife and she wants to surf the internet, it's fine. But I think what homebrew is telling you to do is, user local should be CH-TONE to your user. And I think that's fine in OS 10. Homebrew is OS 10 only, by the way, so don't throw rocks at me. App is great. So brew allows you to install a whole bunch of libraries and stuff, like w.get, which is not in OS 10, under user local. And homebrew, if there's something not in homebrew, it's in Ruby, and you can write formulas that will go out and, for instance, ImageMagic has an entire, it's almost like a Chef recipe, but not really. But it's very declarative, right? So you say, this formula is going to go out and not only install and compile ImageMagic, it's going to go and get lib, jpeg, PNG, and all that other stuff. But you only worry about it once you make the formula and then brew install ImageMagic in your set. How many people know or are using homebrew? Cool. Great. So next, here are the needed goodies for your Ruby development environment. For Ubuntu, of course, curl, bison, build, essential, all that stuff to be able to compile stuff. In OS 10, you need Xcode and homebrew, like I just said. And of course, in both, you need them. And I guess, I mean, if you're in Ubuntu, of course you're going to use them. If you're in OS 10, you may want to use Emacs, but not text-made. I'm kidding, of course. You can use whatever you want. Firefox and Chrome, MySQL, Postgres. And by the way, MySQL, Postgres, SQLite, Mongo, Couch, whatever, all those already in brews. All you have to do is say, brew install MongoDB and you're done. And I'm going to show you some of that stuff later. And there's more, but the biggest thing that you must install in your RubyDale environment is my friend, RVM. Who's using RVM? Yeah. Heck yeah, awesome. Hopefully you'll learn something new today. So RVM stands for Ruby Version Manager. It's a command-line tool. It installs multiple Ruby interpreters. It manages sets of gems per Ruby version, which is huge. Because, like I said, if you sudo a gem install junk, you have this big barrel of gems full of gems. And you can't manage it, right? I mean, I'll get to it in a second. I'm going to show you a little deli. And you can perform operations over install interpreters and gem sets. Again, this is going to be part of the demo. Check this out. This is a gem list from Eric, Eric's computer, because he's not using RVM. Check it out. Uh-huh. And that's it. And I just go back down. Uh-huh. Yeah. Yeah. Yeah. Now, let's go check out Rails. Look at all the versions of Rails he's got there. 1.6. Where's the arrow? Bing, bing, arrow, arrow, arrow, arrow, there. There's the arrow. So what if he wanted to check out Rails 3 with his gem system gem, and so he can't, right? Because now, right now, if he runs the Rails command, it's going to generate a 2.3.8 app. So again, this is a big, oh no, I forgot to take this one off. The next one, it just goes over again. Oops, let's ignore this. So why use RVM? Gem isolation. I just showed you. That's crazy to have all these gems in one big pot. Gem sets, again, per project RVMRC, which I'll show you in a second, a single command to run, for instance, this will run your specs for Ruby 1.8.6 and RE. And you can even tell it to run it not only per a Ruby version, but a specific gem set. And I'll show you again as part of the demo. And the flexibility to start over and be back up quickly again. Now, last night I was showing Eric some stuff, and something went wrong with my environment. So all I did is I said, RVM implode. It deleted my .RVM, and I was up. And actually, it took longer because of that stupid internet. Everybody, I guess, they're doing torrents or something. It took forever, but it was taking forever to download the source files and then compile them. But anyway, so here's the demo. I am brave. I will do a live demo. I'm going to mirror this stuff so that I can see what I'm doing. Did I do what I thought I was going to do or not? Oh, there it is. Display. I want to mirror the stuff so I can see what I'm doing here. Some of you are familiar with Hitch. Who is not familiar with Hitch? This is a small gem that I used to give proper author attribution to when you're pair programming with somebody. So when you make that commit, it'll show that commit as both of you, and not just the person who owns the computer. OK. I can give you a small demo of Hitch. Can everybody see that OK? All right. Not in this project. I think this project has something. So you see at the top there, Bernard and these, we're working on that pairing station. And it's a great way to make these things stick. Oh, gotcha. All right. And so the committer is the pairing station, so because that's the way that we're working on. But then the author is dev. We have this email dev at Hashtag, and then of course you can do pluses after that, any number of pluses. So dev plus Bernard Schaefer, which is his GitHub, and then visas, which is his GitHub username. And then we go to Gravitar and create a Gravitar for that unique email. And then when it shows up in GitHub, you'll see their picture based on that Gravitar. So anyway, it's just the author attribution. The point of it is somebody that's using it wrote an issue and they said, hey, they want to do a triage. And you can do that right now. But so the way that that would look like, so I would say Hitch, the Ruby mug, Pat Maddox, and say tpo. And see, now he does it with and, and, and, and blah, blah, blah. So this guy, what he wanted is to do a Pat Maddox, comma, Ruhedy, Jason Moore, and Tim Pope. And I was like, fine, we can do that. But of course I didn't, not yet anyway. So let me open Vim and let's go through. First of all, let me just do a rake, make sure everything is passing fine. And then this is the command that I was telling you about. Power of RVM. All right, I don't want to push. As a matter of fact, you can run rake spec or you can just run specs. So now it's running it in 186. Everything passes, I think, no, everything broke. It's supposed to be working, but whatever. There you go, 186, RE and 192. So my gem is now compatible, of course, with all of these. Now I want to add this new feature that this guy wanted, very simple stuff. And the first thing I want to do is, I don't know if I'm going to be able to do this. Can you guys see that on the right over here? Oh, cool. So there you go. Now look how fast I'm going to write this. You ready? I can. So I'm going to call something like pair count or something like that, or number of pairs. That sounds better. Number of pairs. And this is just something to illustrate an issue. So it returns the number of pairs. And we say do. And then we set up something or other. Let's say we do this. And then we say hitch that number of pairs. Oh, you see that? That should equal two. Right, and if I run this, just this one test. And by that one test, I mean not this. Then it's failing because it says I don't know what number of pairs is. Let's go over here and add this right quick. And again, it's just going to be something like, yeah. Current pair is just an array. So I'm going to run this. I'm just going to run this locally. So that pass is cool. Now let me run this with everything to make sure. And again, that's the command, rvm. And you'll notice that I have hitch. That's the gem set. I'll get back to that in a second. But here you go, oh, oh, oh. What happened? Here's what happened. Array didn't have count in 186. You see? The power of rvm, it picked it up, right? Because I ran it, I ran my test, and it made sure that it was running with all 186. And so what I do, simply to fix that is I go to my implementation, and I say size. And then I run it like so. And now we're done. And by the way, stop me at any time if you have any questions on how I did something over there. Oh, I see. I'm not, huh? I guess so. So the power above you. So OK, so how do we get here, right? Gem list is a lot shorter than the list that I show you from Eric's computer, right? And rvm info gives you a whole bunch of information. See, now I have a pointer. It's saying that the home path, that the gem home, is the hitch gem set, right? And then it's going to combine not only that gem set, but every Ruby version has a global, right? And so that global, you can install generic stuff in that global one. So for instance, I want to make sure that all of my rvm, all three of these, that whenever I'm moving from one Ruby version to the other, that I have hitch, right? Because if I'm programming, I want to make sure that all of them have it. If I say rvm use 1.9.2, then when I list it, it's an even shorter list, because there's not much stuff installed in 1.9.2. And then it shows hitch right there. So I can at any time say hitch, and then it shows me that I'm triaging with Pat and Tim, right? I can unhitch here, and there's an rvm. Oh, this is a bad example. Well, fine, I'll show it to you. This is a per project rvm rc, which means that when I see d into my project, or change directory into my project, that it's going to say, hey, does this exist? And it's going to set up the environment so that I'm using ree and the gemset hitch. If it's not, if it can't find this, it's going to go ahead and create that hitch, gemset. Now, let's do something crazy. I think there's a for loop here somewhere. So this is just going to go through each of one of these. This is going to go through rvm list strings. It's going to give me all three versions. And I'm going to go through each one of them and not create hitch, but I'm going to empty the gemset. Because I'm crazy like that. rvm gemset, think about this, rvm use $x at hitch and rvm gemset empty hitch. So I just want to make sure that I empty all of them. And of course, it's not going to let me do that. rvm, let's see. Here you go. I'm going to do it. I'm going to make it easier. I'll be agile here. Empty, didn't I call it empty? Oh, I can give it anything else. Here we go. rvm info. Oh, actually, can you see up here? Barely. What is it? Oh, there you go. I have it in my prompt. So it'll show me what Ruby version I'm using and what gemset I'm on. So I think you can just say rvm gemset empty. I don't know why that's not working. Or empty without anything. It's totally broken, dude. And the brackets are empty in the list. Do you have to say rvm hitch? No. Weird. Do you have to empty something? That is weird. Here we go. Whenever you're having trouble with rvm, just do this. He helped me test stuff. So you see, there was an update already. And you do have to open up a new one. A new one. Say what? rvm reload. Oh, you're rvm reload, yeah. No. Wow. This is not good. Do you need help? Yeah, you see there? rvm help. rvm gemset help. rvm empty. Whatever. That's what you get for trying to do a lot. I'm OK. I showed you most of what I wanted to show you anyway. How am I doing on time? Weird. Here you go. Here's what I'm going to do. rvm uninstall re. That works. That's going to kill everything. So when I go try to come back, it is it. See, now I can't find hitch because all the gems I killed. Gem install. Sorry. rvm install re. This may take a while, so let's talk about something. It may take longer than what I want to spend. But let's talk about brew while it's going. So brew, this is the stuff that I have installed in brew. I have image magic. I have liptif, jpeg. All this stuff is because of image magic. I have postgres. I have prop tools, which allows me to do crazy stuff like pgrep firefox. I mean, stuff like that. The cool thing is, if I wanted to install something, what's something you guys want to install, this will take forever. But I have, well, let me just show you what it does. So if I want to say brew info for my SQL, this is what it gives you after it installs. It tells you what to do, what to seem like where, and then it loads it, and now it's just working. The biggest thing is that I want you to know, and take away from this, is that I have a step-by-step presentation. I mean, presentation blog post. That's for Hitch, that I have one for Debian and for Snow Leopard. And basically, it'll get you what you saw today, which, of course, this is step zero, is uninstall MacBooks. And then install the rest of the stuff. You'll notice that I CH-own user local to who am I, which is the user that you're running with. And then. What if you have more than one user on that machine who wants to brew install things? Who wants to brew install things? Yeah. Who do you have in there? I just have multiple accounts on my machine. You do? I do. Yeah. Once crippled by the corporation, the other isn't. Then use the one that is in crippled by the corporation to be the master of disaster. Yeah, that's kind of, because with our pairing stations, right, we have a dev user. And then we set everything up as that dev user. And then so from that pairing station, you can brew install, do anything. No pseudo at all from that Mac. Ideally, in that situation, I think what I would do is put everybody in the staff or wheel so that they can pseudo SU-that user, the one user that owns everything, and then do stuff at that user. I mean, that's the best. I mean, it's kind of, this has worked for me in the development environment. I haven't gotten it, I haven't perfected it in the production environment yet. It's just because of tricky stuff like that, right? And or even RBM, does anybody has anybody done RBM in production environment? In production? Wow. So was there another question? Yeah. If I create a different directory, and what? Oh yeah, you can install home brew in wherever you want to, right? But this is the prescribed way that they tell you to do it. But yeah, this is not the only way to make this work, the brew stuff. But the thing is this, though. In reality, by doing this, you can come back and not use home brew for whatever reason doesn't work for you. You can bring the sources into user local, source or whatever, compile the stuff, and it's still going to work, because everything is on the user local. So it gets out of the way of everything else. I don't know if you saw, when you see here, when we said brew install W get, and then you go to user local, you'll see that it created under this seller. You know what I've done? Sometimes I had an issue with a pairing station. I could not get Postgres installed, for whatever reason. So what I did is I deleted seller, I went to my other identical iMac, copied the seller directory into here, because they're all the same user, right? Everything worked just fine. We had Postgres running. We had everything running just fine. Let's go check on our little dealie over here. Hey, there you go. So rvm list shows us r-e-e, rvm use r-e-e, one less e, default. It's going to make that guy, my default one, gem install. Now, rvm use at global is going to use r-e-e at global. Now we're using the global gem set. I'm going to say gem install, hitch. And then what I'm doing there is I'm making it available, I'm making hitch available in the global gem set. Now I can just go into a different, even a different. So for instance, if I go to my, this is my, this is my blog, because I use, what do I use? Webby. And it has its own, as you saw, it has its own gem set, right? But it also will share the global gem set. So I should be able to say gem list hitch, and it's going to have, you know, gem list is going to have the hitch, and it's going to have the other stuff that it needs. So where was I with the hitch stuff? There we go. All right, so now if I say gem list, this should be almost not empty bundle. OK. So, yeah, I think that's all I had. Is there any more questions? I think I'm out of time. Good question on rvm? Yeah. Great question. Here we go. I have in rvm, I have rvm use 1.9.2 at Rails 3. Now, gem list, I thought I had this installed Rails. Now, what I would do for this particular issue, while it's installing, I'll tell you what this is going to do. This is going to allow me to rvm use 1.9.2 at Rails 3 to generate and create new Rails 3 projects. And then inside of there, I'm going to create a .rvmrc that's going to have whatever Ruby version I want, whether it's 1.9.2, 1.8.7, RE, JRuby, whatever. But this now allows me, now I can say Rails, right, that's V, and now I'm running Rails, and now I can run all my generators from here. And then once I create the, what do you call it, the directory, like yesterday, what was it? Rails, huh? Rails, new, and then the name. New Twitter, whatever we called it, right? But I'm going to create that here. Rails, new, Twitter, 3. Oh, and that didn't work. That's because I am, yeah. That's because I need to do this. There you go. And of course, at that point, I would go into Twitter, 3, and then create my .rvmrc. Actually, you can do this. rvm dash dash rvm rc dash dash create use, I guess we can go with re at and call it Twitter if I can type 3.0. And what this creates is this rvmrc file, which looks exactly like my hitch file. And now it's going to either create it or just set up, I was talking to Wayne on IRC just yesterday, actually. And he was telling me that this is a performance optimization. So that's the top part over there. It says if it finds a directory, it loads it. And you can do stuff like, because this is what I had so that at least you're rvm dash prompt so that whenever you, well, the first time you go into it, it asks you if it's going to be, because you're executing code, if it's trustworthy, and then you trust it. And then this is what I was going to show you. It's telling you what you just selected and then where you're at. Questions, no more questions. He is almost always in IRC. So that's it for my demo. No more questions? No? And thank you.