Skip to content

Commit

Permalink
Merge branch 'master', remote-tracking branch 'origin'
Browse files Browse the repository at this point in the history
* origin:
  Removed unrelated experimental changes to local_pod.rb
  [#153] Relaxed run if needed
  [#153] Hide pod setup
  [#179] Support for :local pods outside the sanbox

* master:
  • Loading branch information
fabiopelosin committed Mar 23, 2012
2 parents 2d01fc4 + 9e37c07 commit 76d0df7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
19 changes: 11 additions & 8 deletions lib/cocoapods/command.rb
Expand Up @@ -51,15 +51,18 @@ def self.options
end

def self.run(*argv)
parse(*argv).run
rescue Exception => e
if e.is_a?(Informative)
puts e.message
puts *e.backtrace if Config.instance.verbose
else
puts ErrorReport.report(e)
begin
Setup.new(ARGV.new()).run_if_needed
parse(*argv).run
rescue Exception => e
if e.is_a?(Informative)
puts e.message
puts *e.backtrace if Config.instance.verbose
else
puts ErrorReport.report(e)
end
exit 1
end
exit 1
end

def self.parse(*argv)
Expand Down
19 changes: 15 additions & 4 deletions lib/cocoapods/command/setup.rb
Expand Up @@ -47,17 +47,24 @@ def url
end
end

def origin_url_read_only?
read_master_repo_url.chomp == read_only_url
end

def origin_url_push?
Dir.chdir(dir) do
origin_url = git('config --get remote.origin.url')
origin_url.chomp == read_write_url
end
read_master_repo_url.chomp == read_write_url
end

def push?
@push_option || (dir.exist? && origin_url_push?)
end

def read_master_repo_url
Dir.chdir(dir) do
origin_url = git('config --get remote.origin.url')
end
end

def set_master_repo_url
Dir.chdir(dir) do
git("remote set-url origin '#{url}'")
Expand All @@ -72,6 +79,10 @@ def update_master_repo_command
Repo.new(ARGV.new(['update', 'master']))
end

def run_if_needed
run if !dir.exist?
end

def run
puts "Using push access" if push? && !config.silent
if dir.exist?
Expand Down

0 comments on commit 76d0df7

Please sign in to comment.