preinitializer.rb 1.03 KB
Newer Older
1
#-- encoding: UTF-8
2 3
#-- copyright
# ChiliProject is a project management system.
4
#
Holger Just's avatar
Holger Just committed
5
# Copyright (C) 2010-2012 the ChiliProject Team
6
#
7 8 9 10
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
11
#
12 13 14
# See doc/COPYRIGHT.rdoc for more details.
#++

Gregor Schmidt's avatar
Gregor Schmidt committed
15 16 17 18 19 20 21
begin
  require "rubygems"
  require "bundler"
rescue LoadError
  raise "Could not load the bundler gem. Install it with `gem install bundler`."
end

Holger Just's avatar
Holger Just committed
22 23 24
if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.6")
  raise RuntimeError, "Your bundler version is too old. We require " +
   "at least version 1.0.6. Run `gem install bundler` to upgrade."
Gregor Schmidt's avatar
Gregor Schmidt committed
25 26 27 28 29 30 31
end

begin
  # Set up load paths for all bundled gems
  ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
  Bundler.setup
rescue Bundler::GemNotFound
Holger Just's avatar
Holger Just committed
32
  raise RuntimeError, "Bundler couldn't find some gems. " +
Gregor Schmidt's avatar
Gregor Schmidt committed
33 34
    "Did you run `bundle install`?"
end