#chiroito ’s blog

Java を中心とした趣味の技術について

開発環境でのGAE+Ruby+Railsプロジェクトの起動

以前、Google App Engine SDK1.4.0とRuby on Rails 2.3.11、Ruby1.8.7という環境でプロジェクト作成を行いましが、今回はそのプロジェクトを開発環境上で起動してみます。

プロジェクトの作成はこちらGAE+Ruby+Railsプロジェクト作成 on Windows -2.3.11版-

目的

GAE用JRuby on Rails2.3.11のプロジェクトを開発環境上で起動する。

環境

Windows7 Ultimate SP1
Ruby 1.8.7(C:/Ruby187にインストール済み)
appengine-sdk 1.4.2
Ruby on Rails 2.3.11
プロジェクトのパス C:\Users\xxx\gaerails
PATHにC:/Ruby187/binが含まれています。

プロジェクトの起動

起動は非常に簡単です。
dev_appserver.rb.batを実行するだけです。
使用方法は下記の通りです。
C:\Users\xxx>dev_appserver.rb.bat
Usage: [options]

Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=root Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
それでは起動してみます。
基本的にはプロジェクトのあるディレクトリを第一引数に指定するだけです。
(下の2行目にある.は今いるディレクトリを表します)
C:\Users\xxx>cd C:\Users\xxx\gaerails
C:\Users\xxx\gaerails>dev_appserver.rb.bat .
=> Bundling gems
Calculating dependencies...
Updating source: http://gems.rubyforge.org
C:/Ruby187/lib/ruby/gems/1.8/gems/bundler08-0.8.5/lib/bundler08/resolver.rb:115:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement
Caching: actionmailer-2.3.11.gem
Caching: actionpack-2.3.11.gem
Caching: activerecord-2.3.11.gem
Caching: activeresource-2.3.11.gem
Caching: activesupport-2.3.11.gem
Downloading addressable-2.2.4.gem
Caching: appengine-apis-0.0.23.gem
Caching: appengine-rack-0.0.12.gem
Downloading bouncy-castle-java-1.5.0145.2.gem
Downloading dm-appengine-0.1.3.gem
Downloading dm-ar-finders-1.0.2.gem
Downloading dm-core-1.0.2.gem
Downloading dm-timestamps-1.0.2.gem
Downloading dm-validations-1.0.2.gem
Downloading extlib-0.9.15.gem
Downloading jruby-jars-1.6.0.gem
Downloading jruby-openssl-0.7.3.gem
Downloading jruby-rack-1.0.5.gem
Downloading lexidecimal-0.0.1.gem
Downloading rack-1.1.2.gem
Caching: rails-2.3.11.gem
Downloading rails_appengine-0.0.8.gem
Downloading rails_dm_datastore-0.2.16.gem
Caching: rake-0.8.7.gem
Installing activesupport (2.3.11)
Installing extlib (0.9.15)
Installing rails_appengine (0.0.8)
Installing lexidecimal (0.0.1)
Installing bouncy-castle-java (1.5.0145.2)
Installing rack (1.1.2)
Installing actionpack (2.3.11)
Installing actionmailer (2.3.11)
Installing jruby-jars (1.6.0)
Installing jruby-openssl (0.7.3)
Installing dm-appengine (0.1.3)
Installing jruby-rack (1.0.5)
Installing appengine-rack (0.0.12)
Installing appengine-apis (0.0.23)
Installing rake (0.8.7)
Installing addressable (2.2.4)
Installing dm-core (1.0.2)
Installing dm-timestamps (1.0.2)
Installing dm-validations (1.0.2)
Installing dm-ar-finders (1.0.2)
Installing activerecord (2.3.11)
Installing activeresource (2.3.11)
Installing rails (2.3.11)
Installing rails_dm_datastore (0.2.16)
Done.
=> Packaging gems
=> Installing appengine-api-1.0-sdk-1.4.2.jar
=> Installing appengine-api-labs-1.4.2.jar
=> Installing appengine-rack.jar
=> Installing bcmail-jdk15-145.jar
=> Installing bcprov-jdk15-145.jar
=> Installing jruby-core-1.6.0.jar
=> Installing jruby-stdlib-1.6.0.jar
=> Installing jopenssl.jar
=> Installing jruby-rack-1.0.5.jar
=> Skipping update check
=> Booting DevAppServer
=> Press Ctrl-C to shutdown server
2011/03/19 6:57:47 com.google.apphosting.utils.jetty.JettyLogger info
情報: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
2011/03/19 6:57:48 com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
情報: Successfully processed C:/Users/xxx/gaerails/WEB-INF/appengine-web.xml
2011/03/19 6:57:48 com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
情報: Successfully processed C:/Users/xxx/gaerails/WEB-INF/web.xml
2011/03/19 6:57:48 com.google.apphosting.utils.jetty.JettyLogger info
情報: jetty-6.1.x
2011/03/19 6:58:01 com.google.apphosting.utils.jetty.JettyLogger info
情報: Started SelectChannelConnector@127.0.0.1:8080
2011/03/19 6:58:01 com.google.appengine.tools.development.DevAppServerImpl start
情報: The server is running at http://localhost:8080/
これで起動は完了です。

ブラウザでの確認

ブラウザで http://localhost:8080/ へアクセスしてみましょう。
下記の様なページが表示されます。