#!/usr/bin/env ruby
#
# This file can be Exec'ed without spawning a new shell
# It lets you run rake with a full Gitorious environment
#
require "pathname"

class RailsEnv
  def initialize(env); @env = env; end
  def production?; @env == "production"; end
  def development?; @env == "development"; end
  def test?; @env == "test"; end
  def to_s; @env; end
end

class Rails
  def self.root
    (Pathname(__FILE__) + "../../").realpath
  end

  def self.env
    @env ||= RailsEnv.new("production")
  end
end

ENV["BUNDLE_GEMFILE"] = Rails.root + "Gemfile"

require "rubygems"
require "bundler/setup"

load Gem.bin_path("rake", "rake")
