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/jbundler.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, JBundler, Jar, Merb, NoGemspec, Rack, Rails, War

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#traitsObject

Returns the value of attribute traits.



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

def traits
  @traits
end

Instance Method Details

#after_configureObject



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

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

#auto_detect_traitsObject



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

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

#before_configureObject



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

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

#dump_traitsObject



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

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

#initializeObject



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

def initialize
  @traits = auto_detect_traits
end

#trait_objectsObject



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

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

#update_archive(jar) ⇒ Object



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

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