lib/cocoapods-binary/Prebuild.rb in cocoapods-binary-0.1.1 vs lib/cocoapods-binary/Prebuild.rb in cocoapods-binary-0.1.2
- old
+ new
@@ -20,11 +20,10 @@
existed_framework_folder = sandbox.generate_framework_path
if local_manifest != nil
changes = local_manifest.detect_changes_with_podfile(podfile)
- Pod::Prebuild.framework_changes = changes # save the chagnes info for later stage
added = changes[:added] || []
changed = changes[:changed] || []
unchanged = changes[:unchanged] || []
deleted = changes[:removed] || []
@@ -36,11 +35,11 @@
unchange_framework_names = added + unchanged
to_delete = exsited_framework_names.select do |framework_name|
not unchange_framework_names.include?(framework_name)
end
to_delete.each do |framework_name|
- path = existed_framework_folder + (framework_name + ".framework")
+ path = sandbox.framework_path_for_pod_name framework_name
path.rmtree if path.exist?
end
# additions
missing = unchanged.select do |pod_name|
@@ -53,11 +52,10 @@
end
end
Pod::Prebuild.build(sandbox_path, existed_framework_folder, targets)
else
- Pod::Prebuild.framework_changes = nil
Pod::Prebuild.build(sandbox_path, existed_framework_folder, self.pod_targets)
end
# Remove useless files
# only keep manifest.lock and framework folder
@@ -77,23 +75,34 @@
define_method(:install!) do
return old_method.bind(self).() unless Pod.is_prebuild_stage
# check if need build frameworks
local_manifest = self.sandbox.manifest
+ Pod::Prebuild.framework_changes = nil
return old_method.bind(self).() if local_manifest == nil
changes = local_manifest.detect_changes_with_podfile(podfile)
added = changes[:added] || []
changed = changes[:changed] || []
unchanged = changes[:unchanged] || []
-
+ deleted = changes[:removed] || []
+ Pod::Prebuild.framework_changes = changes # save the chagnes info for later stage
+
unchange_framework_names = added + unchanged
exsited_framework_names = sandbox.exsited_framework_names
missing = unchanged.select do |pod_name|
not exsited_framework_names.include?(pod_name)
end
-
+
if (added + changed + missing).empty?
+ deleted.each do |framework_name|
+ path = sandbox.framework_path_for_pod_name framework_name
+ if path.exist?
+ path.rmtree
+ UI.puts "Delete #{framework_name}"
+ end
+ end
+
# don't do the install
exsited_framework_names.each do |name|
UI.puts "Using #{name}"
end
return
\ No newline at end of file