Class: Warbler::Traits::Merb

Inherits:
Object
  • Object
show all
Includes:
Warbler::Trait
Defined in:
lib/warbler/traits/merb.rb

Overview

The Merb trait adds Merb::BootLoader gem dependencies to the project.

Instance Attribute Summary

Attributes included from Warbler::Trait

#config

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Warbler::Trait

#add_init_load_path, #add_main_rb, #after_configure, included, #initialize, #jruby_jars, #update_archive, #update_gem_path

Class Method Details

.detect?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/warbler/traits/merb.rb', line 14

def self.detect?
  File.exist?("config/init.rb")
end

.requirementsObject



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

def self.requirements
  [ Traits::War ]
end

Instance Method Details

#before_configureObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/warbler/traits/merb.rb', line 22

def before_configure
  return false unless task = Warbler.project_application.lookup("merb_env")
  task.invoke rescue nil
  return false unless defined?(::Merb)
  config.webxml.booter = :merb
  if defined?(::Merb::BootLoader::Dependencies.dependencies)
    ::Merb::BootLoader::Dependencies.dependencies.each {|g| config.gems << g }
  else
    warn "unable to auto-detect Merb dependencies; upgrade to Merb 1.0 or greater"
  end
end