           SPELL=needle
         VERSION=1.3.0
          SOURCE="${SPELL}-${VERSION}.tar.bz2"
   SOURCE_URL[0]=http://rubyforge.org/frs/download.php/7843/${SOURCE}
     SOURCE_HASH=sha512:d97a1743598c659ae19aaac701331ebeea689e5b5fb256e20e2e2676c3d6653723df74555e83732dc6fd7706b6967f1416856bda83b6014c72e90bb86c414aaa
SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}"
        WEB_SITE="http://needle.rubyforge.org"
      LICENSE[0]=BSD
         ENTERED=20080114
           SHORT="Needle: Dependency Injector for Ruby"
cat << EOF
Needle is a dependency injection (a.k.a. "inversion of control")
container for Ruby.  Project Page/Downloads:rubyforge.org/projects/needle
User Manual (work in progress):needle.rubyforge.org API
Documentation:needle.rubyforge.org/api FAQ:needle.rubyforge.org/faq.html
Needle Wiki:needle.rubyforge.org/wiki/wiki.pl Needle is currently
considered production-worthy software. You are encouraged to download
it and try it out. No backwards-incompatible API changes will be made
to Needle without incrementing the major version number as an indicator.
Please report any bugs. The bug tracker on the project page are a good place
to do so, or you can just email me (jgb3@email.byu.edu).  Additionally,
you might consider taking advantage of the following resources:Bug
Reports:rubyforge.org/tracker/?atid=1642&group_id=410&func=browse
Forums:rubyforge.org/forum/?group_id=410 Mailing
List:rubyforge.org/mailman/listinfo/needle-discuss Feature
Requests:rubyforge.org/tracker/?atid=1645&group_id=410&func=browse CHANGES IN
1.2 Parameterized services are now supported, allowing you to pass additional
initialization parameters when requesting a previously-registered service.
Multiton service model is supported. Specify a multiton service model to have
instances cached based on the parameters given when the service is requested.
The :log_for service is a new parameterized version of the :logs service,
making it easier than ever to obtain a logger handle for a service point.
DefinitionContext now passes all messages through to its container.  Fixed
various bugs and documentation typos, and added to the FAQ and manual.
FEATURES Type 2 (setter) injection. This means you can satisfy service
dependencies by setting properties on the services.  Type 3 (constructor)
injection. This means you can satisfy service dependencies by passing them as
parameters to the constructors of the services.  Service Interceptors. This
allows you to specify non-intrusive "interceptor" objects that
sit between the client and the service, intercepting all method calls to
the service. You can implement some simple AOP-like functionality this way.
Integrated, highly-configurable logging subsystem, available as a service.
Service configuration in Ruby (no external configuration files).  Lifecycle
management. Configure services to be singletons or prototypes, and to use
either immediate or deferred instantiation.  Light-weight, and fast (as
compared to Copland) EXAMPLES Jim (Weirich)’s originally proposed
syntax is still completely valid: require 'needle'
  registry = Needle::Registry.new registry.register( :foo ) { 5 }
  registry.register( :bar ) { |c| Struct.new( :value ).new( c.foo ) } bar =
  registry.bar p bar.value #-> 5
Additionally, Eivind Eklund suggested a "domain language" approach
that is also available: registry.define! do
    foo { 5 } bar { Struct.new( :value ).new( foo ) }
  end bar = registry.bar p bar.value #-> 5
Also, Jim Weirich proposed another "domain language" approach that
does not use instance_eval (also available): registry.define do |b|
    b.foo { 5 } b.bar { Struct.new( :value ).new( b.foo ) }
  end bar = registry.bar p bar.value #-> 5
You can also create hierarchical namespaces inside of a registry:
registry.namespace :level1 do |l1|
    l1.namespace :level2 do |l2|
      l2.register( :foo ) { "hello" }
    end
  end p registry.level1.level2.foo #-> "hello"
For more, see the User Manual, and the "examples" subdirectory
of the Needle distribution.  HISTORY At RubyConf 2004, Jim Weirich
approached me (Jamis Buck) after my presentation on Copland and mused
aloud, "I wonder what would happen if you started with Ruby’s
features and evolved a DI container?" I agreed that it would be
an interesting exercise.  Jim (being who he is) sent me a rough draft
of an article a few days later.  This article was one he was going
to post on his blog, entitled "Dependency Injection in Ruby"
(onestepback.org/index.cgi/Tech/Ruby/DependencyInjectionInRuby.rdoc).  In it
he laid out a bare-bones implementation of DI using some of Ruby’s most
compelling features, like blocks.  Jim granted me permission to work on his
implementation, and Needle was born. Eivind Eklund and Mauricio Fernández
were both kind enough to review my additions and offer suggestions.

  Versions: [1.2.0 (2004-11-18)]
        [1.1.0 (2004-11-11)] [1.0.0 (2004-11-04)] [0.9.0 (2004-10-28)]
        [0.6.0 (2004-10-21)] [0.5.0 (2004-10-15)]
EOF
