Just another Ruby porter,

〜2008年9月下旬〜


<Prev(,) | Next(.)> | Recent(/)>> | RDF

2008-09-21 (Sun)

[Ruby] gemのパッケージを展開する

Gem::Installer#unpackを使うと簡単です。

require "rubygems/installer"
Gem::Installer.new("classx-0.0.4.gem").unpack("classx-0.0.4")

コマンドラインのほうがもっと簡単。

% gem unpack classx-0.0.4.gem 
Unpacked gem: '/tmp/classx-0.0.4'
% ls classx-0.0.4
ChangeLog  README  Rakefile  bench  doc  example  lib  spec  tasks

見てわかるとおり上はこっちから逆に導き出したもんなんだけど。


2008-09-22 (Mon)

[C] CSpec : Behavior-driven development in C

これはどうだろうねえ。

Overview
CSpec is a Behavior-driven Development framework for C. It provides a spec framework for describing the behavior of the functions of your system. The syntax is inspired from RSpec to be as legible as possible. The source code is as portable and as light as possible to make it easy to run the library on embedded devices.

例を見るとちょっと無理があるような。

#include <stdio.h>
#include <string.h>
#include "cspec.h" 
#include "cspec_output_verbose.h" 

DESCRIBE(strcmp, "int strcmp ( const char * str1, const char * str2 )")

    IT( "returns 0 only when strings are equal" )
        SHOULD_EQUAL( strcmp("hello", "hello"), 0)
        SHOULD_NOT_EQUAL( strcmp("hello", "world"), 0)
    END_IT

    IT( "returns a negative integer when str1 is less than str2"  )
        SHOULD_BE_TRUE( strcmp("hello", "world") < 0 )
        SHOULD_BE_TRUE( strcmp("0123", "1321431") < 0 )
    END_IT

    IT( "returns a positive integer if str1 is greater than str2"  )
        SHOULD_BE_TRUE( strcmp("yellow", "world") > 0 )
        SHOULD_BE_TRUE( strcmp("9", "789") > 0 )
    END_IT

END_DESCRIBE

void main()
{
    CSpec_Run( DESCRIPTION( strcmp ), CSpec_NewOutputVerbose() );
}

2008-09-23 (Tue)

[Golf] Easter

とても面倒だってことがわかった。
とりあえずgoodfriday.rbを参考に。


2008-09-24 (Wed)

[Soft] Lzip 0.4

すでにlzmaコマンドがあるのになあ。

About:
Lzip is a lossless data compressor based on the LZMA algorithm, with very safe integrity checking and a user interface almost identical to the one of bzip2. Lzip is only a data compressor, not an archiver. It has no facilities for multiple files, encryption, or archive-splitting, but, in the Unix tradition, relies instead on separate external utilities such as GNU Tar for these tasks.

2008-09-25 (Thu)

[Ruby] Guy Decoux

かなりショック。哀悼の意を表す。


2008-09-26 (Fri)

[Gmail] Never send it to Spam

なにげなくSettingのFilterを見てたらNever send it to Spamってのが増えてた。
ruby-talk MLはラベルをつけるとともにこれをチェックしとこう。


2008-09-27 (Sat)

[Zsh] ${^spec}

これはなかなか役に立ちそう。man zshexpnより:

${^spec}
Turn on the RC_EXPAND_PARAM option for the evaluation of spec; if the ‘^’ is doubled, turn it off. When this option is set, array expansions of the form foo${xx}bar, where the parameter xx is set to (a b c), are substituted with ‘fooabar foobbar foocbar’ instead of the default ‘fooa b cbar’.
Internally, each such expansion is converted into the equivalent list for brace expansion. E.g., ${^var} becomes {$var[1],$var[2],...}, and is processed as described in the section ‘Brace Expansion’ below. If word splitting is also in effect the $var[N] may themselves be split into different list elements.

つまり

% a=(a b c)
% b=(1 2 3)
% echo $^a$^b
a1 a2 a3 b1 b2 b3 c1 c2 c3

という感じになる。

[Zsh] Re: コマンドラインで連番のファイル名を作る

で、思い出したけどzshだったら

% print -l access_log.200801{01..27}

でok。0つけるだけで認識してくれるんだから賢いよな、zsh。


2008-09-28 (Sun)

[SSH] ControlMaster auto

どういうわけかci.ruby-lang.orgのソケットファイルが残ってしまって、

Control socket connect(/home/eban/.ssh/master-svn@ci.ruby-lang.org:22): Connection refused
ControlSocket /home/eban/.ssh/master-svn@ci.ruby-lang.org:22 already exists, disabling multiplexing

と文句言われることが多い。
Host *でControlMaster autoにしてるのが悪いわけで、ciはnoにしとこう。


2008-09-29 (Mon)

[TV] チー

終わったようだ。毎日楽しみにしてたのに。


2008-09-30 (Tue)

[TV] 夏目友人帳

この雰囲気は癒やされる。2期もありかな。

[Cygwin] Updated: vim-7.2-2

iconvがenableになったから上げよう。


<Prev(,) | Next(.)> | Recent(/)>> | RDF


WWW を検索 jarp.does.notwork.org を検索

わたなべひろふみ
Key fingerprint = C456 1350 085F A320 C6C8 8A36 0F15 9B2E EB12 3885
Valid HTML 4.01!