Hello, Merbists!

Today, I explain how to develop Merb apps that runs on GAE/J environment by using dm-datastore-adapter.

First of all, here is whole source code of an example app. Please check it out.

After checking it out, you must edit appengine-web.xml file. Open it by editor and change the application name to yours. And then you should make war directory by typing this command.

   1  MERB_ROOT% jruby -S warble war

It generates files under tmp/war.

So far, you are ready to deploy this app to GAE/J Of course, you need an account of GAE/J to do it. Please get it in advance :-)

Let us go to deploy by this command.

   1  MERB_ROOT% appcfg.sh update -e {youraccount@gmail.com} tmp/war  

This process takes a time for the first time. If the log didn't say any errors, you got success!

Now your first Merb app on GAE/J is here at http://{your app name}.appspot.com/

Congrats!

Further improvement is your home work :-p

APPENDIX

All required gems are being packed into jar file located at lib/merb.jar. This enables you to pass the limit of which you can upload only 1000 files to GAE. If you add more gems to the jar file, you can do it like this

  • unpacking it
  • add gems
  • and repack it

Enjoy!

posted by Png takiuchi on Thu 23 Apr 2009 at 23:32 with 2 comments
posted by Png genki on Thu 23 Apr 2009 at 21:12

Rails勉強会#40のセッションでも言いましたが、 エラーが発生した時等に表示されるbacktraceの表示は、 コンソールのように上から下に流れる画面上では 通常の逆順のほうが追いやすいと思います。

ということで、ちょっと試しにそのような挙動にしてみました。 以下のようなコードを実行するとテストできます。

   1  class Exception
   2    def set_backtrace(bt)
   3      puts bt.reverse.map{|i|
   4        i.sub(/^([\/\.\w]+):(\d+)/,
   5          "\e[33m\\1\e[m:\e[32m\\2\e[m")
   6      }.join("\n")
   7    end
   8  end
   9  
  10  def foo
  11    raise StandardError
  12  end
  13  
  14  def bar
  15    foo
  16  end
  17  
  18  bar

こんな感じに、エラーが発生した場所に近い順に、 下から上にたどっていく感じに表示されます。

ss

上から下のbacktraceに目が慣れてしまっているので、最初は追いかけにくさを感じますが、一旦慣れてしまえば、スタックが深くて相当スクロールアップしなければエラーの発生源までたどり着けないという場合には良さそうな気がします。

stackという概念のイメージのせいで、新しいものが上の方に来るようになっているのだと思いますが、実用上は新しいものが下にくるこのスタイルの方が便利ではないでしょうか。

posted by Png genki on Thu 23 Apr 2009 at 14:27 with 2 comments
Contents
How to Make A Merb App on Google App Engine
Cloud Computingに関する論文のメモ
backtraceの表示は逆順の方が便利
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ