Holy Crap It's March - or How I Made My Lenovo Flex 4 a Ruby Slave

I just have not been writing. I can’t believe it’s March. These last few months have flown by. We had a flood in the basement, which is stressing me out a bit, and I had to postpone doing my taxes this year because Wells Fargo screwed up my paperwork, so that’s a bummer.

And I spent a few weeks prepping my laptop for a trip to San Francisco, and we had to cancel because everyone got sick. But we are heading over this weekend instead, so that’s good.

I guess I’ve just had a lot on my mind. My friend Mike passed away sort of suddenly from cancer, and that is just a tough pill to swallow. I feel super guilty because the last time I saw him he had his guitar out behind The Hotel Cafe, and was playing the blues, I was there for Sally Jaye’s release for Amarillo, and I just felt like he was going to be there forever. And now that was 10 years ago and that is the last memory I have of him. So sad.

And after looking at our finances for last year, we really needed to pull in the belt a bit. So when I was looking at getting a new laptop, for the first time ever, really, I seriously considered getting a Windows laptop instead of a MacBook because the price differential is pretty much out of control.

I settled on a Lenovo Flex 4 / Yoga, which ran me just under $600. The cheapest MacBook with the same specs would have been close to triple that. I just couldn’t justify that expense.

I set it up in about 2 days, and now it is running a Rails 3.2 stack and it is a fully functional work laptop. It’s amazing how far things have come.

So if you want to do your Rails Development on a laptop that is not a Mac, perhaps this list of steps can help you a bit.

1 - Windows 10, or nothing. You need Windows 10, because it is the Anniversary Upgrade for Win 10 that introduced something called WSL (https://blogs.msdn.microsoft.com/wsl/) ‘Windows Subsystem for Linux’, and that is what makes this all possible.

2 - You cannot access localhost from WSL, but the ip works just fine. And Windows properly can access localhost inside WSL. So it goes like this:

Database - lives in windows, accessed by WSL server via

Browser, lives in Windows (I use Chrome), accesses WSL server via localhost

server, runs in Ubuntu

Editor, lives in Windows, accesses linux docs w symlink 

3 - Apps. You might be worried about what apps are available, but it seems like a decent environment at this point. I love my Mac apps - Fetch, Sequel Pro, Textmate - but there are perfectly decent replacements available. And for any old Textmate people, like me, you might want to take a look at Atom. The auto-complete works really well and reminds me of my old Visual Studio days inside the Microsoft machine.

I use - 

Cmder (http://cmder.net)

Atom (https://atom.io)

mysql command line client for Windows (https://dev.mysql.com/downloads/installer/)

NOTE for MySQL - the 32-bit installer does indeed install a 64-bit version if you want. That was not documented at all that I could see, and if you are looking for a 64-bit installer you are not going to find one.

Sqlectron (https://sqlectron.github.io)

and I haven’t checked yet but I’m sure I can find a decent ftp tool.

I used this walkthrough as a reference.

and the last caveats are that, for ubuntu, only Rails 3.2 and 4.3 are available; and MySQL is only supported up to 5.6 (at least as of a few weeks ago).

All in all, I am very happy with my experience with Windows 10. It has been pretty great so far.

The steps (roughly):

1 - install WSL

2 - test out bash command, set up aliases

3 - follow rvm instructions for installing on linux (use stable version - https://rvm.io/rvm/install)

4 - rvm install Ruby

5 - gem update --system && gem update

6 - sudo apt install git

7 - gem install bundler

8 - symlink linux docs folder back to windows documents -  (ln -s /mnt/c/YOURUSERACCOUNT/Documents ~/Documents)

9 - set up new key gen (I used the GitHub link as reference: (https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)

10 -start trying bundle install, use apt-get as needed

for example: sudo apt-get install mysql-client-core-5.6, sudo apt-get install ruby-railties-3.2, sudo apt-get install ruby-dev, sudo apt-get install build-essential g++, sudo apt-get install libmysqlclient-dev will all be necessary

11 - gem install mysql2 -v '0.4.5'

12 - gem install activerecord-mysql2-adapter

and then the occasional sudo apt-get upgrade should keep you running.

good luck!