autobundle 1.0.0.pre1 → 1.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubygems_plugin.rb +7 -2
- metadata +2 -2
data/lib/rubygems_plugin.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
module Autobundle
|
2
2
|
def self.setup
|
3
3
|
if gemfile = Utils.find_gemfile
|
4
|
-
|
4
|
+
version = Utils.deduce_bundler_version(gemfile)
|
5
|
+
gem 'bundler', version
|
5
6
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
7
|
require 'bundler'
|
7
8
|
Bundler.setup
|
8
9
|
end
|
10
|
+
rescue Gem::LoadError => e
|
11
|
+
$stderr.puts "You have a Gemfile for bundler #{version} but don't have it installed. Ignoring it."
|
12
|
+
rescue Bundler::BundlerError => e
|
13
|
+
$stderr.puts "You have a Gemfile but your bundle is half-baked. Leaving it in the oven. #{e}"
|
9
14
|
end
|
10
15
|
|
11
16
|
module Utils
|
@@ -31,7 +36,7 @@ module Autobundle
|
|
31
36
|
contents = File.read(lock)
|
32
37
|
if contents =~ /\A---/
|
33
38
|
if contents =~ /- bundler:\s*\n\s+version:\s*(.+)\n/
|
34
|
-
"= $1"
|
39
|
+
"= #{$1}"
|
35
40
|
else
|
36
41
|
'~> 0.9.0'
|
37
42
|
end
|