hopheady
hopheady

Reputation: 37

Ruby Gem or Rails App

I've been playing around with Ruby for a while now and wanted to write my own gem. I wanted to write something simple but useful. My idea was to create a simple console gem that would alert a user when a new post was created in a certain subreddit. Right now it's hardcoded to one subreddit, and I'm using Mac's say command to notify me when there's a new post. My first question is, is this even gem-worthy? I could turn this into a simple Rails app, which might make things logistically easier. But I really wanna write up a gem.

If I do decide to carry on with the project as a gem, there are a few obstacles I have to get past. Right now I'm using whenever to run that runs my script every minute. To update your cron jobs, you have to run whenever --update-crontab in the directory of the project in order to set the cron job. This has become an issue for me, because I would like to be able to make the gem usable on installation without having a user do anything. So instead of having to run the command above, I'd like a user to just be able to download the gem and then, eventually, choose what subreddits and the frequency of the cron job (via a console menu). Sorry for the length of the post, just looking for some input.

Upvotes: 1

Views: 52

Answers (1)

joelparkerhenderson
joelparkerhenderson

Reputation: 35443

My first question is, is this even gem-worthy?

Yes.

I would like to be able to make the gem usable on installation without having a user do anything.

Use a ./bin directory that contains an executable script, that uses a sleep method.

My advice is don't alter the user's cron. Instead, include README help that explains how to cronify your bin executable.

Upvotes: 1

Related Questions