« @nifty投票 | メイン | 環境変数を簡単に変更する »

2007年07月07日

JRubyを使ってみる 其の2

お次はgemをインストールする。

と普通のRubyだと行くとこだけど、JRubyははじめからgemが使える。

ただ、既に通常のRuby環境が整っている状態だと"gem"としても

JRuby側のgemでは無く通常のgemのが動いてしまう。

なので、ココからはJRuby -Sを付けてコマンドを投げていく。

参考にしているのはこのエントリー。サンクスです。

http://d.hatena.ne.jp/maedana/20070615/1181871606

※Ruby環境が無い場合では多分、JRuby -Sはいらないと思うけど、動作確認はしていない。

とりあえず、"JRuby"のgemのバージョン確認

C:\>jruby -S gem -v
0.9.4

gemが正常に動くということでrailsをインストール

C:\>jruby -S gem install railsc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.2.3
Successfully installed activesupport-1.4.2
Successfully installed activerecord-1.15.3
Successfully installed actionpack-1.13.3
Successfully installed actionmailer-1.3.3
Successfully installed actionwebservice-1.2.3
C:\>jruby -S rails -v
Rails 1.2.3

railsが正常に動いた所で早速サンプルアプリを作ってみる。

C:\JRuby\sample_apps>jruby -S rails foo
      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  components
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  script/performance
      create  script/process
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/mocks/development
      create  test/mocks/test
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  Rakefile
      create  README
      create  app/controllers/application.rb
      create  app/helpers/application_helper.rb
      create  test/test_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  public/.htaccess
      create  config/boot.rb
      create  config/environment.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  script/about
      create  script/breakpointer
      create  script/console
      create  script/destroy
      create  script/generate
      create  script/performance/benchmarker
      create  script/performance/profiler
      create  script/process/reaper
      create  script/process/spawner
      create  script/process/inspector
      create  script/runner
      create  script/server
      create  script/plugin
      create  public/dispatch.rb
      create  public/dispatch.cgi
      create  public/dispatch.fcgi
      create  public/404.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log

とりあえず、外枠ができた所でWEBrickを起動してみる。

C:\JRuby\sample_apps>cd foo
C:\JRuby\sample_apps\foo>jruby script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-07-07 23:30:02] INFO  WEBrick 1.3.1
[2007-07-07 23:30:02] INFO  ruby 1.8.5 (2007-06-07) [java]
[2007-07-07 23:30:02] INFO  WEBrick::HTTPServer#start: pid=14737862 port=3000

動作確認。

http://127.0.0.1:3000/

おなじみのWelcom画面が出ればOK。

こんな画面。
http://2ca3.dyndns.org/jruby/Ruby%20on%20Rails%20%20Welcome%20aboard.htm

 

次回はscaffold使ってDBと連係したアプリを作ってみる。

また、ajax_scaffoldというのも楽しそうなので試してみる。

いじょ。

はじめよう Ruby on Rails
はじめよう Ruby on Rails
posted with amazlet on 07.07.07
高橋 征義 かずひこ 喜多川 豪
アスキー (2006/07/03)
売り上げランキング: 7918
おすすめ度の平均: 5.0
5 コンパクト
5 サブとして一冊欲しい本

 

ブログを書くならBlogWrite

投稿者 2ca3 : 2007年07月07日 23:39

トラックバック

このエントリーのトラックバックURL:
http://2ca3.dyndns.org/cgi-bin/mt/mt-tb.cgi/148

コメント

ツッコミしてください




保存しますか?