バリケンのRuby日記 RSSフィード

2009-02-05

[][] Warblerでwarファイルを作る  Warblerでwarファイルを作る - バリケンのRuby日記 を含むブックマーク はてなブックマーク -  Warblerでwarファイルを作る - バリケンのRuby日記  Warblerでwarファイルを作る - バリケンのRuby日記 のブックマークコメント

じゃあ、このあいだの日記でインストールしたWarblerを使って、このあいだ作ったWebアプリをwarファイルにしてみよう!

まずはwarファイルにしたいRailsプロジェクトのディレクトリに移動するよ。

D:\>cd rails

D:\rails>cd cookbook

D:\rails\cookbook>

つぎに、Warblerのconfigファイルを作成するよ。「warble config」と入力してね。

D:\rails\cookbook>warble config
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/gems/warbler-0.9.12/generators/warble/templa
tes/warble.rb config/warble.rb

D:\rails\cookbook>

できあがったconfig/warble.rbを適当なテキストエディタ(メモ帳だと改行コードをうまく解釈できないみたいだから、メモ帳以外のテキストエディタを使ってね)で編集してね。具体的には、このあいだインストールしたactiverecord-jdbcsqlite3-adapterjruby-opensslを指定するよ。

  # Gems to be included. You need to tell Warbler which gems your application needs
  # so that they can be packaged in the war file.
  # The Rails gems are included by default unless the vendor/rails directory is present.
  config.gems += ["activerecord-jdbcsqlite3-adapter", "jruby-openssl"]
  # config.gems << "tzinfo"

あとは「warble war」と入力すれば、必要なファイルを集めてwarファイルを作ってくれるよ。

D:\rails\cookbook>warble war
mkdir -p tmp/war/WEB-INF/gems/specifications
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/rails-2.2.2.gemspec tmp/war/W
EB-INF/gems/specifications/rails-2.2.2.gemspec
mkdir -p tmp/war/WEB-INF/gems/gems
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/rake-0.8.3.gemspec tmp/war/WE
B-INF/gems/specifications/rake-0.8.3.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/activesupport-2.2.2.gemspec t
mp/war/WEB-INF/gems/specifications/activesupport-2.2.2.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/activerecord-2.2.2.gemspec tm
p/war/WEB-INF/gems/specifications/activerecord-2.2.2.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/actionpack-2.2.2.gemspec tmp/
war/WEB-INF/gems/specifications/actionpack-2.2.2.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/actionmailer-2.2.2.gemspec tm
p/war/WEB-INF/gems/specifications/actionmailer-2.2.2.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/activeresource-2.2.2.gemspec
tmp/war/WEB-INF/gems/specifications/activeresource-2.2.2.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/activerecord-jdbcsqlite3-adap
ter-0.9.gemspec tmp/war/WEB-INF/gems/specifications/activerecord-jdbcsqlite3-ada
pter-0.9.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/activerecord-jdbc-adapter-0.9
.gemspec tmp/war/WEB-INF/gems/specifications/activerecord-jdbc-adapter-0.9.gemsp
ec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/jdbc-sqlite3-3.5.8.gemspec tm
p/war/WEB-INF/gems/specifications/jdbc-sqlite3-3.5.8.gemspec
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/specifications/jruby-openssl-0.3.gemspec tmp
/war/WEB-INF/gems/specifications/jruby-openssl-0.3.gemspec
mkdir -p tmp/war/WEB-INF/app
mkdir -p tmp/war/WEB-INF/config
mkdir -p tmp/war/WEB-INF/lib
mkdir -p tmp/war/WEB-INF/log
mkdir -p tmp/war/WEB-INF/vendor
mkdir -p tmp/war/WEB-INF/tmp
mkdir -p tmp/war/WEB-INF/app/controllers
mkdir -p tmp/war/WEB-INF/app/helpers
mkdir -p tmp/war/WEB-INF/app/models
mkdir -p tmp/war/WEB-INF/app/views
cp app/controllers/application.rb tmp/war/WEB-INF/app/controllers/application.rb

cp app/controllers/recipes_controller.rb tmp/war/WEB-INF/app/controllers/recipes
_controller.rb
cp app/helpers/application_helper.rb tmp/war/WEB-INF/app/helpers/application_hel
per.rb
cp app/helpers/recipes_helper.rb tmp/war/WEB-INF/app/helpers/recipes_helper.rb
cp app/models/recipe.rb tmp/war/WEB-INF/app/models/recipe.rb
mkdir -p tmp/war/WEB-INF/app/views/layouts
mkdir -p tmp/war/WEB-INF/app/views/recipes
cp app/views/layouts/recipes.html.erb tmp/war/WEB-INF/app/views/layouts/recipes.
html.erb
cp app/views/recipes/edit.html.erb tmp/war/WEB-INF/app/views/recipes/edit.html.e
rb
cp app/views/recipes/index.html.erb tmp/war/WEB-INF/app/views/recipes/index.html
.erb
cp app/views/recipes/new.html.erb tmp/war/WEB-INF/app/views/recipes/new.html.erb

cp app/views/recipes/show.html.erb tmp/war/WEB-INF/app/views/recipes/show.html.e
rb
cp config/boot.rb tmp/war/WEB-INF/config/boot.rb
cp config/database.yml tmp/war/WEB-INF/config/database.yml
cp config/environment.rb tmp/war/WEB-INF/config/environment.rb
mkdir -p tmp/war/WEB-INF/config/environments
mkdir -p tmp/war/WEB-INF/config/initializers
mkdir -p tmp/war/WEB-INF/config/locales
cp config/routes.rb tmp/war/WEB-INF/config/routes.rb
cp config/warble.rb tmp/war/WEB-INF/config/warble.rb
cp config/environments/development.rb tmp/war/WEB-INF/config/environments/develo
pment.rb
cp config/environments/production.rb tmp/war/WEB-INF/config/environments/product
ion.rb
cp config/environments/test.rb tmp/war/WEB-INF/config/environments/test.rb
cp config/initializers/inflections.rb tmp/war/WEB-INF/config/initializers/inflec
tions.rb
cp config/initializers/mime_types.rb tmp/war/WEB-INF/config/initializers/mime_ty
pes.rb
cp config/initializers/new_rails_defaults.rb tmp/war/WEB-INF/config/initializers
/new_rails_defaults.rb
cp config/locales/en.yml tmp/war/WEB-INF/config/locales/en.yml
mkdir -p tmp/war/WEB-INF/lib/tasks
mkdir -p tmp/war/WEB-INF/vendor/plugins
mkdir -p tmp/war/WEB-INF/tmp/cache
mkdir -p tmp/war/WEB-INF/tmp/pids
mkdir -p tmp/war/WEB-INF/tmp/sessions
mkdir -p tmp/war/WEB-INF/tmp/sockets
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/gems/warbler-0.9.12/lib/jruby-complete-1.1.6
.jar tmp/war/WEB-INF/lib/jruby-complete-1.1.6.jar
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/gems/warbler-0.9.12/lib/jruby-complete-1.1.6
.jar tmp/war/WEB-INF/lib/jruby-complete-1.1.6.jar
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/gems/warbler-0.9.12/lib/jruby-rack-0.9.3.jar
 tmp/war/WEB-INF/lib/jruby-rack-0.9.3.jar
cp D:/jruby-1.1.6/lib/ruby/gems/1.8/gems/warbler-0.9.12/lib/jruby-rack-0.9.3.jar
 tmp/war/WEB-INF/lib/jruby-rack-0.9.3.jar
cp public/404.html tmp/war/404.html
cp public/422.html tmp/war/422.html
cp public/500.html tmp/war/500.html
cp public/dispatch.cgi tmp/war/dispatch.cgi
cp public/dispatch.fcgi tmp/war/dispatch.fcgi
cp public/dispatch.rb tmp/war/dispatch.rb
cp public/favicon.ico tmp/war/favicon.ico
mkdir -p tmp/war/images
cp public/index.html tmp/war/index.html
mkdir -p tmp/war/javascripts
cp public/robots.txt tmp/war/robots.txt
mkdir -p tmp/war/stylesheets
cp public/images/rails.png tmp/war/images/rails.png
cp public/javascripts/application.js tmp/war/javascripts/application.js
cp public/javascripts/controls.js tmp/war/javascripts/controls.js
cp public/javascripts/dragdrop.js tmp/war/javascripts/dragdrop.js
cp public/javascripts/effects.js tmp/war/javascripts/effects.js
cp public/javascripts/prototype.js tmp/war/javascripts/prototype.js
cp public/stylesheets/scaffold.css tmp/war/stylesheets/scaffold.css
mkdir -p tmp/war/WEB-INF

D:\rails\cookbook>

プロジェクトのディレクトリに「cookbook.war」というファイルができているはずだよ。

トラックバック - http://rubyist.g.hatena.ne.jp/muscovyduck/20090205