Monday, March 19, 2012

Rails 1. Cheri 0...or maybe 0.5.

Continuing to Do Very Little with Ruby on Rails

After setting up the first application in Rubly on Rails (see my last post on my Ruby progress), the tutorial I was following walked me through the steps of signing up for GitHub and then Heroku and connecting the first application to these services.  

GitHub is a tool that serves as version control. What's cool about version control is that when you accidentally mess up your code, which for me isn't so much of an issue of "if" but rather "when," you have a safety net.  You can revert back to the last committed code on GitHub and pretend you didn't accidentally just mess up your application!  Nice!  It took me a long time to get my application synced up with GitHub.  Signing up for GitHub itself was easy enough, but then I had to connect my local files to the GitHub account.  To make this work, I had to learn about SSH key first, learn where to find mine and how to connect my GitHub account up with it.  Of course, really what I did was skip over the line in the tutorial book that said, after saying you should sign up for a GitHub account "You might have to read about SSH keys first" (Kindle Location 808).  Because I skipped over this, I spent about an hour banging my head on a wall when my application wouldn't connect up with my GitHub account.  Note to self:  pay attention to stuff in the parentheses!   

Nevertheless, I got to see my "first_app" files all safely hosted at GitHub, as this Screen cap shows:
GitHub Screen cap showing first_app files
GitHub Screen cap showing first_app files

Heroku gives your application a place on the web to live so that you can deploy it.  It's really a simple tool to use, once you know what you're doing with Terminal and GitBash.  You sign up for a Heroku account, then you gem install Heroku, tell Heroku your SSH keys and then use Git to push the application to the repository.  The image below show's the start of that--and how if you misspell things it will give you an error.  HA
Screen cap of Heroku install and SSH set up
Screen cap of Heroku install and SSH set up

Fair enough.  The push process was incredibly slow, especially on Panera's wifi ;).  Here's a Screen cap of the progress after about 10 minutes--that's right, 5% written.  
Screen cap of push to Heroku, 5% written
Screen cap of push to Heroku, 5% written

After I let the push run the first time, I got an error message that said:

error:  failed to push some refs to ''

Bummer.  So I did some research on this and found that some folks had success using some tricks with the git remote command to work around it.  No dice.  I end with this:

Screen cap showing failure to push to Heroku again.
Screen cap showing failure to push to Heroku again.

All this did is help me to create a new respository name (pure water rather than young mountain) to fail at syncing with my account.  I still have not been able to figure out what my hang up is here.  I've searched the forums, but haven't quite found a solution yet.  I'll have to keep digging.  The trouble with working with GitBash and Terminal in general is that there seem to be so many things that can go wrong.  My understanding of these processes is just enough to be dangerous, but not deep enough to know what I need to solve problems.  It's frustrating, but it gives me renewed appreciation to the depth of knowledge that developers have for this stuff.  I admit defeat.  For now.  

End of Tutorial Time Reflection:  So how far have I come?
Alas!  I have made it through Chapter 1 of Ruby on Rails 3 Tutorial: Learning Rails by Example, give or take the successful push to Heroku.  As the author, Michael Hartl, says in the conclusion of Chapter 1:  "We've come a long way in this chapter:  installation, development environment set up, version control and deployment" (Kindle Location 958).  It's true that I have come a long way and accomplished a number of things, but it really doesn't feel like progress because so much of the progress has been mental and in problem solving rather than visible.  

I have gained quite a bit in terms of understanding what goes on below the surface of development.  I have learned a wide variety of commands in terminal, I have learned to work in GitBash, and I've become familiar with tools for version control and hosting applications.  I learned about SSH keys, which previously I had no idea existed.  Now that I've worked through all of this, there's only one thing left to do.  As Hartl says at the end of Chapter one:   "All that's left is to,  you know, actually start learning Rails"  (Kindle Location 960).  

Yikes.  So I learned the foundation that I was missing, and not realizing I was missing, so that I can begin web development using Rails.  I learned how much there is to know and how much I really don't know.  What I would like to do now is slow down, back up and start moving through this again.  I need to spend some more time researching Git commands and getting to know not only what the commands are, but what those things actually do.  I need to learn more about Gems and how they really work within the greater framework of Ruby and Ruby on Rails.  What do they do?  Once I get some foundation under me, then I can start really playing in Rails.  But, alas, I really needed to learn to crawl before I started trying to jog.  Or Joggle, which might be a better description of what I was trying to accomplish.  

In the future, I still would like to develop a web application from the ground up, but I've got quite a bit of growing to do first.  That--and I need to find myself some Rails nerds to hang out with.  The forums are useful, but they only go so far.


Hartl, Michael Ruby on Rails 3 Tutorial: Learn Rails by Example. Pearson Education, 2010.  Kindle Edition.

1 comment:

  1. Not only did I laugh about you skipping the line (and then going back and finding it so you could quote it), I snorted! One of the reasons I also like doing these type of activities is because it reminds us of how are students are sometimes feeling. We're college professors because this came easy to us; it's humbling to be back in the "wow, this is tough" seat!