Permalink
Browse files

Exit early when using an old RubyGems version (< 1.4.0).

Closes #398.

Unfortunately, OS X >= 10.7 ships with 1.3.6 :(
  • Loading branch information...
1 parent 5a32b8f commit 9b5788e92e96397241a9732dfd0b6b41c407617e @alloy alloy committed Jul 14, 2012
Showing with 30 additions and 8 deletions.
  1. +2 −0 CHANGELOG.md
  2. +1 −1 README.md
  3. +14 −0 lib/cocoapods.rb
  4. +0 −1 lib/cocoapods/command/error_report.rb
  5. +0 −3 lib/cocoapods/dependency.rb
  6. +1 −3 lib/cocoapods/version.rb
  7. +12 −0 spec/unit/version_spec.rb
View
@@ -12,6 +12,8 @@
- Relaxed linter to accepts pod that only specify paths to preserve (like TuneupJS).
- Gender neutralization of podfile documentation. [#384](http://git.io/MAsHXg)
+- Exit early when using an old RubyGems version (< 1.4.0). These versions contain subtle bugs
+ related to prelrease version comparisons. Unfortunately, OS X >= 10.7 ships with 1.3.6. [#398](http://git.io/Lr7DoA)
## 0.8.0
View
@@ -43,7 +43,7 @@ Now that you've got CocoaPods installed you can easily add it to your project.
1. If you're using a fresh out of the box Mac with Lion using Xcode from the Mac App Store, you will need to install the Command Line Tools for Xcode first: [here](https://developer.apple.com/downloads/index.action)
-2. CocoaPods re-uses some of the RubyGems 1.3.6 classes. If you have an older version (pre OS X 10.7), you will have to update RubyGems: `$ gem update --system`.
+2. CocoaPods re-uses some of the RubyGems classes. If you have a version older than 1.4.0, you will have to update RubyGems: `$ gem update --system`.
## Adding it to your project
View
@@ -1,3 +1,17 @@
+require 'rubygems'
+
+# Better to fail early and clear then during installation of pods.
+#
+# RubyGems 1.3.6 (which ships with OS X >= 10.7) up to 1.4.0 have a couple of
+# bugs related to comparing prerelease versions.
+#
+# E.g. https://github.com/CocoaPods/CocoaPods/issues/398
+unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(Gem::VERSION))
+ require 'colored'
+ STDERR.puts "Your RubyGems version (#{Gem::VERSION}) is too old, please update with: `gem update --system`".red
+ exit 1
+end
+
module Pod
VERSION = '0.8.0'
@@ -2,7 +2,6 @@
require 'rbconfig'
require 'cgi'
-require 'rubygems'
module Pod
class Command
@@ -1,6 +1,3 @@
-module Gem
-end
-require 'rubygems/dependency'
require 'open-uri'
module Pod
View
@@ -1,6 +1,4 @@
-module Gem
-end
-require 'rubygems/version'
+
module Pod
class Version < Gem::Version
View
@@ -0,0 +1,12 @@
+require File.expand_path('../../spec_helper', __FILE__)
+
+module Pod
+ describe Version do
+ it "returns wether or not it's a `bleeding edge' version" do
+ version = Version.new('1.2.3')
+ version.should.not.be.head
+ version.head = true
+ version.should.be.head
+ end
+ end
+end

0 comments on commit 9b5788e

Please sign in to comment.