Module: Warbler::Trait
- Included in:
- Warbler::Traits::Bundler, Warbler::Traits::Gemspec, Warbler::Traits::Jar, Warbler::Traits::Merb, Warbler::Traits::NoGemspec, Warbler::Traits::Rack, Warbler::Traits::Rails, Warbler::Traits::War
- Defined in:
- lib/warbler/traits.rb
Overview
Each trait class includes this module to receive shared functionality.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #add_init_load_path(path) ⇒ Object
- #add_main_rb(jar, bin_path) ⇒ Object
- #after_configure ⇒ Object
- #before_configure ⇒ Object
- #initialize(config) ⇒ Object
- #update_archive(jar) ⇒ Object
- #update_gem_path(default_gem_path) ⇒ Object
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
65 66 67 |
# File 'lib/warbler/traits.rb', line 65 def config @config end |
Class Method Details
.included(base) ⇒ Object
61 62 63 |
# File 'lib/warbler/traits.rb', line 61 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#add_init_load_path(path) ⇒ Object
79 80 81 |
# File 'lib/warbler/traits.rb', line 79 def add_init_load_path(path) config.init_contents << StringIO.new("$LOAD_PATH.unshift __FILE__.sub(/!.*/, '!/#{path}')\n") end |
#add_main_rb(jar, bin_path) ⇒ Object
83 84 85 |
# File 'lib/warbler/traits.rb', line 83 def add_main_rb(jar, bin_path) jar.files['META-INF/main.rb'] = StringIO.new("load '#{bin_path}'") end |
#after_configure ⇒ Object
73 74 |
# File 'lib/warbler/traits.rb', line 73 def after_configure end |
#before_configure ⇒ Object
70 71 |
# File 'lib/warbler/traits.rb', line 70 def before_configure end |
#initialize(config) ⇒ Object
66 67 68 |
# File 'lib/warbler/traits.rb', line 66 def initialize(config) @config = config end |
#update_archive(jar) ⇒ Object
76 77 |
# File 'lib/warbler/traits.rb', line 76 def update_archive(jar) end |
#update_gem_path(default_gem_path) ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/warbler/traits.rb', line 87 def update_gem_path(default_gem_path) if config.gem_path != default_gem_path config.gem_path = "/#{config.gem_path}" unless config.gem_path =~ %r{^/} sub_gem_path = config.gem_path[1..-1] config.pathmaps.marshal_dump.keys.each do |pm| config.pathmaps.send(pm).each {|p| p.sub!(default_gem_path[1..-1], sub_gem_path)} end config.webxml["gem"]["path"] = config.gem_path if config.webxml end end |