Module: Warbler::Traits

Included in:
Config
Defined in:
lib/warbler/traits.rb,
lib/warbler/traits/jar.rb,
lib/warbler/traits/war.rb,
lib/warbler/traits/merb.rb,
lib/warbler/traits/rack.rb,
lib/warbler/traits/rails.rb,
lib/warbler/traits/bundler.rb,
lib/warbler/traits/gemspec.rb,
lib/warbler/traits/nogemspec.rb

Overview

Traits are project configuration characteristics that correspond to the framework or project layout. Each trait corresponds to a class in Warbler::Traits that contains baked-in knowledge about the kind of project and how it should be packed into the jar or war file.

Defined Under Namespace

Classes: Bundler, Gemspec, Jar, Merb, NoGemspec, Rack, Rails, War

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#traitsObject

Returns the value of attribute traits.



17
18
19
# File 'lib/warbler/traits.rb', line 17

def traits
  @traits
end

Instance Method Details

#after_configureObject



31
32
33
# File 'lib/warbler/traits.rb', line 31

def after_configure
  trait_objects.each {|t| t.after_configure }
end

#auto_detect_traitsObject



23
24
25
# File 'lib/warbler/traits.rb', line 23

def auto_detect_traits
  Traits.constants.map {|t| Traits.const_get(t)}.select {|tc| tc.detect? }.sort
end

#before_configureObject



27
28
29
# File 'lib/warbler/traits.rb', line 27

def before_configure
  trait_objects.each {|t| t.before_configure }
end

#dump_traitsObject



43
44
45
46
# File 'lib/warbler/traits.rb', line 43

def dump_traits
  @trait_objects = nil
  @traits.collect! {|t| t.name }
end

#initializeObject



19
20
21
# File 'lib/warbler/traits.rb', line 19

def initialize
  @traits = auto_detect_traits
end

#trait_objectsObject



35
36
37
# File 'lib/warbler/traits.rb', line 35

def trait_objects
  @trait_objects ||= @traits.map {|klass| klass.new(self) }
end

#update_archive(jar) ⇒ Object



39
40
41
# File 'lib/warbler/traits.rb', line 39

def update_archive(jar)
  trait_objects.each {|t| t.update_archive(jar) }
end