Class Raven::DependencyTask
In: lib/raven/deps_tasks.rb
Parent: Rake::Task

Task used to declare a set of dependencies your project relies upon. As many dependency tasks as necessary can be declared (each grouping as many dependency as you like). For each declared dependency, a Gem is searched in your local repository and then if it can‘t be found, in the specified remote repositories (by setting sources). Gems are searched by name ENDING with the name you provided.

As an example, specifying ‘wsdl4j’ will correctly find the Gem named wsdl4j-wsdl4j but specifying ‘axis2’ WILL NOT give you all axis2 Gems. Actually only one Gem can be selected by each of the specified Gem, otherwise you‘ll see an error asking you to be more specific.

Once the correct Gem has been found, if it‘s not local it will be automatically be downloaded and installed.

If no version is provided, and the Gem isn‘t present locally, the latest version will be fetched. If a local version can be found locally, this version will be used without any download.

Example of dependency specification:

dependency ‘deps’ do |t|

  t.deps << [{'commons-logging' => '1.1'}, 'commons-pool']
  t.deps << ['commons-lang', 'wsdl4j', 'log4j']

end

See also Raven::MavenLocalRepoImport and Raven::GemRepoBuilder to learn more about how to build a Gem repository to get started.

Alternatively dependencies can be directly declared manually on jar files in your file system. This allows you to manage your dependencies yourself without using Gem or any other repository.

dependency ‘deps’ do |t|

  t.libs = Dir.glob('lib/**/*.jar')

end

Methods

deps   execute   libs   libs=  

Attributes

gem_deps  [R] 

Public Instance methods

[Source]

    # File lib/raven/deps_tasks.rb, line 96
96:     def deps
97:       @deps ||= []
98:     end

Check dependencies and installs them sometimes.

[Source]

    # File lib/raven/deps_tasks.rb, line 69
69:     def execute
70:       super
71:       ambiguous, notfound = [], []
72:       # Installing missing Gems (if there are)

73:       if @deps
74:         @gem_deps = @deps.flatten.collect do |dep|
75:           # Wrapping in an array, we might not have an array with version

76:           # as dependency.

77:           deparr = dep.respond_to?(:to_a) ? dep.to_a.flatten : [dep]
78:           begin
79:             Raven::GemInstaller.install_or_not(*deparr)
80:           rescue GemNotFoundException => gnfe
81:             notfound << gnfe.message
82:           rescue AmbiguousGemException => age
83:             ambiguous << age
84:           end
85:         end
86:         unless notfound.empty? && ambiguous.empty?
87:           raise(RuntimeError, notfound.join($/) + $/ + ambiguous.join($/))
88:         end
89:       end
90:       # Getting dependencies from eventual prerequisites

91:       Raven.prereq_filter(prerequisites, :gem_deps) do |dep_task|
92:         @gem_deps += dep_task.gem_deps if dep_task.gem_deps
93:       end
94:     end

[Source]

     # File lib/raven/deps_tasks.rb, line 100
100:     def libs 
101:       @libs ||= [] 
102:     end

[Source]

     # File lib/raven/deps_tasks.rb, line 103
103:     def libs=(l)
104:       @libs = l
105:     end

[Validate]