Permalink
Browse files

1.8 doesn't support :mode

  • Loading branch information...
1 parent 02ec0fe commit 94bad63e7e431345d77e508c9a6bc30b151571ea @wycats wycats committed Aug 29, 2010
Showing with 7 additions and 3 deletions.
  1. +4 −0 lib/bundler.rb
  2. +2 −2 lib/bundler/definition.rb
  3. +1 −1 lib/bundler/dsl.rb
View
@@ -211,6 +211,10 @@ def sudo(str)
`sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
end
+ def read_file(file)
+ File.open(file, "rb") { |file| file.read }
+ end
+
def load_gemspec(file)
path = Pathname.new(file)
# Eval the gemspec from its parent directory
@@ -16,7 +16,7 @@ def self.build(gemfile, lockfile, unlock)
# TODO: move this back into DSL
builder = Dsl.new
- builder.instance_eval(File.read(gemfile.to_s, :mode => "rb"), gemfile.to_s, 1)
+ builder.instance_eval(Bundler.read_file(gemfile.to_s), gemfile.to_s, 1)
builder.to_definition(lockfile, unlock)
end
@@ -39,7 +39,7 @@ def initialize(lockfile, dependencies, sources, unlock)
@lockfile_contents = ""
if lockfile && File.exists?(lockfile)
- @lockfile_contents = File.read(lockfile, :mode => "rb")
+ @lockfile_contents = Bundler.read_file(lockfile)
locked = LockfileParser.new(@lockfile_contents)
@platforms = locked.platforms
View
@@ -4,7 +4,7 @@ module Bundler
class Dsl
def self.evaluate(gemfile)
builder = new
- builder.instance_eval(File.read(gemfile.to_s, :mode => "rb"), gemfile.to_s, 1)
+ builder.instance_eval(Bundler.read_file(gemfile.to_s), gemfile.to_s, 1)
builder.to_definition
end

0 comments on commit 94bad63

Please sign in to comment.