今install railsすると2.1.1が入ってしまうが2.1.0を使いたい場合。 gem install RubyInline --version '= 2.1.0'

posted by Face ysakaki on Tue 9 Sep 2008 at 14:13 with 1 comment

以前書いたprawnの記事ですが、その時のgemは0.1.2でした。で色々ggってソースを読んでいくうちにどうやら最新だと:wrap => :characterオプションがあることがわかりました。というわけでgithubからインストールした時のメモです。

gems.githubにない

http://gems.github.com/list.html
を見てもprawnはありません。ということでcloneしてインストールすることにしました。

cloneしてgemを生成, インストール

   1  $git clone git://github.com/raggi/prawn.git prawn.git
   2  $ cd prawn.git
   3  $ rake gem
   4  $ ls pkg/prawn-0.1.99.gem
   5  pkg/prawn-0.1.99.gem
   6  $sudo gem install pkg/prawn-0.1.99.gem
   7  $gem search prawn
   8  
   9  *** LOCAL GEMS ***
  10  prawn (0.1.99, 0.1.2)

gemのバージョンについて

prawnのバージョンが0.1.99とでていますが、あくまでもpre-0.2としての位置づけだそうで(作者のsandalさんに教えてもらった)、バグ報告などの場合は、git logで表示されるcommitの後のSHA1をバージョンとして用いるそうです。

   1  $git log
   2  commit c92a03685cd013af8767e7327b3a5def74a0a2ff
   3  Date:   Wed Aug 20 17:45:18 2008 -0400
   4  
   5      Minimal changes to support character based wrapping

posted by Png satoko on Tue 9 Sep 2008 at 11:13

メモ:今git addしたファイルをコミットやめと思ったときに。

   1  git add vendor/gems/prawn-0.1.99.gem
   2  git rm --cached vendor/gems/prawn-0.1.99.gem

ちなみに -f をつけるとリポジトリから削除されると同時にファイルも削除されます:

   1  git rm -f vendor/gems/prawn-0.1.99.gem

posted by Png satoko on Tue 9 Sep 2008 at 10:55 with 2 comments

Hi all, long time no see ;-)

GoogleからChromeが出たので、久しぶりに動作確認作業などのメンテナンスを行い、Rails-2.1.1対応などの修正を加え、バージョン3.2.7をリリースいたします。

Thank you for your patience.

See Also

posted by Png genki on Tue 9 Sep 2008 at 09:18 with 2 comments

Gist がUbiquityコマンドのインストールに対応してくれたので、 Gist Ubiquitiferの役目は終わったかなと思ったのですが、 ダウンロード数やPV、Ratingなんかがわかると嬉しいかもしれない、ということで、ちょっとだけ機能追加してみました。

Sample Page

GistもそこまでUbiquity専用に機能追加するとも思えないので、 Ubiquity専用サービスである利点を生かしてみました。

そのうち評判が高い順のリストを表示するようにしようかと思います。

posted by Png genki on Mon 8 Sep 2008 at 10:05

Gist Ubiquitifierは、 Ubiquityコマンドを配布するためのサーバが無くても、 気軽にUbiquityコマンドを配布できるようにするためのサービスです。

このたび、拡張パラメータを指定することによって、 コマンドのインストールページをカスタマイズできるようになりました。

例えば、以下のように、QueryStringにパラメータを指定します。

http://ubiquity.s21g.com/7630?name=s21g-blog-search&Author=Genki+Takiuchi&Home+Page=http://blog.s21g.com/genki

name以外のパラメータは、インストールページ上で 表示されるだけで、実際のインストールの動作には影響しません。

posted by Png genki on Sun 7 Sep 2008 at 07:58

Capistranoを使って、デプロイ時に必要なGemをインストールさせる方法を紹介します。

Rails-2.1以降、config/environment.rbで、config.gemを指定することによって、アプリケーションが依存するGemを簡単に指定することができるようになりました。 また、ここで指定したGemは、

   1  % sudo rake gems:install

とするだけで、インストールすることができます。

しかし、今のところ、capistranoでデプロイするときに この設定を考慮して自動的に足りないGemをインストールしてくれたりすることはないので、ちょっと残念な感じでした。

そこで、cap deployを実行した時に、必要なGemをサーバ上でインストールさせるためのレシピを紹介します。

config/deploy.rb

   1  namespace :deploy do
   2    task :restart, :roles => :app do
   3      sudo "rake -f #{current_path}/Rakefile gems:install"
   4    end
   5  end

上記のように、deploy:restartのタスクで、Rakeコマンドを実行させるだけです。 簡単ですね。

posted by Png genki on Sun 7 Sep 2008 at 06:43

s21g blog の次はFormula

今度はtridentを実行した結果、以下のようなWARNINGが出ました。

DEPRECATION WARNING: Inflector is deprecated! Use ActiveSupport::Inflector instead. See http://www.rubyonrails.org/deprecation for details. (called from formula/config/initializers/inflections.rb:5)

なるほど。とりあえず、いわれたとおりに修正してみます。 Globalの名前空間を掃除する方向なのかな。

とりあえず、それ以外は特に問題なく移行完了。

posted by Png genki on Sun 7 Sep 2008 at 03:34

s21gブログを動かしているEC2インスタンスのRailsを 2.1.1にバージョンアップしました。

Rails 2.1.1: Lots of bug fixes

Rails 2.1.1 is another maintenance release that includes a bunch of bug fixes and a fix for the REXML vulnerability. I’ve extracted all the changes from the CHANGELOGs into a single Gist. Enjoy!

以下、バージョンアップに関する作業ログです。 まずは trident を立ち上げると以下のようなWARNINGが。

DEPRECATION WARNING: Dependencies is deprecated! Use ActiveSupport::Dependencies instead. See http://www.rubyonrails.org/deprecation for details. (called from evaluate_init_rb at blog/vendor/plugins/background_fu/init.rb:1)

とりあえず最新版のBackgroundFu をあたってみます。 いつの間にかGemPluginになってる。よしよし。

config/environment.rbに以下を追記。

   1    config.gem 'ncr-background_fu',
   2      :lib => 'background_fu',
   3      :source => 'http://gems.github.com'

そして

   1  % sudo rake gems:install

そして不要になったプラグインを削除。

   1  % ./script/plugin remove background_fu
   2  svn: '/home/takiuchi/blog/vendor/plugins' is not a working copy

おっと。script/plugin removeはまだGitには対応してないのかな? しかし警告メッセージは出ましたが、当該ディレクトリはきちんと削除されていた模様。 もう一度tridentを立ち上げるが、また同様の警告が出た。 ということで、background_fuを forkすることにした

config/environment.rbを書き直す。

   1    config.gem 'genki-background_fu',
   2      :lib => 'background_fu',
   3      :source => 'http://gems.github.com'

これで警告は出なくなった。 rake -Tは特に問題なく実行できる。 rake testを実行。

DEPRECATION WARNING: follow_redirect is deprecated and will be removed from Rails 2.2 (If you wish to follow redirects, you should use integration tests) See http://www.rubyonrails.org/deprecation for details. (called from test_cleaning_up_blank_page at ./test/functional/articles_controller_test.rb:305)

とのこと。follow_redirectを使いたい場合は インテグレーションテストを使ってね、ということらしい。 いわれてみればその通りですね。 これを機にIntegrationTest周りのサポートが充実すると嬉しい。

とりあえず、該当箇所をIntegrationTestに切り出すことに。 その前にscript/generateコマンドがUpdateされてる可能性があったので、 rake rails:updateを実行してみたが、config/boot.rbが数行変わっただけであった。どうやらRubyGemsの最低要求バージョンが1.1.1以降となった模様。

IntegrationTestでは、follow_redirectではなく、follow_redirect! を使う必要があった。 と、ここまででテストでのWARNINGもすべて解消。

あとはローカル環境で動作テストをした後に、 cap shellで必要なGemをインストールしてcap deploy

WARNINGを消すためにひと手間かかりましたが、 基本的には特に大きな修正も必要なくアップグレードできました。

posted by Png genki on Sun 7 Sep 2008 at 01:58

最近、 NeverBlock の周辺の動きが面白い。

What is it all about?

NeverBlock is a Ruby library that allows developers to write non-blocking, concurrent code in a transparent manner. Meaning that you will keep coding in your traditional ways while you get the benefit of non-blocking IO operations.

LL futureの講演者控え室で、まつもとさん、高橋さんから、 その辺の話を伺う機会がありましたが、 NeverBlockはRuby-1.9普及の引き金になるかもしれない。 なぜなら、NeverBlockはRuby-1.9のFiberに依存したライブラリで、 Ruby-1.9が無いと利用できないからだ。

Building the Never Blocking Rails, Making Rails 12X Faster

They told you it can't be done, they told you it has no scale. They told you lies!

What if you suddenly had the ability to serve mutliple concurrent requests in a single Rails instance? What if you had the ability to multiplex IO operations from a single Rails instance?

No more what ifs. It has been done.

NeverBlockを使うとRailsが12倍速くなるらしい。

MySQLPlus: A Non-Blocking MySQL Driver for Ruby 1.8 and 1.9

MySQLPlus is billed as a new general purpose MySQL driver that supports "threaded access and async operations"

NeverBlockを使うために作られたMySQL用の新しいドライバらしい。

See Also

posted by Png genki on Thu 4 Sep 2008 at 09:32