Search
Categories
Ad

Posts Tagged ‘rubygems’

mw: printing variables to Growl using Meow

Sunday, November 29th, 2009
mw

mw

Today I uploaded a new Rubygem called “mw” (pronounced as [mi'u]).

mw is a tiny useful library to output the result of pp to Growl.The original idea of Growl printing comes from jugyo’s g. Though the concept is great, g does not work on my environment. I’ve got “connection errors” from Growl.
I suspect that “ruby-growl” library on my machine does not work well.

Anyway, to overcome this problem, I reinvented the same feature using Meow, a Growl notification wrapper for the rb-cocoa environment.

INSTALL

First, you need to be a Mac-user, and have installed rb-cocoa.

port install rb-cocoa

Sinece I uploaded mw.gem to gemcutter.org, installing mw is as easy as

gem install gemcutter
gem tumble
gem install mw

USAGE

require 'mw'
mw "message"
mw YourClass.new

To change priority, you can use mw1~5. (mw3 is normal, mw1 is the lowest, and mw5 is the highest. mw4 and mw5 will fire the sticky notes, so that the note will live on your screen persitently.

begin
do_dangerous_and_raise_some_exception
rescue => e
mw4 e
end

SOURCES

all the sources can be seen at http://github.com/tomoya55/mw.

NOTES

1. If you are still not sure what mw is, please take a look at jugyo’s presentation of g.

2. My mw requires rb-cocoa and meow. If you runs ruby on Linux or Windows, you cannot use this library. use g instead.

Stop installing rubygems to your home directory when you don’t “sudo”

Thursday, August 6th, 2009

Problem

You don’t want to install rubygems under your home direcotry(~/.gem/ruby/1.x/) when you just forgot to “sudo” and don’t have right permissions to write to system directories.

Solution

First, You need to install rubygems newer than 1.3.2. To check the version, type as

gem -v
1.3.1

To update your gems itself, type as

sudo gem update --system

Next, you need to edit your ~/.gemrc file. Add

gem:  --no-user-install

at the bottom of the file.

Now, if you forgot to “sudo” when installing new rubygems, gem will simply fail with permission erros, like

tomoya@hongkong% gem install sequel
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/local/lib/ruby/gems/1.8 directory.

gisty for gist and gisty for Ruby1.9.1

Sunday, June 14th, 2009

Introduction

gist is a simple web service by github for posting and sharing your cool code snippets. gisty is a command-line client for gist.

Installation of gisty

sudo gem install nokogiri
sudo gem sources -a http://gems.github.com
sudo gem install swdyh-gisty

Usage

Posting a source code is as easy as

 gisty post hello.c world.c

Also, you can ‘clone’ all your code snippets.

 gisty sync

For more information, type

 gisty help





And the problem is…

Problem

gisty does not work with Ruby1.9.1.

Solution

I made a forked version of gisty on github repos. Soon, you will be able to download this version

sudo gem install tomoya55-gisty

Notice: you cannot install tomoya55-gisty at this moment. I am now investigating what is going on on my gems. Thank you.