Warbler, A Little Birdie To Introduce Your Rails App To Java

Warbler, A Little Birdie To Introduce Your Rails App To Java

Warbler, A Little Birdie To Introduce Your Rails App To Java

Posted by Nick Sieger
on 2007年9月4日

This week I was working on integrating the latest JRuby 1.0.1 and Goldspike 1.3 releases into our environment, when my frustration hit a fever pitch.

See, I had always thought that the .war packaging side of Goldspike was a little clunky and
un-ruby-like, but I didn’t see a clear path to fixing it. I had heard little complaints about it here
and there: the little configuration DSL didn’t give you enough control or wasn’t documented well
enough; the fact that it downloads libraries from the internet during assembly (convenient, but not
safe or reproducible for production deployments).

Also, in my own opinion it took the wrong approach to packaging Rails in a .war file. It puts the
Rails application directory structure into the root of the .war file where any web server or Java
application server might mistakenly serve up your code as static content. The Java .war file spec has
this special directory called WEB-INF expressly for the purpose of hiding that stuff away, so why
not use it?

And then, suddenly Goldspike was packaging up my entire Rails application directory, .svn directories
and everything. So I set out to fix this once and for all.

And so I present Warbler. A little bird who chirpily steps up to the task of assembling your
Rails application into a Java Web Archive (.war). Here, get it:

gem install warbler

And then, in the top directory of your Rails application,

warble

Those two steps are all it takes to make a .war file, including your application and recent versions
of JRuby and Goldspike, that’s deployable to your favorite Java application server.

There are a number of points about Warbler worth mentioning.

Does one thing, well

Warbler only packages, and doesn’t care about anything else, like how to dispatch servlet requests to
Rails. This will allow for more runtime servlet binding mechanisms to take advantage of Warbler in
the future.

Fast and lightweight

50% less code than the Goldspike packaging plugin, yet does the job quickly and efficiently.

Sane defaults

Warbler only packages code that you need to run the application, omitting database migrations and
tests. If your application is self-sufficient (no external dependencies), then the out-of-the-box
configuration will probably work for you. Public HTML/images/javascript/stylesheets go in the root of
the webapp, where Java webservers expect them to be.

Documented, flexible configuration

Need to customize your configuration? Run warble config and edit config/warble.rb. All the
options are there, commented and documented.

Need to change out the bundled JRuby/Goldspike versions? warble pluginize makes a copy of Warbler
in the vendor/plugins area of your application, allowing you to change the .jar files in the
vendor/plugins/warbler-0.9/lib directory. Warbler then makes his nest in your project’s list of
rake tasks (as rake -T | grep war shows)

rake war            # Create trunk.war
rake war:app        # Copy all application files into the .war
rake war:clean      # Clean up the .war file and the staging area
rake war:gems       # Unpack all gems into WEB-INF/gems
rake war:jar        # Run the jar command to create the .war
rake war:java_libs  # Copy all java libraries into the .war
rake war:public     # Copy all public HTML files to the root of the .war
rake war:webxml     # Generate a web.xml file for the webapp

Warbler even omits himself in the .war file produced when running in plugin mode, since you won’t
need him at runtime. It’s the little details that matter.

Give him a try and let me know if it makes your life deploying Rails applications to JRuby on Java appservers easier!

posted on 2012-03-14 23:56 lexus 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/lexus/archive/2012/03/14/2397129.html

Warbler, A Little Birdie To Introduce Your Rails App To Java相关推荐

  1. 第一个 Rails App 从安装到创建(windows版本)

    1. 在以下网址下载并运行 Rails 安装包: 点击打开链接 2. 检查 ruby,sqlite 和 rails 是否安装成功 2.1 查看 ruby 版本, 在命令行中输入: ruby -v 运行 ...

  2. 在你的 Rails App 中开启 ETag 加速页面载入同时节省资源

    转自http://huacnlee.com/blog/use-etag-in-your-rails-app-to-speed-up-loading/ 什么是 ETag 网上关于 ETag 的解释有很多 ...

  3. 5 Ways to Speed Up Your Rails App

    Ruby is a fast language, and a great one in so many ways, but nothing in this world is truly free. I ...

  4. rails 添加外键_如何在Rails后端中添加功能强大的搜索引擎

    rails 添加外键 by Domenico Angilletta 通过多梅尼科·安吉列塔(Domenico Angilletta) In my experience as a Ruby on Rai ...

  5. rails i18n模型_Rails国际化的完整指南(i18n)

    rails i18n模型 by Anastasia 由Anastasia Rails国际化的完整指南(i18n) (The Complete Guide to Rails Internationali ...

  6. Rails工作效率和Java运行平台

    Rails工作效率和Java运行平台 --读<JRuby实战>(Practical JRuby on Rails Web 2.0 Projects) 有感 在Web软件开发方面,Rails ...

  7. Rails安全导读【一】

    原文地址:[url]http://guides.rubyonrails.org/security.html[/url] --------翻译分割线 ,翻译的不好,请多多指正-------- Ruby ...

  8. 在Heroku上部署(托管)Rails项目

    2019独角兽企业重金招聘Python工程师标准>>> ①.安装heroku: $ gem install heroku ②.先要生成一个公钥,使用命令: $ ssh-keygen ...

  9. 如何使用React和Redux前端创建Rails项目

    by Mark Hopson 马克·霍普森(Mark Hopson) 如何使用React和Redux前端(加上Typescript!)创建Rails项目 (How to create a Rails ...

  10. devise tree_Devise如何确保您的Rails应用密码安全

    devise tree by Tiago Alves 由蒂亚戈·阿尔维斯(Tiago Alves) Devise如何确保您的Rails应用密码安全 (How Devise keeps your Rai ...

最新文章

  1. TableStore: 海量结构化数据分层存储方案
  2. 雅虎因性别歧视成被告 不过这次遭歧视的是男性
  3. 2020年推荐系统工程师炼丹手册RecSys版
  4. arm-4-裸板开发
  5. 神策分析 1.13 版本用户分群全新升级,为企业打磨­­­­­­­­­精细化运营基石
  6. Reeder for Chrome:让 Google Reader 更加简洁美观
  7. 通达 oa 2017 mysql 密码,修改通达OA Mysql数据库密码
  8. 好用又免费的英文校对工具!英文写作就要用Wordvice AI
  9. 为什么要做数据分析?数据分析给企业带来了什么?
  10. Beautify Panel 2 for Mac(PS人像磨皮美容插件)中文版
  11. CVE-2017-0199漏洞分析
  12. Deployer 使用问题
  13. 这里也有计算机房英语,这里也有风景_800字
  14. 性能测试结果分析结果
  15. 【毕业设计】基于stm32的示波器设计与实现 - 单片机 嵌入式
  16. 2021高考成绩查询抖音,2021抖音高考最后倒计时励志句子
  17. 零基础零代码实现可视化报表
  18. 爬虫学习(16):selenium自动化测试:人为模拟滑块移动
  19. 2021.03.30【2021省赛】模拟 比赛总结
  20. ANN神经网络车牌识别

热门文章

  1. 四大里snr是什么职位_四大会计师事务所人员流动性高的原因是什么?
  2. Intellij idea keymap
  3. 小米手机 root权限 获取
  4. 如何更改iPhone备份和iTunes MobileSync备份文件夹的位置
  5. word按标题自动生成序号
  6. 学计算机的人掉头发吗,学计算机真的会秃顶吗?为什么?
  7. android 5.0rom官方,Android 5.0刷机包开放下载 升级需谨慎
  8. Python爬取百度文库的内容输出
  9. IBM与广东中医院 携手共建智慧医疗
  10. 外卖行业现状分析_2019年中国外卖行业市场现状与发展趋势分析