Class: Sparrowhawk::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sparrowhawk/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Returns a new instance of Configuration

Yields:

  • (_self)

Yield Parameters:


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_dirsObject

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

#environmentObject

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_filesObject

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_configObject

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

#runtimesObject

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_fileObject

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.expand_path(rack_config)
end

#warObject

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