Parent

Warbler::Config

Warbler archive assembly configuration class.

Attributes

autodeploy_dir[RW]

Directory where the war file will be written. Can be used to direct Warbler to place your war file directly in your application server’s autodeploy directory. Defaults to the root of the application directory.

bundle_without[RW]

An array of Bundler groups to avoid including in the war file. Defaults to [“development”, “test”].

bundler[RW]

Use Bundler to locate gems if Gemfile is found. Default is true.

compiled_ruby_files[RW]

List of ruby files to compile to class files. Default is to compile all .rb files in the application.

dirs[RW]

Top-level directories to be copied into WEB-INF. Defaults to names in TOP_DIRS

exclude_logs[RW]

Whether to exclude */.log files (default is true)

excludes[RW]

Files to exclude from the WEB-INF directory

features[RW]

Features: additional options controlling how the jar is built. Currently the following features are supported:

  • gemjar: package the gem repository in a jar file in WEB-INF/lib

  • executable: embed a web server and make the war executable

  • compiled: compile .rb files to .class files

gem_dependencies[RW]

Whether to include dependent gems (default true)

gem_excludes[RW]

Array of regular expressions matching relative paths in gems to be excluded from the war. Default contains no exclusions.

gem_path[RW]

Path to the pre-bundled gem directory inside the war file. Default is ‘/WEB-INF/gems’. This also sets ‘gem.path’ inside web.xml.

gems[RW]

Rubygems to install into the webapp.

includes[RW]

Additional files beyond the top-level directories to include in the WEB-INF directory

init_contents[RW]

Array containing filenames or StringIO’s to be concatenated together to form the init file. If the filename ends in .erb the file will be expanded the same way web.xml.erb is; see below.

init_filename[RW]

Warbler writes an “init” file into the war at this location. JRuby-Rack and possibly other launchers may use this to initialize the Ruby environment.

jar_extension[RW]

Extension of jar file. Defaults to jar or war depending on the project.

jar_name[RW]

Name of jar or war file (without the extension), defaults to the directory name containing the application.

java_classes[RW]

Java classes and other files to copy to WEB-INF/classes

java_libs[RW]

Java libraries to copy to WEB-INF/lib

manifest_file[RW]

Name of a MANIFEST.MF template to use.

pathmaps[RW]

Container of pathmaps used for specifying source-to-destination transformations under various situations (public_html and java_classes are two entries in this structure).

public_html[RW]

Public HTML directory file list, to be copied into the root of the war

staging_dir[RW]

Deprecated: No longer has any effect.

traits[RW]

Traits: an array of trait classes corresponding to characteristics of the project that are either auto-detected or configured.

warbler_templates[R]
webinf_files[RW]

Files for WEB-INF directory (next to web.xml). Contains web.xml by default. If there are .erb files they will be processed with webxml config.

webserver[RW]

Embedded webserver to use. Currently supported webservers are:

  • winstone (default) - Winstone 0.9.10 from sourceforge

  • jenkins-ci.winstone - Improved Winstone from Jenkins CI

  • jetty - Embedded Jetty from Eclipse

webxml[RW]

Extra configuration for web.xml. Controls how the dynamically-generated web.xml file is generated.

  • webxml.jndi – the name of one or more JNDI data sources name to be available to the application. Places appropriate <resource-ref> entries in the file.

  • webxml.ignored – array of key names that will be not used to generate a context param. Defaults to [‘jndi’, ‘booter’]

Any other key/value pair placed in the open structure will be dumped as a context parameter in the web.xml file. Some of the recognized values are:

  • webxml.rails.env – the Rails environment to use for the running application, usually either development or production (the default).

  • webxml.gem.path – the path to your bundled gem directory

  • webxml.jruby.min.runtimes – minimum number of pooled runtimes to keep around during idle time

  • webxml.jruby.max.runtimes – maximum number of pooled Rails application runtimes

Note that if you attempt to access webxml configuration keys in a conditional, you might not obtain the result you want. For example:

<%= webxml.maybe.present.key || 'default' %>

doesn’t yield the right result. Instead, you need to generate the context parameters:

<%= webxml.context_params['maybe.present.key'] || 'default' %>

Public Class Methods

new(warbler_home = WARBLER_HOME) click to toggle source
# File lib/warbler/config.rb, line 154
def initialize(warbler_home = WARBLER_HOME)
  super()

  @warbler_home      = warbler_home
  @warbler_templates = "#{WARBLER_HOME}/lib/warbler/templates"
  @features          = Set.new
  @dirs              = TOP_DIRS.select {|d| File.directory?(d)}
  @includes          = FileList[]
  @excludes          = FileList[]
  @java_libs         = FileList[]
  @java_classes      = FileList[]
  @gems              = Warbler::Gems.new
  @gem_dependencies  = true
  @gem_excludes      = []
  @exclude_logs      = true
  @public_html       = FileList[]
  @jar_name          = File.basename(Dir.getwd)
  @jar_extension     = 'jar'
  @webinf_files      = FileList[]
  @init_filename     = 'META-INF/init.rb'
  @init_contents     = ["#{@warbler_templates}/config.erb"]

  before_configure
  yield self if block_given?
  after_configure

  @compiled_ruby_files ||= FileList[*@dirs.map {|d| "#{d}/**/*.rb"}]

  @excludes += ["tmp/war", "tmp/war/**/*"] if File.directory?("tmp/war")
  @excludes += warbler_vendor_excludes(warbler_home)
  @excludes += FileList["**/*.log"] if @exclude_logs
end

Public Instance Methods

define_tasks() click to toggle source
# File lib/warbler/config.rb, line 195
def define_tasks
  task "gemjar" do
    self.features << "gemjar"
  end
  task "executable" do
    self.features << "executable"
  end
end
dump() click to toggle source
# File lib/warbler/config.rb, line 226
def dump
  YAML::dump(self.dup.tap{|c| c.dump_traits })
end
gems=(value) click to toggle source
# File lib/warbler/config.rb, line 187
def gems=(value)
  @gems = Warbler::Gems.new(value)
end
relative_gem_path() click to toggle source
# File lib/warbler/config.rb, line 191
def relative_gem_path
  @gem_path[1..-1]
end
war_name() click to toggle source

Deprecated

# File lib/warbler/config.rb, line 205
def war_name
  $stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
  jar_name                  #:nocov:
end
war_name=(w) click to toggle source

Deprecated

# File lib/warbler/config.rb, line 211
def war_name=(w)
  $stderr.puts "config.war_name deprecated; replace with config.jar_name" #:nocov:
  self.jar_name = w         #:nocov:
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.