~ubuntu-branches/ubuntu/oneiric/ctioga2/oneiric

« back to all changes in this revision

Viewing changes to lib/ctioga2/data/backends/backends.rb

  • Committer: Bazaar Package Importer
  • Author(s): Vincent Fourmond
  • Date: 2011-01-24 21:36:06 UTC
  • Revision ID: james.westby@ubuntu.com-20110124213606-9ettx0ugl83z0bzp
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# backends.rb: all the backends
 
2
 
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
# General Public License for more details.
 
12
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 
16
# USA
 
17
 
 
18
 
 
19
require 'ctioga2/data/backends/backend'
 
20
 
 
21
# We try to look for all files under a ctioga2/metabuilder/types
 
22
# directory anywhere on the $: path
 
23
 
 
24
files = []
 
25
for dir in $:
 
26
  Dir[dir + '/ctioga2/data/backends/backends/**/*'].each do |f|
 
27
    f =~ /ctioga2\/data\/backends\/backends\/(.*)\.[^.]+$/
 
28
    files << $1
 
29
  end
 
30
end
 
31
 
 
32
for file in files.uniq
 
33
  begin
 
34
    require "ctioga2/data/backends/backends/#{file}"
 
35
  rescue Exception => e
 
36
    warn { "There was a problem trying to load 'ctioga2/data/backends/backends/#{file}': "  }
 
37
    warn { "#{e.inspect}" }
 
38
  end
 
39
end