cocoapods-check 0.1.1.beta.1 → 0.2.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38dd0d306636bbbf15886d98e25b2d476693be3e
4
- data.tar.gz: 6e4e8cef74676f758b7246e60932e67311883424
3
+ metadata.gz: 4bd9100e3179fd4bda1b6655bb182707243a6f97
4
+ data.tar.gz: cceff5a191e94566eae689e06a09ec7aada0d72d
5
5
  SHA512:
6
- metadata.gz: c8c62dcbda488a41a8cb548e337f6701f00ad38f91cf8453f1929c359ba686bef4431857f8a9fe0e38c85e9977af7f5424473ac789cf56aa5bccb57d41e7dd83
7
- data.tar.gz: 841188e28bab7332ebfdbfd590ceb127f5baf2c7d6cf720184a7949427e2d91b4fa1f1225e4cb389bff8adafb96f3c74ba31ccff32554a8d261ca2c459234028
6
+ metadata.gz: f90dd40da8e0c10a4a075317f2c5ba9c2d86bf00a689bea98595b1bf79e51d1044d96e62bf46e507e9ee52ad72b51d5c8ff3a4562a552a8af6f2f6a630d2024c
7
+ data.tar.gz: 8eddc0d33ced375998793d6f9892881f6f210b7f85b98d5c5bc916b03b7469cb9b4d1e0900958b1bc3dd9bc37dfcd1ed7d7cf3910280c0bbcc31e6db4b591bcb
data/README.md CHANGED
@@ -13,19 +13,21 @@ cocoapods-check displays the differences between locked and installed Pods. It c
13
13
  `pod check` will display a list of Pods that will be installed by running `pod install`:
14
14
 
15
15
  $ pod check
16
- ~SquareData, +SquareItems, ΔSquareTables
16
+ ~SquareData, +SquareItems, ~SquareTables
17
17
  [!] `pod install` will install 3 Pods.
18
18
 
19
- The symbol before each Pod name indicates the status of the Pod. A `~` indicates a version of a Pod exists locally, but the version specified in `Podfile.lock` is different. A `+` indicates no version of the Pod exists locally, while a `Δ` indicates the Pod is a development Pod. Development pods are always assumed to be 'dirty'. Pods that don't require an update will not be listed.
19
+ The symbol before each Pod name indicates the status of the Pod. A `~` indicates a version of a Pod exists locally, but the version specified in `Podfile.lock` is different. A `+` indicates no version of the Pod exists locally. Pods that don't require an update will not be listed. For development pods the modified time of the Pod's files are checked against the modified time of the lockfile to determine whether the Pod needs installation.
20
20
 
21
21
  Verbose mode shows a bit more detail:
22
22
 
23
23
  $ pod check --verbose
24
24
  SquareData 1.2.1 -> 1.2.2
25
25
  SquareItems newly added
26
- SquareTables {:path=>"/Users/doo/Code/SquareTables"}
26
+ SquareTables (SquareTables/SomeSource.m)
27
27
  [!] `pod install` will install 3 Pods.
28
28
 
29
+ For development Pods verbose mode shows the files that are newer than the lockfile in parentheses.
30
+
29
31
  If no Pods are out of date, then the output looks like:
30
32
 
31
33
  $ pod check
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "rake", '~> 10.0'
22
22
  spec.add_development_dependency "rspec"
23
23
 
24
- spec.add_dependency 'cocoapods', '~> 1.0.0.beta.3'
24
+ spec.add_dependency 'cocoapods', '~> 1.0.0.beta'
25
25
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsCheck
2
- VERSION = '0.1.1.beta.1'
2
+ VERSION = '0.2.1.beta.1'
3
3
  end
@@ -11,10 +11,8 @@ module Pod
11
11
  self.description = <<-DESC
12
12
  Compares the Pod lockfile with the manifest lockfile and shows
13
13
  any differences. In non-verbose mode, '~' indicates an existing Pod
14
- will be updated to the version specified in Podfile.lock, '+'
15
- indicates a missing Pod will be installed, and 'Δ' indicates a Pod
16
- is a development Pod. Development Pods are always considered
17
- to need installation.
14
+ will be updated to the version specified in Podfile.lock and '+'
15
+ indicates a missing Pod will be installed.
18
16
  DESC
19
17
 
20
18
  self.arguments = []
@@ -43,7 +41,7 @@ module Pod
43
41
  def find_development_pods(podfile)
44
42
  development_pods = {}
45
43
  podfile.dependencies.each do |dependency|
46
- development_pods[dependency.name] = dependency.external_source if dependency.external?
44
+ development_pods[dependency.name] = dependency.external_source if dependency.local?
47
45
  end
48
46
  development_pods
49
47
  end
@@ -64,10 +62,13 @@ module Pod
64
62
 
65
63
  # If this Pod is installed
66
64
  if manifest_version
65
+ # If this is a development pod do a modified time check
67
66
  if development_pods[spec_name] != nil
68
- if is_development_pod_modified?(config, development_pods[spec_name])
69
- changed_result(spec_name, manifest_version, locked_version)
67
+ newer_files = get_files_newer_than_lockfile_for_podspec(config, development_pods[spec_name])
68
+ if newer_files.any?
69
+ changed_development_result(spec_name, newer_files)
70
70
  end
71
+ # Otherwise just compare versions
71
72
  elsif locked_version != manifest_version
72
73
  changed_result(spec_name, manifest_version, locked_version)
73
74
  end
@@ -79,10 +80,23 @@ module Pod
79
80
  end.compact
80
81
  end
81
82
 
82
- def is_development_pod_modified?(config, development_pod)
83
- development_podspec_file = development_pod[:path]
84
- development_pod_dir = File.dirname(development_podspec_file)
85
- spec = Specification.from_file(development_podspec_file)
83
+ def get_files_newer_than_lockfile_for_podspec(config, development_pod)
84
+ files_for_podspec = get_files_for_podspec(development_pod[:path])
85
+
86
+ lockfile_mtime = File.mtime(config.lockfile.defined_in_file)
87
+ podspec_file = get_podspec_for_file_or_path(development_pod[:path])
88
+ podspec_dir = Pathname.new(File.dirname(podspec_file))
89
+ files_for_podspec
90
+ .select {|f| File.mtime(f) >= lockfile_mtime}
91
+ .map {|f| Pathname.new(f).relative_path_from(podspec_dir).to_s}
92
+ end
93
+
94
+ # Returns an array of all files pointed to by the podspec
95
+ def get_files_for_podspec(podspec_file)
96
+ podspec_file = get_podspec_for_file_or_path(podspec_file)
97
+
98
+ development_pod_dir = File.dirname(podspec_file)
99
+ spec = Specification.from_file(podspec_file)
86
100
 
87
101
  # Gather all the dependencies used by the spec, across all platforms, and including subspecs.
88
102
  all_files = [spec, spec.subspecs].flatten.map { |a_spec|
@@ -102,17 +116,16 @@ module Pod
102
116
  }
103
117
  }.flatten
104
118
 
105
- # Also check the podspec date
106
- all_files.push(development_podspec_file)
107
-
108
- latest_modified_file = all_files.max_by {|f| File.mtime(f)}
119
+ # Include the podspec files as well
120
+ all_files.push(podspec_file)
121
+ end
109
122
 
110
- if latest_modified_file
111
- pod_mtime = File.mtime(latest_modified_file)
112
- manifest_mtime = File.mtime(config.lockfile.defined_in_file)
113
- pod_mtime >= manifest_mtime
123
+ def get_podspec_for_file_or_path(podspec_file_or_path)
124
+ if File.basename(podspec_file_or_path).include?('.podspec')
125
+ podspec_file_or_path
114
126
  else
115
- false
127
+ glob_pattern = podspec_file_or_path + '/*.podspec{,.json}'
128
+ Pathname.glob(glob_pattern).first
116
129
  end
117
130
  end
118
131
 
@@ -124,6 +137,19 @@ module Pod
124
137
  end
125
138
  end
126
139
 
140
+ def changed_development_result(spec_name, newer_files)
141
+ if @check_command_verbose
142
+ number_files_not_shown = newer_files.length - 2
143
+ newer_files = newer_files[0..1]
144
+ if number_files_not_shown > 0
145
+ newer_files.push("and #{number_files_not_shown} other#{'s' if number_files_not_shown > 1}")
146
+ end
147
+ "#{spec_name} (#{newer_files.join(', ')})"
148
+ else
149
+ "~#{spec_name}"
150
+ end
151
+ end
152
+
127
153
  def added_result(spec_name)
128
154
  if @check_command_verbose
129
155
  "#{spec_name} newly added"
@@ -66,7 +66,7 @@ describe Pod::Command::Check do
66
66
 
67
67
  config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
68
68
 
69
- # Make an actual file because 'check' needs the modified time
69
+ # Make an actual lockfile file because 'check' needs the modified time
70
70
  lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
71
71
  allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
72
72
 
@@ -75,11 +75,14 @@ describe Pod::Command::Check do
75
75
 
76
76
  # Create a temp dir with a temp file and run the check in that context
77
77
  Dir.mktmpdir('dev-pod-test-dir') do |dir|
78
+
79
+ # Create a source file
78
80
  source_file = Tempfile.new('some-pod-file', dir)
79
81
 
82
+ # Write a podspec file pointing at the source file
80
83
  File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = '#{File.basename(source_file)}' end")
81
- puts(File.read("#{dir}/foo.podspec"))
82
84
 
85
+ # Do the check
83
86
  development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
84
87
  results = check.find_differences(config, development_pods)
85
88
 
@@ -94,18 +97,21 @@ describe Pod::Command::Check do
94
97
 
95
98
  # Create a temp dir with a temp file and run the check in that context
96
99
  Dir.mktmpdir('dev-pod-test-dir') do |dir|
100
+
101
+ # Create a source file
97
102
  Tempfile.new('some-pod-file', dir)
98
103
 
104
+ # Write a podspec file pointing at the source file
105
+ File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = 'ack' end")
106
+
99
107
  # Ensure lockfile modified time is after development pod modified time
100
108
  sleep(1)
101
109
 
102
- # Make an actual file because 'check' needs the modified time
110
+ # Make an actual lockfile file because 'check' needs the modified time
103
111
  lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
104
112
  allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
105
113
 
106
- puts("#{dir}/foo.podspec")
107
- File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = 'ack' end")
108
-
114
+ # Do the check
109
115
  development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
110
116
  results = check.find_differences(config, development_pods)
111
117
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.beta.1
4
+ version: 0.2.1.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Di Iorio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0.beta.3
61
+ version: 1.0.0.beta
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0.beta.3
68
+ version: 1.0.0.beta
69
69
  description: "'check' plugin for CocoaPods"
70
70
  email:
71
71
  - doo@squareup.com