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
# File 'lib/sparrowhawk/configuration.rb', line 43

def initialize
  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



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

#runtimesObject

The min and max runtimes that will be used to service requests. Accepts a range.



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

#warObject

Returns an object instance that can be used to build a war



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/sparrowhawk/configuration.rb', line 24

def war
  war = War.new war_file
  war.entries << PublicDirMapper.new.to_a
  war.entries << WebXmlEntry.new(web_xml_options)
  war.entries << ManifestEntry.new
  war.entries << ApplicationFilesMapper.new(application_dirs).to_a
  war.entries << JRubyCoreJarEntry.new
  war.entries << JRubyStdLibJarEntry.new
  war.entries << JRubyRackJarEntry.new
  gem_finder = BundlerGemFinder.new
  war.entries << GemMapper.new(gem_finder).to_a
  war.entries << GemfileEntry.new
  war.entries << LockfileEntry.new
  other_files.each do |file|
    war.entries << FileEntry.new("WEB-INF/#{file}", file)
  end if other_files
  war
end