Jump to content
Maddes

Getting started with workflow programming using Ruby

Recommended Posts

Hey Folks,

 

I want to start creating workflows with Ruby for Alfred. I learned basic Ruby on Codecademy and have a little background in developing with Java and Objective-C, so at least OOP is familiar.

However, most content I find on developing with Ruby is kind of centered around the language elements and getting them right. Though I definitely need practice, it is not exactly what I am looking for. I want to gain experience in calling applications / APIs and how to get familiar with new APIs.

You can probably already see how lost I am by how I am describing the topic ;)

 

To wrap it up: I am looking for some tutorials, good coding examples on connecting to APIs with Ruby. Best case would be an integration with a alfred workflow. On the far horizon I want to connect to the GCalendar API to search and create events, but that's just a reference where I want to be somewhen in the future.

 

Thanks for your advice!

Share this post


Link to post

 

This is definitely the simplest way to do things. Past that, in order to write script filters, you just need to read up a bit on how Alfred reads XML and make sure that your code spits out the well-formatted XML that Alfred needs. Ruby gets a bit more complicated if you want to share your workflows because you need to be sensitive to different versions of Ruby that are installed on the systems natively (you can't assume an upgrade), and you should favor natively installed gems over including other ones (installing dependencies is a bit hard to do reliably across many different systems).

 

But, beyond that, you can do much of what you want.

Share this post


Link to post

Hey ctwise, hey Shawn,

 

thanks for your feedback and your code. I'll keep the point about different ruby versions in mind. 

 

However, from a more general point, would it make sense to rather learn python to use the broad range of workflows already written for alfred? At least that is the impression I got when I looked in some workflows I downloaded?

 

Thanks

Maddes

Share this post


Link to post

Hey ctwise, hey Shawn,

 

thanks for your feedback and your code. I'll keep the point about different ruby versions in mind. 

 

However, from a more general point, would it make sense to rather learn python to use the broad range of workflows already written for alfred? At least that is the impression I got when I looked in some workflows I downloaded?

 

Thanks

Maddes

 

This has been asked a few days ago here: http://www.alfredforum.com/topic/8682-screenshot-to-folder-tagger/page-3

Deanishe gave a pretty good answer to that on the following page: http://www.alfredforum.com/topic/8682-screenshot-to-folder-tagger/page-4

which hopefully helps you :)

Share this post


Link to post

Dean's Python library is pretty damn good, and he keeps it better maintained than any other library. If you like Python or if you want to brush up on your Python or if you want to learn Python, then writing workflows with his library is a great way to go.

 

However, if you want to play with more Ruby, then go for it. You could always update the gems and learn from the best practices that Dean implemented with his stuff. The difficulty of Ruby dependencies is actually a bit easier than Python's dependencies (in my opinion).

Share this post


Link to post

The difficulty of Ruby dependencies is actually a bit easier than Python's dependencies (in my opinion).

In what way? They've always seemed very much of a sameness to me (not that I'm particularly familiar with gems).

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...