Jump to content

Recommended Posts

Since I love Ruby's fast syntax and ease of use maybe as much as I love Alfred, I decided to give Alfred the power to interpret Ruby, inspired by Altre's Python Interpreter.

Ruby Interpreter also stores the last executed commands so you can re-use them and modify them later (set how much history you want to keep in Alfred Variables).

 

 

00169.png

 

Download from Packal

Edited by dettogatto

Share this post


Link to post

Thanks for the cool tool. History seems to break right away when I try to use it though. Here is the error in debugger:

[2016-06-23 09:48:59][ERROR: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 65.)'. Row (null), Col (null): 'attributes construct error' in XML:
<?xml version="1.0"?>
	<items>
	<item arg="" valid="NO" type="text">
	<title>Ruby</title>
	<subtitle>Write some valid code to execute it</subtitle>
	<subtitle mod="cmd">Write some valid code to execute it</subtitle>
	</item>

		<item valid="NO" type="text" autocomplete=""asdaD".reverse">
		<title>"asdaD".reverse</title>
		<subtitle>History item: enter to use</subtitle>
		<subtitle mod="cmd">History item: enter to use</subtitle>
		<icon>icon_history.png</icon>
		</item>
</items>

Seems to be a parsing issue.

Share this post


Link to post
Right here: <item valid="NO" type="text" autocomplete=""asdaD".reverse">
 
There are quotation marks within the quotation marks.
 
It looks like the workflow doesn't use a real XML library, which it really should.
 
The header is also suboptimal: <?xml version="1.0"?>
 
Should be: <?xml version="1.0" encoding="utf-8"?>
 

 

Otherwise the workflow will die in flames when given non-ASCII input.

Share this post


Link to post

Thank you for the feedback! Being new with Alfred every input that makes me learn something new is welcome!

I didn't want to use XML libraries to avoid dependancies...

I just found out that I already fixed the history issue, but, having some problems with PackAl, I wasn't able to update to the latest version.

Try to update it now, everything should work, otherwise let me know!

Edited by dettogatto

Share this post


Link to post

I didn't want to use XML libraries to avoid dependancies...

 

 

Unfortunately, generating valid XML isn't as simple as it looks. If you don't use a library, it's very likely that you/your users are going to keep running into issues with invalid XML, like the one above.

 

Doesn't Ruby have an XML library built in? What about JSON? Alfred 3 understands JSON, too.

Share this post


Link to post

I followed your suggestions and updated my AWF to use REXML library (such a pain not to use Nokogiri to avoid dependancies!)

Now you can use UTF-8 chars with no trouble (I hope)

Thank you agin for your tips and feedback!

 

00170.png

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