All Projects → jruby → Warbler

jruby / Warbler

Licence: other
Warbler chirpily constructs .war files of your Ruby applications.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Warbler

Javaweb Project Source Share
🌱🚀分享基于Servlet、SSH、SSM、SpringBoot等流行技术实现的JavaWeb项目,难度分为5个等级,帮助小白入门JavaWeb开发,协助JavaWeb开发者熟悉最新技术
Stars: ✭ 229 (-73.06%)
Mutual labels:  servlet, tomcat
Tus Java Server
Library to receive tus v1.0.0 file uploads in a Java server environment
Stars: ✭ 64 (-92.47%)
Mutual labels:  servlet, tomcat
Javaee7 Samples
Java EE 7 Samples
Stars: ✭ 2,470 (+190.59%)
Mutual labels:  servlet, tomcat
Javaee8 Samples
Java EE 8 Samples
Stars: ✭ 333 (-60.82%)
Mutual labels:  servlet, tomcat
Xsbt Web Plugin
Servlet support for sbt
Stars: ✭ 381 (-55.18%)
Mutual labels:  servlet, tomcat
Web
适合java新手入门练习的java web个人网站项目,目前主要维护web-mysql和web-psql两个分支。前台包括博客、代码库、文件下载、留言、登录注册、站内搜索、分类目录等功能,后台包括上传文件、博客、代码,编辑、删除文章,修改个人资料等功能,目前暂停开发新功能。网址:https://demo.hemingsheng.cn ,觉得不错的欢迎 star。 手机版网址:
Stars: ✭ 414 (-51.29%)
Mutual labels:  servlet, tomcat
Jruby Rack
Rack for JRuby and Java appservers
Stars: ✭ 393 (-53.76%)
Mutual labels:  jruby, tomcat
Open Build Service
Build and distribute Linux packages from sources in an automatic, consistent and reproducible way #obs
Stars: ✭ 599 (-29.53%)
Mutual labels:  packaging, ruby-on-rails
Fae
CMS for Rails. For Reals.
Stars: ✭ 701 (-17.53%)
Mutual labels:  ruby-on-rails
Geek Framework
基于SpringBoot+Shiro+Redis+Jwt+Thymeleaf+MyBatis 开发的后台用户、角色、权限、会员管理、RestFul、Token和前台用户登录注册以及前后台用户分离的脚手架,技术交流请加QQ群:805442966
Stars: ✭ 804 (-5.41%)
Mutual labels:  tomcat
Good job
Multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
Stars: ✭ 676 (-20.47%)
Mutual labels:  ruby-on-rails
Railsgoat
A vulnerable version of Rails that follows the OWASP Top 10
Stars: ✭ 699 (-17.76%)
Mutual labels:  ruby-on-rails
Filterrific
Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
Stars: ✭ 810 (-4.71%)
Mutual labels:  ruby-on-rails
Bozon
🛠 Command line tool for building, testing and publishing modern Electron applications
Stars: ✭ 687 (-19.18%)
Mutual labels:  packaging
Invoicing
🧾💰App for issuing invoices, track expenses and managing clients for all the sole traders of New Zealand. That are registered for GST. And can host a Rails app. And are able to configure Google OAuth.
Stars: ✭ 24 (-97.18%)
Mutual labels:  ruby-on-rails
Python For Android
Turn your Python application into an Android APK
Stars: ✭ 6,758 (+695.06%)
Mutual labels:  packaging
Tomcat
Apache Tomcat
Stars: ✭ 5,756 (+577.18%)
Mutual labels:  tomcat
Servletjsptutorial
《Servlet & JSP 技術手冊 - 從 Servlet 到 Spring Boot》相關資源
Stars: ✭ 25 (-97.06%)
Mutual labels:  servlet
Hackathon Manager
All-in-one platform for hackathon registration & logistics.
Stars: ✭ 24 (-97.18%)
Mutual labels:  ruby-on-rails
Graphiti
Stylish Graph APIs
Stars: ✭ 783 (-7.88%)
Mutual labels:  ruby-on-rails

= Warbler {Gem Version}[http://badge.fury.io/rb/warbler] {Build Status}[https://travis-ci.org/jruby/warbler]

Warbler is a gem to make a Java jar or war file out of any Ruby, Rails or Rack application. Warbler provides a minimal, flexible, Ruby-like way to bundle up all of your application files for deployment to a Java environment.

Warbler provides a sane set of out-of-the box defaults that should allow most Ruby applications to assemble and Just Work.

Version 2.x of Warbler supports versions of JRuby from 9.0.0.0 and up.

Version 1.4.x of Warbler supports versions of JRuby up to 1.7.x. The {1.x-dev branch}[https://github.com/jruby/warbler/tree/1.x-dev] is the working code for this.

== Getting Started

  1. Install the gem: gem install warbler.

  2. Run warbler in the top directory of your application: warble.

  3. Choose one:

  • For a web project, deploy your +myapp.war+ file to your favorite Java application server.

  • For a standalone applications, just run it: java -jar myapp.jar.

== Usage

Warbler's +warble+ command is just a small wrapper around Rake with internally defined tasks.

$ warble -T
warble compiled    # Feature: precompile all Ruby files
warble config      # Generate a configuration file to customize your archive
warble executable  # Feature: make an executable archive (runnable + an emb...
warble gemjar      # Feature: package gem repository inside a jar
warble pluginize   # Install Warbler tasks in your Rails application
warble runnable    # Feature: make a runnable archive (e.g. java -jar rails...
warble version     # Display version of Warbler
warble war         # Create the project war file
warble war:clean   # Remove the project war file
warble war:debug   # Dump diagnostic information

Type warble to create the jar or war file.

== Features

Warbler "features" are small Rake tasks that run before the creation of the war file and make manipulations to the archive structure. For instance, the +executable+ feature makes your war file capable of running on its own, without a servlet container (using an embedded web server) :

warble executable war

You can either add features to the warbler command line:

warble FEATURE war

or configure them in config/warble.rb to always be used.

config.features = %w(FEATURE)

Currently, the following features are available :

  • +gemjar+: This bundles all gems into a single gem file to reduce the number of files in the .war. This is mostly useful for Google AppEngine where the number of files per application has a limit. (Note: not applicable for jar-based applications.)
  • +runnable+: This makes a (standard Java) runnable .war archive thus you can execute binary bundled (gem) commands e.g. "rake". You should use the -S switch to specify the binary followed by any arguments in takes e.g. java -jar myrailsapp.war -S rake db:migrate.
  • +executable+: This bundles an embedded web server into the .war so that it can either be deployed into a traditional java web server or run as a standalone application using java -jar myapp.war. (Note: jar-based applications are executable by default.)
  • +compiled+: This uses +jrubyc+ to precompile all .rb files in your application to .class files and includes those in the .war instead of the Ruby sources. NOTE: The war file will still contain .rb files, but they will be short stubs containing the following code : load FILE.sub(/.rb$/, '.class')

Features may form the basis for a third-party plugin system (in the future) if there is demand.

NOTE: Feature tasks must be included in the same command invocation and inserted before the +war+ task in order to take effect. For example, warble compiled; warble war does not compile and obfuscate +.rb+ sources because the second invocation of +warble+ does not run the +compiled+ feature and creates a basic war with the sources included, make sure you run :

warble compiled war

or, if it's important that the war always be compiled, use the option above to put the feature in your config/warble.rb.

== .war or .jar?

War-based projects are for Rails, Merb, or Rack-based web applications. They usually contain a +config/environment.rb+ file, a +config/init.rb+ file, or a +config.ru+ file. The presence of these files are used to determine if the project is a web application, and thus a Java EE compatible war file is built for the project.

Jar-based projects are for standalone Ruby applications. Usually a Ruby application has a launcher script in the +bin+ directory and Ruby code in the lib directory. Warbler packages the application so that java -jar myapp.jar runs the launcher script.

== Jar Files

=== Gem Specification Files

If your project has a .gemspec file in the top directory, it will be used to configure the project's dependencies, launcher script, require paths, and the files to be included in the archive. For best results make sure your gemspec specifies all of the following attributes:

  • +executables+
  • +require_paths+
  • runtime dependencies added with +add_dependency+

If your project do not have a .gemspec, Warbler will attempt to guess the launcher from the contents of the bin directory and use the lib directory as the lone require path. All files in the project will be included in the archive.

=== Bundler

Applications that use Bundler[http://gembundler.com/], detected via presence of a +Gemfile+, will have the gems packaged up into the archive along with the Gemfile. The Bundler groups named ":development", ":test" and ":assets" will be excluded by default, unless you specify with config.bundle_without in +config/warble.rb+.

Warbler supports Bundler for gems and git repositories, but not for plain path components. Warbler will warn when a +:path+ component is found in the +Gemfile+ and will refuse to include it in the archive.

=== JBundler (experimental)

Applications that use JBundler[http://github.com/mkristian/jbundler], detected via presence of a +Jarfile+, will have the jars packaged up into the archive. the JBundler gem is not needed for runtime since all jars are already part of the classloader.

== War Files

=== Rails applications

Rails applications are detected automatically and configured appropriately. The following items are set up for you:

  • Your application runs in the +production+ environment by default. Change it in +config/warble.rb+ (see below).
  • The Rails gem is packaged if you haven't vendored Rails (Rails <= 2.x).
  • Other gems configured in Rails.configuration.gems are packaged (2.1 - 2.3)
  • Multi-thread-safe execution (as introduced in Rails 2.2) is detected and runtime pooling is disabled.

=== Other Rack Applications

If you have a +config.ru+ file in the top directory or one of the immediate subdirectories of your application, it will be included and used as the rackup script for your Rack-based application. You will probably need to specify framework and application gems in +config/warble.rb+ unless you're using Bundler to manage your gems. ENV['RACK_ENV'] will be set to +production+.

See {the examples in the jruby-rack project}[http://github.com/jruby/jruby-rack/tree/master/examples/] of how to configure Warbler to package Camping and Sinatra apps.

=== Configuration Notes

  • Warbler will load the +environment+ Rake task in a Rails application to try to detect some configuration. If you don't have database access in the environment where you package your application, you may wish to set Warbler.framework_detection = false at the top of +config.rb+. In this case you may need to specify additional details such as booter, gems and other settings that would normally be gleaned from the app configuration.
  • Is it possible to more generally detect what gems an application uses? Gem.loaded_specs is available, but the application needs to be loaded first before its contents are reliable.

== Custom Configuration

If the default settings are not appropriate for your application, you can customize Warbler's behavior. To customize files, libraries, and gems included in the .war file, you'll need a config/warble.rb file. There a two ways of doing this. With the gem, simply run

warble config

Finally, edit the +config/warble.rb+ to your taste. The generated file is fully-documented with the available options and default values.

=== Archive Layout

The default configuration puts application files (+app+, +config+, +lib+, +log+, +vendor+, +tmp+) under the .war file's +WEB-INF+ directory, and files in +public+ in the root of the .war file. Any Java .jar files stored in lib will automatically be placed in +WEB-INF/lib+ for placement on the web app's class-path.

=== web.xml

Java web applications are configured mainly through this file, and Warbler creates a suitable default file for you for use. However, if you need to customize it in any way, you have two options.

  1. If you just want a static web.xml file whose contents you manually control, you may unzip the one generated for you in yourapp.war:WEB-INF/web.xml to config/web.xml and modify as needed. It will be copied into subsequent copies of the war file for you.
  2. If you want to inject some dynamic information into the file, copy the WARBLER_HOME/web.xml.erb to config/web.xml.erb. Its contents will be evaluated for you and put in the webapp. Note that you can also pass arbitrary properties to the ERb template by setting config.webxml.customkey values in your config/warble.rb file.

For more information on configuration, see Warbler::Config.

== Rakefile Integration

If you'd like to control Warbler from your own project's +Rakefile+, simply add the following code somewhere in the +Rakefile+ :

require 'warbler'
Warbler::Task.new

If you're using Bundler, you'll want to add Warbler to your +Gemfile+ :

group :development do
  gem "warbler", :require => false
end

Now you should be able to invoke rake war to create your war file.

== Troubleshooting

If Warbler isn't packaging the files you were expecting, use the +war:debug+ task to give you more insight into what's going on.

If you think you found a bug, please file one at https://github.com/jruby/warbler/issues.

== Source

You can get the Warbler source using Git, in any of the following ways:

git clone git://github.com/jruby/warbler.git

You can also download a tarball of Warbler source at https://github.com/jruby/warbler/archive/master.zip.

== Development

You can develop Warbler with any implementation of Ruby. To write Warbler code and run specs, you need to have Bundler installed and run bundle once.

After that, simply run rake.

=== Integration Tests

There are a few integration tests in the integration directory that build WAR file with Warbler, and run some basic smoke tests against them. You can run these like so:

cd integration
mvn verify

You'll need to have Maven >= 3.1.1 installed, of course: http://maven.apache.org/

== License

Warbler is provided under the terms of the MIT license.

Warbler (c) 2013-2018 The JRuby Team

Warbler (c) 2010-2012 Engine Yard, Inc.

Warbler (c) 2007-2009 Sun Microsystems, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].