DEV Community

Alex Kharouk
Alex Kharouk

Posted on

Using Ruby for projects that are not Rails related.

I'm currently learning Ruby in preparation for a boot camp I'm applying to. What can I create with Ruby that doesn't involve Rails?

As a beginner, I'm also curious what people use Ruby for nowadays when they're not using it for Rails (or Sinatra). Would love to work on a project this weekend!

Thanks and enjoy your day.

Top comments (18)

Collapse
 
ghost profile image
Ghost • Edited

I have written several large projects using Ruby in the console including an application to manage the robotic delivery of parts to a production line, controlling PLC's based on database values in a steel manufacturing plant, and of course, a myriad of micro-services all still running out in the wild. On a personal note, I have built a ruby based weather station (using a raspberry pi and a Sparkfun sensor kit) that uploads the current conditions at our flying field to the club's website. Also, I write various console utilities to help me do my work during the day. I enjoy writing Ruby, it is such a versatile language.

Collapse
 
kharouk profile image
Alex Kharouk

Wow Mike, that sounds very impressive. Just goes to show how little I know the language can do at this beginner stage.

Regarding your weather station, that sounds very creative. How long did it take you to work on it? How were you even able to begin the thought process of creating something so elaborate?

Super curious stuff. Thanks for sharing.

Collapse
 
ghost profile image
Ghost • Edited

Hi Alex,

The Raspberry Pi has a bus that you can get the data from the sensors easily. Once you get that worked out it's just a matter of dealing with the data (in this case writing it out to a JSON file that gets uploaded every 15 minutes. It actually was a fairly simple application to write. There are several gems out there that help you deal with the bus and FTPing. Been toying with the idea of making the application open source but have not had much time to get it all cleaned up and optimized. My advice for finding a project you can practice your Ruby skills with is to look for problems around the house, school, or job that you can solve with automation and dig in!

Good luck,

Collapse
 
feifanz profile image
Feifan Zhou • Edited

Ruby is my go-to language anytime I need to just write some code to do something — perhaps cleaning up some messy data and output a CSV. Or running some quick stats on my bank transactions for the month or year. Or chaining a bunch of other things to get something done. I love Ruby's expressive syntax (which makes it fun to work with) and extensive built-in library (unlike Node, which means I don't need to install packages and learn how some library works to get something done).

Collapse
 
kharouk profile image
Alex Kharouk

You sound like one of those guys who can solve problems easily. These are some awesome things you can do!

It almost makes me want a book similar to Automate the Boring Stuff with Python but for Ruby... Any chance you know something like that Feifan?

Collapse
 
feifanz profile image
Feifan Zhou

Oh wow! I hadn't heard of that book until now, but it seems really cool. I don't know of any books like that for Ruby, although I could be convinced to write some stuff in that direction given an audience. For example, I was trying to find something in my iMessages history a few months ago, so I created a tool that made it easier than scrolling through the Messages app and wrote about it: feifan.blog/2018/02/19/viewing-ime...

I'm geniunely curious about the first half of your response, because we all live in our heads and perceive the world differently — in your experience, do you think you sometimes have trouble solving (code-related) problems? Or maybe you don't see a problem that you think is solvable with a script?

Collapse
 
ghost profile image
Ghost

You guys take a look at "Wicked Cool Ruby Scripts" by Steve Pugh. It has some great examples of small Ruby programs that solve day to day problems.

nostarch.com/wcruby.htm

It was a great book in getting me to use Ruby in my day to day tasks also like Feifan does.

Good luck!

Collapse
 
burdettelamar profile image
Burdette Lamar

I've used Ruby extensively for automated testing:

Collapse
 
kharouk profile image
Alex Kharouk

Thanks for the links!

Collapse
 
nhh profile image
Niklas • Edited

I wrote my own testing library: github.com/nhh/spectr for fun! 😁 and also a auto reloading nginx: github.com/nhh/skipper Ruby is awesome in all its little things, good project fits are command line tools, or api scripts. Its object oriented so you can fairly handle medium complexity.

Collapse
 
pavonz profile image
Andrea Pavoni

A website scraper :-) it’s something you might need soon or later even in web development. It’s also a good exercise to deal with paginations. Good luck for you bootcamp!

Collapse
 
kharouk profile image
Alex Kharouk

Yes, I tried learning a bit today. I found a few youtube tutorials on how to create a scraper, but mostly for Python. Any chance you know a good resource to learn with Ruby?

Thanks! I think I'll need it.

Collapse
 
pavonz profile image
Andrea Pavoni

I’m afraid but I don’t know any resources except books about ruby in general.
For the scraper, start with pencil and paper to split the logic in steps, then google to find out how to do that step.
Use Nokogiri ruby gem to parse html pages ;-)

Collapse
 
ghost profile image
Ghost

Here you go...

Web Scraping with Ruby and Nokogiri for Beginners

Just a simple Google search for "Web scraping with Ruby" turned up many resources.

Collapse
 
pavonz profile image
Andrea Pavoni

I will be offline for this week, next week I’ll try to remember to send you some scraper I’ve made

Collapse
 
joevans0 profile image
Johnathan E.

I created a web crawler for crawling for static content to CSV for easier site migrations.

Collapse
 
kharouk profile image
Alex Kharouk

That's cool!

Collapse
 
kharouk profile image
Alex Kharouk

Oh, that sounds wonderful. Yes, I should give Sinatra a look. I thought it was like a mini Rails, friendly for beginners I'd imagine.

I enjoyed the video you shared, thank you.