Class: Warbler::Config
- Inherits:
-
Object
- Object
- Warbler::Config
- Defined in:
- lib/warbler/config.rb
Overview
Warbler assembly configuration.
Constant Summary collapse
- TOP_DIRS =
%w(app config lib log vendor)
- FILE =
"config/warble.rb"
- BUILD_GEMS =
%w(warbler rake rcov)
Instance Attribute Summary collapse
-
#autodeploy_dir ⇒ Object
Directory where the war file will be written.
-
#dirs ⇒ Object
Top-level directories to be copied into WEB-INF.
-
#exclude_logs ⇒ Object
Whether to exclude */.log files (default is true).
-
#excludes ⇒ Object
Files to exclude from the WEB-INF directory.
-
#gem_dependencies ⇒ Object
Whether to include dependent gems (default true).
-
#gems ⇒ Object
Rubygems to install into the webapp at WEB-INF/gems.
-
#includes ⇒ Object
Additional files beyond the top-level directories to include in the WEB-INF directory.
-
#java_classes ⇒ Object
Java classes and other files to copy to WEB-INF/classes.
-
#java_libs ⇒ Object
Java libraries to copy to WEB-INF/lib.
-
#manifest_file ⇒ Object
Name of the MANIFEST.MF template.
-
#pathmaps ⇒ Object
Container of pathmaps used for specifying source-to-destination transformations under various situations (
public_html
andjava_classes
are two entries in this structure). -
#public_html ⇒ Object
Public HTML directory file list, to be copied into the root of the war.
-
#staging_dir ⇒ Object
Directory where files will be staged, defaults to tmp/war.
-
#war_name ⇒ Object
Name of war file (without the .war), defaults to the directory name containing the Rails application.
-
#webxml ⇒ Object
Extra configuration for web.xml.
Instance Method Summary collapse
-
#initialize(warbler_home = WARBLER_HOME) {|_self| ... } ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(warbler_home = WARBLER_HOME) {|_self| ... } ⇒ Config
Returns a new instance of Config.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/warbler/config.rb', line 94 def initialize(warbler_home = WARBLER_HOME) @staging_dir = File.join("tmp", "war") @dirs = TOP_DIRS.select {|d| File.directory?(d)} @includes = FileList[] @excludes = FileList[] @java_libs = FileList[jruby_jar,"#{warbler_home}/lib/*.jar"] @java_classes = FileList[] @gems = Warbler::Gems.new @gem_dependencies = true @exclude_logs = true @public_html = FileList["public/**/*"] @pathmaps = default_pathmaps @webxml = default_webxml_config @rails_root = File.(defined?(RAILS_ROOT) ? RAILS_ROOT : Dir.getwd) @war_name = File.basename(@rails_root) auto_detect_frameworks yield self if block_given? @excludes += warbler_vendor_excludes(warbler_home) @excludes += FileList["**/*.log"] if @exclude_logs @excludes << @staging_dir end |
Instance Attribute Details
#autodeploy_dir ⇒ Object
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 Rails directory.
23 24 25 |
# File 'lib/warbler/config.rb', line 23 def autodeploy_dir @autodeploy_dir end |
#dirs ⇒ Object
Top-level directories to be copied into WEB-INF. Defaults to names in TOP_DIRS
27 28 29 |
# File 'lib/warbler/config.rb', line 27 def dirs @dirs end |
#exclude_logs ⇒ Object
Whether to exclude */.log files (default is true)
49 50 51 |
# File 'lib/warbler/config.rb', line 49 def exclude_logs @exclude_logs end |
#excludes ⇒ Object
Files to exclude from the WEB-INF directory
34 35 36 |
# File 'lib/warbler/config.rb', line 34 def excludes @excludes end |
#gem_dependencies ⇒ Object
Whether to include dependent gems (default true)
46 47 48 |
# File 'lib/warbler/config.rb', line 46 def gem_dependencies @gem_dependencies end |
#gems ⇒ Object
Rubygems to install into the webapp at WEB-INF/gems
43 44 45 |
# File 'lib/warbler/config.rb', line 43 def gems @gems end |
#includes ⇒ Object
Additional files beyond the top-level directories to include in the WEB-INF directory
31 32 33 |
# File 'lib/warbler/config.rb', line 31 def includes @includes end |
#java_classes ⇒ Object
Java classes and other files to copy to WEB-INF/classes
37 38 39 |
# File 'lib/warbler/config.rb', line 37 def java_classes @java_classes end |
#java_libs ⇒ Object
Java libraries to copy to WEB-INF/lib
40 41 42 |
# File 'lib/warbler/config.rb', line 40 def java_libs @java_libs end |
#manifest_file ⇒ Object
Name of the MANIFEST.MF template. Defaults to the MANIFEST.MF normally generated by jar -cf.…
65 66 67 |
# File 'lib/warbler/config.rb', line 65 def manifest_file @manifest_file end |
#pathmaps ⇒ Object
Container of pathmaps used for specifying source-to-destination transformations under various situations (public_html
and java_classes
are two entries in this structure).
57 58 59 |
# File 'lib/warbler/config.rb', line 57 def pathmaps @pathmaps end |
#public_html ⇒ Object
Public HTML directory file list, to be copied into the root of the war
52 53 54 |
# File 'lib/warbler/config.rb', line 52 def public_html @public_html end |
#staging_dir ⇒ Object
Directory where files will be staged, defaults to tmp/war
18 19 20 |
# File 'lib/warbler/config.rb', line 18 def staging_dir @staging_dir end |
#war_name ⇒ Object
Name of war file (without the .war), defaults to the directory name containing the Rails application
61 62 63 |
# File 'lib/warbler/config.rb', line 61 def war_name @war_name end |
#webxml ⇒ Object
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.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' %>
92 93 94 |
# File 'lib/warbler/config.rb', line 92 def webxml @webxml end |