Working with Ruby by Jan Lelis

gedit external tools: Ruby helpers, git integration and more

With the easy-to-use (and pre-installed) command line utility zenity, it is pretty simple to create useful external tools for gedit!

To use them, just check if the “External Tools” plugin is activated and copy&paste the tools you want into the Tools → Manage External Tools… menu. Alternatively, you can download all files, copy them ~/.gnome2/gedit/tools and they are automatically recognised by the plugin. Make sure to adjust the shortcuts if you choose the second approach.

As I said, zenity is a wonderful easy tool, so don’t hesitate to edit the scripts, for example, if the width of a zenity popup does not suit your screen settings.

Update: Since the code lives on github, I replaced the snippets with screenshots.

Feel free to fork and add new ones ;). There will be another article with more tools in about a month. If I think one tool is pretty useful, I will feature it in the article.

Ruby helpers

[ruby] check syntax

Let’s begin with a simple syntax checker. Hit the shortcut and a little popup will tell you the truth.

[ruby] load into irb

Often you want to run code and further interact with the results. You can do it by requiring the ruby file in an irb session. This tool does this for you.

[ruby] run rake task

This shows a selection dialog with all available rake tasks in the current file’s directory. It runs the selected task in the bottom pane.

[ruby] run capistrano task

Same again, for capistrano.

Simple git integration

Here are some tools for common git actions. They do not aim to cover everything, replacing git command line action. They just try to simplify often done workflow tasks.

[git] status

Hit the shortcut to get the git status of the current file’s git repository.

[git] diff

See what has changed in the current file.

[git] add/commit

This displays a menu with common add/commit tasks. For more complex purposes, you need to do it manually. The number column allows fast shortcuts.

General utilities

Some more tool snippets I find useful.

[selection] crypto hash

Select some text and replace it with a hash value. You can also edit the selected menu entry to choose a different key length for SHA2 or to append salt to the string.

[create] save tabs as tgz

A relaxed way to create a flat .tgz archiv: open all documents which should go in there and start this tool.

[create] export to syntax highlighted html

Get code into a nice html format using coderay ;)

[internet] download url (wget)

Quick access to the internet ;)

Creative Commons License

Comments

LucaB | June 07, 2010

really nice, thank you a lot
the text-editor of choice is probably a matter of taste, habit and casuality
ubuntu is the best platform for ruby and web development (server and client side), and gedit works very well
I spend most of time with them and I'm happy with the results
I suggest to every ruby/rails and in general web-coder, to give them a try

Dimas Cyriaco | July 06, 2010

That was very helpfull. Thank you.

J_Starnes | January 05, 2012

A few changes to git_add-commit.sh which I had a few problems with on ubuntu studio 10.10
on line 20
commit () {
on line 25
res=`git commit ${1}-m "\`zenity --entry --title='git commit' --text='message:' --width=500\`"` && zenity --info --title="git commit $1" --text="$res"
and on line 88
commit -a
note the trailing space on line 88. I don't know if the change on line 20 helped, but the changes on lines 25 and 88 defintly did. Also thank you for using zenity. I had given up looking for a utility to handle similar tasks.

seo | June 08, 2015

Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword....wait there's even more Now what if i told you there was a simple Wordpress plugin that does all the On-Page SEO, and automatically for you? That's right AUTOMATICALLY, just watch this 4minute video for more information at. <a href="http://www.SEORankingLinks.com">Seo Plugin</a>
seo http://www.SEORankingLinks.com/

You? | August 02, 2015