Permalink
Browse files

Cleaning

  • Loading branch information...
alloy committed Sep 13, 2011
1 parent bb50005 commit 575996d23f4fd2761a6b5d2c839b56ee9c357d32
Showing with 31 additions and 12 deletions.
  1. +4 −2 bin/pod
  2. +2 −9 lib/cocoa_pods/command/install.rb
  3. +5 −1 lib/cocoa_pods/config.rb
  4. +19 −0 lib/cocoa_pods/dependency.rb
  5. +1 −0 lib/cocoa_pods/installer.rb
View
@@ -1,7 +1,9 @@
#!/usr/bin/env macruby
-$:.unshift File.expand_path('../../lib', __FILE__)
-$:.unshift File.expand_path('../../vendor/rubygems/lib', __FILE__)
+if $0 == __FILE__
+ $:.unshift File.expand_path('../../lib', __FILE__)
+ require 'rubygems'
+end
require 'cocoa_pods'
@@ -2,20 +2,13 @@ module Pod
class Command
class Install < Command
def run
- if spec = Specification.from_podfile(podfile)
+ if config.project_podfile.exist?
+ spec = Specification.from_podfile(config.project_podfile)
Installer.new(spec, config.project_pods_root).install!
else
$stderr.puts "No Podfile found in current working directory."
end
end
-
- def pods_root
- Pathname.new(Dir.pwd) + 'Pods'
- end
-
- def podfile
- File.join(Dir.pwd, 'Podfile')
- end
end
end
end
View
@@ -18,13 +18,17 @@ def initialize
end
def project_root
- Pathname.new(Dir.pwd)
+ Pathname.pwd
end
def project_pods_root
project_root + 'Pods'
end
+ def project_podfile
+ project_root + 'Podfile'
+ end
+
module Mixin
def config
Config.instance
@@ -5,5 +5,24 @@ module Gem
module Pod
class Dependency < Gem::Dependency
attr_accessor :part_of_other_pod
+
+ unless public_method_defined?(:merge)
+ def merge other
+ unless name == other.name then
+ raise ArgumentError,
+ "#{self} and #{other} have different names"
+ end
+
+ default = Gem::Requirement.default
+ self_req = self.requirement
+ other_req = other.requirement
+
+ return self.class.new name, self_req if other_req == default
+ return self.class.new name, other_req if self_req == default
+
+ self.class.new name, self_req.as_list.concat(other_req.as_list)
+ end
+ end
+
end
end
@@ -24,6 +24,7 @@ def xproj
end
def install!
+ puts "Installing dependencies defined in: #{@top_level_specification.defined_in_file}"
install_dependent_specifications!
generate_project
write_files!

0 comments on commit 575996d

Please sign in to comment.