Permalink
Browse files

[Install/Update] second iteration.

  • Loading branch information...
fabiopelosin committed Aug 13, 2012
1 parent edea0a1 commit 9cbb2dfd734e349883de3bf6727adc0857a1279f
@@ -36,16 +36,16 @@ def run
sandbox = Sandbox.new(config.project_pods_root)
resolver = Resolver.new(podfile, lockfile, sandbox)
resolver.update_mode = true
- resolver.updated_external_specs = false
+ resolver.update_external_specs = false
resolver.resolve
- specs_to_install = resolver.specs_to_install
- external_pods = resolver.external_pods
+ pods_to_install = resolver.pods_to_install
+ external_pods = resolver.pods_from_external_sources
known_update_specs = []
head_mode_specs = []
resolver.specs.each do |s|
next if external_pods.include?(s.name)
- next unless specs_to_install.include?(s.name)
+ next unless pods_to_install.include?(s.name)
if s.version.head?
head_mode_specs << s.name
@@ -54,7 +54,7 @@ def run
end
end
- if specs_to_install.empty?
+ if pods_to_install.empty?
puts "\nNo updates are available.\n".yellow
else
@@ -101,6 +101,10 @@ def specification_from_sandbox(sandbox, platform)
@external_source.specification_from_sandbox(sandbox, platform)
end
+ def match_version?(version)
+ match?(name, version) && (version.head? == head?)
+ end
+
# Taken from RubyGems 1.3.7
unless public_method_defined?(:match?)
def match?(spec_name, spec_version)
@@ -139,6 +143,7 @@ def merge other
module ExternalSources
def self.from_params(name, params)
+ return unless name && params
if params.key?(:git)
GitSource.new(name, params)
elsif params.key?(:podspec)
@@ -172,9 +177,9 @@ def specification_from_external(sandbox, platform)
specification_from_local(sandbox, platform)
end
- def ==(other_source)
- return if other_source.nil?
- name == other_source.name && params == other_source.params
+ def ==(other)
+ return if other.nil?
+ name == other.name && params == other.params
end
end
@@ -79,6 +79,7 @@ def update_cache
git! "reset --hard HEAD"
git! "clean -d -x -f"
git! "pull origin master"
+ git! "fetch --tags"
end
end
View
@@ -58,18 +58,16 @@ def install_dependencies!
end
if should_install
- pod.implode
- download_pod(pod)
- # This will not happen if the pod existed before we started the install
- # process.
- if pod.downloaded?
- # The docs need to be generated before cleaning because the
- # documentation is created for all the subspecs.
- generate_docs(pod)
- # Here we clean pod's that just have been downloaded or have been
- # pre-downloaded in AbstractExternalSource#specification_from_sandbox.
- pod.clean! if config.clean?
+ unless pod.downloaded?
+ pod.implode
+ download_pod(pod)
end
+ # The docs need to be generated before cleaning because the
+ # documentation is created for all the subspecs.
+ generate_docs(pod)
+ # Here we clean pod's that just have been downloaded or have been
+ # pre-downloaded in AbstractExternalSource#specification_from_sandbox.
+ pod.clean! if config.clean?
end
end
end
@@ -100,12 +98,26 @@ def generate_docs(pod)
end
end
+ # @TODO: use the local pod implode
+ #
+ def remove_deleted_dependencies!
+ resolver.removed_pods.each do |pod_name|
+ marker = config.verbose ? "\n-> ".red : ''
+ path = sandbox.root + pod_name
+ puts marker << "Removing #{pod_name}".red
+ path.rmtree if path.exist?
+ end
+ end
+
def install!
@sandbox.prepare_for_install
print_title "Resolving dependencies of: #{@podfile.defined_in_file}"
specs_by_target
+ print_title "Removing deleted dependencies" unless resolver.removed_pods.empty?
+ remove_deleted_dependencies!
+
print_title "Installing dependencies"
install_dependencies!
@@ -123,12 +135,12 @@ def install!
# Post install hooks run _before_ saving of project, so that they can alter it before saving.
run_post_install_hooks
- puts "- Writing Xcode project file to `#{@sandbox.project_path}'\n\n" if config.verbose?
+ puts "- Writing Xcode project file to `#{@sandbox.project_path}'" if config.verbose?
project.save_as(@sandbox.project_path)
puts "- Writing lockfile in `#{config.project_lockfile}'\n\n" if config.verbose?
- @lockfile = Lockfile.create(config.project_lockfile, @podfile, specs_by_target.values.flatten)
- @lockfile.write_to_disk
+ @lockfile = Lockfile.generate(@podfile, specs_by_target.values.flatten)
+ @lockfile.write_to_disk(config.project_lockfile)
UserProjectIntegrator.new(@podfile).integrate! if config.integrate_targets?
end
Oops, something went wrong.

0 comments on commit 9cbb2df

Please sign in to comment.