Class: Sparrowhawk::Configuration
- Inherits:
-
Object
- Object
- Sparrowhawk::Configuration
- Defined in:
- lib/sparrowhawk/configuration.rb
Instance Attribute Summary collapse
-
#application_dirs ⇒ Object
Sets the base directories that will be scanned for application files (not static content).
-
#environment ⇒ Object
Which environment to use when running the application.
-
#other_files ⇒ Object
Other files to include in the application code (LICENSE, README, etc.).
-
#rack_config ⇒ Object
Set the rack config file.
-
#runtimes ⇒ Object
The min and max runtimes that will be used to service rails requests.
-
#war_file ⇒ Object
Sets the name/file path of the war file.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
- #rack_app? ⇒ Boolean
-
#war ⇒ Object
Returns an object instance that can be used to build a war.
Constructor Details
#initialize {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
43 44 45 46 |
# File 'lib/sparrowhawk/configuration.rb', line 43 def initialize @rack_config = default_rack_config yield self if block_given? end |
Instance Attribute Details
#application_dirs ⇒ Object
Sets the base directories that will be scanned for application files (not static content). Some directories will always be excluded implicitly (e.g. vendor/cache)
11 12 13 |
# File 'lib/sparrowhawk/configuration.rb', line 11 def application_dirs @application_dirs end |
#environment ⇒ Object
Which environment to use when running the application. Only applies to rails.
18 19 20 |
# File 'lib/sparrowhawk/configuration.rb', line 18 def environment @environment end |
#other_files ⇒ Object
Other files to include in the application code (LICENSE, README, etc.)
21 22 23 |
# File 'lib/sparrowhawk/configuration.rb', line 21 def other_files @other_files end |
#rack_config ⇒ Object
Set the rack config file. Defaults to ‘config.ru’
24 25 26 |
# File 'lib/sparrowhawk/configuration.rb', line 24 def rack_config @rack_config end |
#runtimes ⇒ Object
The min and max runtimes that will be used to service rails requests. Accepts a range. Only applies to rails
15 16 17 |
# File 'lib/sparrowhawk/configuration.rb', line 15 def runtimes @runtimes end |
#war_file ⇒ Object
Sets the name/file path of the war file. Ex: ../distro/example.war
6 7 8 |
# File 'lib/sparrowhawk/configuration.rb', line 6 def war_file @war_file end |
Instance Method Details
#rack_app? ⇒ Boolean
48 49 50 |
# File 'lib/sparrowhawk/configuration.rb', line 48 def rack_app? File.file? File.(rack_config) end |
#war ⇒ Object
Returns an object instance that can be used to build a war
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sparrowhawk/configuration.rb', line 27 def war war = War.new war_file war.entries += public_dir_entries war.entries << web_xml_entry war.entries << manifest_entry war.entries += application_file_entries war.entries << jruby_core_jar_entry war.entries << jruby_std_jar_entry war.entries << jruby_rack_jar_entry war.entries += gem_entries other_files.each do |file| war.entries << file_entry("WEB-INF/#{file}", file) end if other_files war end |