Jump to content

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!

Link to comment

 

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.

Link to comment

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

Link to comment

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 :)

Link to comment

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).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...