lib/pod/command/check.rb in cocoapods-check-0.1.0 vs lib/pod/command/check.rb in cocoapods-check-0.1.1.beta.1

- old
+ new

@@ -60,31 +60,60 @@ manifest_version = config.sandbox.manifest.version(spec_name) else manifest_version = nil end - # If this is a development Pod - if development_pods[spec_name] != nil - development_result(spec_name, development_pods[spec_name]) - # If this Pod is installed - elsif manifest_version - if locked_version != manifest_version + if manifest_version + if development_pods[spec_name] != nil + if is_development_pod_modified?(config, development_pods[spec_name]) + changed_result(spec_name, manifest_version, locked_version) + end + elsif locked_version != manifest_version changed_result(spec_name, manifest_version, locked_version) end # If this Pod is not installed else added_result(spec_name) end end.compact end - def development_result(spec_name, external_source) - if @check_command_verbose - "#{spec_name} #{external_source}" + def is_development_pod_modified?(config, development_pod) + development_podspec_file = development_pod[:path] + development_pod_dir = File.dirname(development_podspec_file) + spec = Specification.from_file(development_podspec_file) + + # Gather all the dependencies used by the spec, across all platforms, and including subspecs. + all_files = [spec, spec.subspecs].flatten.map { |a_spec| + a_spec.available_platforms.map { |platform| + accessor = Sandbox::FileAccessor.new(Sandbox::PathList.new(Pathname.new(development_pod_dir)), a_spec.consumer(platform)) + [ + accessor.vendored_frameworks, + accessor.vendored_libraries, + accessor.resource_bundle_files, + accessor.license, + accessor.prefix_header, + accessor.preserve_paths, + accessor.readme, + accessor.resources, + accessor.source_files + ].compact + } + }.flatten + + # Also check the podspec date + all_files.push(development_podspec_file) + + latest_modified_file = all_files.max_by {|f| File.mtime(f)} + + if latest_modified_file + pod_mtime = File.mtime(latest_modified_file) + manifest_mtime = File.mtime(config.lockfile.defined_in_file) + pod_mtime >= manifest_mtime else - "Δ#{spec_name}" + false end end def changed_result(spec_name, manifest_version, locked_version) if @check_command_verbose