Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (23 sloc) 0.844 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
BUNDLER_VERSION="1.0.15"

namespace :bundle do
  desc "Install the gem bundle from the lockfile"
  task :expand => :ensure_bundler_available do
    system("bundle _#{BUNDLER_VERSION}_ install")
    fail bordered_message("bundler failed") unless $? == 0
  end

  task :ensure_bundler_available do
    `gem list -i bundler -v '#{BUNDLER_VERSION}'`
    unless $? == 0
      puts bordered_message("Installing bundler #{BUNDLER_VERSION}")
      system("gem install bundler -v '#{BUNDLER_VERSION}'")
      unless $? == 0
        fail bordered_message("Install failed.\nPlease fix the problem and try again or manually install bundler #{BUNDLER_VERSION}.")
      end
    end
  end

  def bordered_message(msg)
    len = msg.split("\n").collect { |l| l.size }.max
    ['=' * len, msg, '=' * len].join("\n")
  end
end

task :default => :'bundle:expand'
Something went wrong with that request. Please try again.