/ public / config / warble.rb
warble.rb
  1  # https://github.com/jruby/warbler/issues/508
  2  class Warbler::Traits::War::WebxmlOpenStruct
  3    def new_ostruct_member(name)
  4      return if name.nil?
  5  
  6      unless @table.key?(name) || is_method_protected!(name)
  7        getter_proc = Proc.new { @table[name] }
  8        setter_proc = Proc.new {|x| @table[name] = x}
  9        if defined?(::Ractor)
 10          ::Ractor.make_shareable(getter_proc)
 11          ::Ractor.make_shareable(setter_proc)
 12        end
 13        define_singleton_method!(name, &getter_proc)
 14        define_singleton_method!("#{name}=", &setter_proc)
 15      end
 16    end
 17  end
 18  
 19  
 20  # Disable Rake-environment-task framework detection by uncommenting/setting to false
 21  Warbler.framework_detection = false
 22  
 23  # Warbler web application assembly configuration file
 24  Warbler::Config.new do |config|
 25    # Features: additional options controlling how the jar is built.
 26    # Currently the following features are supported:
 27    # - gemjar: package the gem repository in a jar file in WEB-INF/lib
 28    # - executable: embed a web server and make the war executable
 29    # - compiled: compile .rb files to .class files
 30    config.features = []
 31  
 32    # Application directories to be included in the webapp.
 33    config.dirs = %w(app config lib log vendor tmp .bundle)
 34  
 35    # Additional files/directories to include, above those in config.dirs
 36    #
 37    # config.ru is needed here because Rails looks for it when trying to determine
 38    # its root directory.
 39    config.includes = FileList["Gemfile", "Gemfile.lock", "config.ru"]
 40  
 41    # Additional files/directories to exclude
 42    config.excludes = FileList[".bundle/install.log"]
 43  
 44    # Additional Java .jar files to include.  Note that if .jar files are placed
 45    # in lib (and not otherwise excluded) then they need not be mentioned here.
 46    # JRuby and JRuby-Rack are pre-loaded in this list.  Be sure to include your
 47    # own versions if you directly set the value
 48    # config.java_libs += FileList["lib/java/*.jar"]
 49  
 50    config.java_libs.reject! {|jar| jar =~ /jruby-(complete|core|stdlib|rack)/}
 51  
 52    # Loose Java classes and miscellaneous files to be included.
 53    # config.java_classes = FileList["target/classes/**.*"]
 54  
 55    # One or more pathmaps defining how the java classes should be copied into
 56    # the archive. The example pathmap below accompanies the java_classes
 57    # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
 58    # for details of how to specify a pathmap.
 59    # config.pathmaps.java_classes << "%{target/classes/,}p"
 60  
 61    # Bundler support is built-in. If Warbler finds a Gemfile in the
 62    # project directory, it will be used to collect the gems to bundle
 63    # in your application. If you wish to explicitly disable this
 64    # functionality, uncomment here.
 65    config.bundler = false
 66  
 67    # An array of Bundler groups to avoid including in the war file.
 68    # Defaults to ["development", "test"].
 69    config.bundle_without = ["development", "test"]
 70  
 71    # Other gems to be included. If you don't use Bundler or a gemspec
 72    # file, you need to tell Warbler which gems your application needs
 73    # so that they can be packaged in the archive.
 74    # For Rails applications, the Rails gems are included by default
 75    # unless the vendor/rails directory is present.
 76    # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
 77    # config.gems << "tzinfo"
 78  
 79    # Uncomment this if you don't want to package rails gem.
 80    # config.gems -= ["rails"]
 81  
 82    # The most recent versions of gems are used.
 83    # You can specify versions of gems by using a hash assignment:
 84    # config.gems["rails"] = "2.3.10"
 85  
 86    # You can also use regexps or Gem::Dependency objects for flexibility or
 87    # finer-grained control.
 88    # config.gems << /^merb-/
 89    # config.gems << Gem::Dependency.new("merb-core", "= 0.9.3")
 90  
 91    # Include gem dependencies not mentioned specifically. Default is
 92    # true, uncomment to turn off.
 93    config.gem_dependencies = false
 94  
 95    # Don't bundle the JRuby jars twice--Warbler will make sure we get it.
 96    config.gem_excludes = [/jruby-(core|stdlib).*jar/]
 97  
 98  
 99    # Pathmaps for controlling how application files are copied into the archive
100    # config.pathmaps.application = ["WEB-INF/%p"]
101  
102    # Name of the archive (without the extension). Defaults to the basename
103    # of the project directory.
104    # config.jar_name = "mywar"
105  
106    # Name of the MANIFEST.MF template for the war file. Defaults to a simple
107    # MANIFEST.MF that contains the version of Warbler used to create the war file.
108    # config.manifest_file = "config/MANIFEST.MF"
109  
110    # When using the 'compiled' feature and specified, only these Ruby
111    # files will be compiled. Default is to compile all \.rb files in
112    # the application.
113    # config.compiled_ruby_files = FileList['app/**/*.rb']
114  
115    # === War files only below here ===
116  
117    # Path to the pre-bundled gem directory inside the war file. Default
118    # is 'WEB-INF/gems'. Specify path if gems are already bundled
119    # before running Warbler. This also sets 'gem.path' inside web.xml.
120    # config.gem_path = "WEB-INF/vendor/bundler_gems"
121  
122    # Files for WEB-INF directory (next to web.xml). This contains
123    # web.xml by default. If there is an .erb-File it will be processed
124    # with webxml-config. You may want to exclude this file via
125    # config.excludes.
126    # config.webinf_files += FileList["jboss-web.xml"]
127  
128    # Files to be included in the root of the webapp.  Note that files in public
129    # will have the leading 'public/' part of the path stripped during staging.
130    # config.public_html = FileList["public/**/*", "doc/**/*"]
131  
132    # Pathmaps for controlling how public HTML files are copied into the .war
133    # config.pathmaps.public_html = ["%{public/,}p"]
134  
135    # Embedded webserver to use with the 'executable' feature. Currently supported
136    # webservers are:
137    # * <tt>winstone</tt> (default) - Winstone 0.9.10 from sourceforge
138    # * <tt>jenkins-ci.winstone</tt> - Improved Winstone from Jenkins CI
139    # * <tt>jetty</tt> - Embedded Jetty from Eclipse
140    # config.webserver = 'jetty'
141  
142    config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
143  
144    # See ./web.xml for jetty configuration
145  
146    config.override_gem_home = true
147  end