cocoapods-core 1.0.0.beta.5 → 1.0.0.beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76708b23bcc64b18355ee04008aebc0aaa54fad2
4
- data.tar.gz: c11c210e6b36496813245f9b9635821925697d35
3
+ metadata.gz: b116f2a8b2c3c090b6aada3e046db9d3515e538a
4
+ data.tar.gz: e4f97aed43c5b3ddc85381673e863a414796def1
5
5
  SHA512:
6
- metadata.gz: 516cd6d40cd2dcbac3b2609b121b48bcac240ceaf53fbfa34e3fd82eab31a829b35754de36acf237a97d1738b5bbbd51f3590c7cc15f71308692d4431bb51eca
7
- data.tar.gz: 435f074158033ca5a786f5c8b150e94c74df2eb02b967b435ca14ac302cc268250a3a08bda9bbde5076116546d3028a4d1f3fb8b89c84732346dbef15c2bd206
6
+ metadata.gz: b06b2f5053a53c500861559f776f65864128c2144b1e5a7bff34d40c78811fa952b70ee112e3a2f18475962049a1e3258da1b0d32c78aa0f62ab961d4a24fe3c
7
+ data.tar.gz: 123a0a4674f478085c4abc1ba8d63b155c20b3fbc16d93b399bac5ebd0ff2d6914bb49baf8c730093a086881c61868f0829010737a5226c7a5a61ee5afbf5344
@@ -27,6 +27,7 @@ module Pod
27
27
  autoload :Platform, 'cocoapods-core/platform'
28
28
  autoload :Podfile, 'cocoapods-core/podfile'
29
29
  autoload :Source, 'cocoapods-core/source'
30
+ autoload :MasterSource, 'cocoapods-core/master_source'
30
31
  autoload :Specification, 'cocoapods-core/specification'
31
32
  autoload :StandardError, 'cocoapods-core/standard_error'
32
33
  autoload :YAMLHelper, 'cocoapods-core/yaml_helper'
@@ -253,13 +253,13 @@ module Pod
253
253
  self_req = requirement
254
254
  other_req = other.requirement
255
255
 
256
- if other_req == default
257
- dep = self.class.new(name, self_req)
258
- elsif self_req == default
259
- dep = self.class.new(name, other_req)
260
- else
261
- dep = self.class.new(name, self_req.as_list.concat(other_req.as_list))
262
- end
256
+ dep = if other_req == default
257
+ self.class.new(name, self_req)
258
+ elsif self_req == default
259
+ self.class.new(name, other_req)
260
+ else
261
+ self.class.new(name, self_req.as_list.concat(other_req.as_list))
262
+ end
263
263
 
264
264
  if external_source || other.external_source
265
265
  self_external_source = external_source || {}
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.0.0.beta.5'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.0.0.beta.6'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -76,6 +76,32 @@ module Pod
76
76
  end
77
77
  end
78
78
 
79
+ # Returns whether the repository has been updated since a given commit.
80
+ # If the request fails, the response will be true as the API is still in
81
+ # beta and likely to change.
82
+ #
83
+ # @param [String] url @see #repo
84
+ #
85
+ # @param [String] commit
86
+ # The current HEAD commit.
87
+ #
88
+ # @return [Bool] Whether the repository has been updated since the commit.
89
+ #
90
+ def self.modified_since_commit(url, commit)
91
+ return true unless repo_id = normalized_repo_id(url)
92
+ require 'rest'
93
+ request_url = "https://api.github.com/repos/#{repo_id}/commits/master"
94
+ headers = {
95
+ 'User-Agent' => 'CocoaPods',
96
+ 'Accept' => 'application/vnd.github.chitauri-preview+sha',
97
+ 'If-None-Match' => %("#{commit}"),
98
+ }
99
+ response = REST.get(request_url, headers)
100
+ code = response.status_code
101
+
102
+ code != 304
103
+ end
104
+
79
105
  private
80
106
 
81
107
  # @!group Private helpers
@@ -0,0 +1,35 @@
1
+ module Pod
2
+ class MasterSource < Source
3
+ # @!group Updating the source
4
+ #-------------------------------------------------------------------------#
5
+
6
+ # Updates the local clone of the source repo.
7
+ #
8
+ # @param [Bool] show_output
9
+ #
10
+ # @return [Array<String>] changed_spec_paths
11
+ # Returns the list of changed spec paths.
12
+ #
13
+ def update(show_output)
14
+ if requires_update?
15
+ super
16
+ else
17
+ []
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ # Returns whether a source requires updating.
24
+ #
25
+ # @param [Source] source
26
+ # The source to check.
27
+ #
28
+ # @return [Bool] Whether the given source should be updated.
29
+ #
30
+ def requires_update?
31
+ commit_hash = Dir.chdir(repo) { git_commit_hash }
32
+ GitHub.modified_since_commit('CocoaPods/Specs', commit_hash)
33
+ end
34
+ end
35
+ end
@@ -82,11 +82,11 @@ module Pod
82
82
  requirements.compact!
83
83
  requirements.uniq!
84
84
 
85
- if requirements.empty?
86
- @requirements = [DefaultRequirement]
87
- else
88
- @requirements = requirements.map! { |r| self.class.parse r }
89
- end
85
+ @requirements = if requirements.empty?
86
+ [DefaultRequirement]
87
+ else
88
+ requirements.map! { |r| self.class.parse r }
89
+ end
90
90
  end
91
91
 
92
92
  #
@@ -21,7 +21,7 @@ module Pod
21
21
  # @param [Pathname, String] repo @see #repo.
22
22
  #
23
23
  def initialize(repo)
24
- @repo = Pathname.new(repo)
24
+ @repo = Pathname(repo).expand_path
25
25
  end
26
26
 
27
27
  # @return [String] The name of the source.
@@ -39,9 +39,9 @@ module Pod
39
39
  #
40
40
  def url
41
41
  Dir.chdir(repo) do
42
- remote = `git config --get remote.origin.url`.chomp
42
+ remote = git(%w(config --get remote.origin.url))
43
43
 
44
- if $?.success?
44
+ if !remote.empty?
45
45
  remote
46
46
  elsif (repo + '.git').exist?
47
47
  "file://#{repo}/.git"
@@ -325,6 +325,11 @@ module Pod
325
325
  # @group Private Helpers
326
326
  #-------------------------------------------------------------------------#
327
327
 
328
+ def ensure_in_repo!
329
+ return if Pathname.pwd == repo
330
+ raise 'Must be in the root of the repo'
331
+ end
332
+
328
333
  # Loads the specification for the given Pod gracefully.
329
334
  #
330
335
  # @param [String] name
@@ -363,16 +368,25 @@ module Pod
363
368
  end
364
369
 
365
370
  def git_commit_hash
366
- (`git rev-parse HEAD` || '').strip
371
+ ensure_in_repo!
372
+ git(%w(rev-parse HEAD))
367
373
  end
368
374
 
369
375
  def update_git_repo(show_output = false)
370
- output = `git pull --ff-only 2>&1`
376
+ ensure_in_repo!
377
+ output = git(%w(pull --ff-only), :include_error => true)
371
378
  CoreUI.puts output if show_output
372
379
  end
373
380
 
374
381
  def diff_until_commit_hash(commit_hash)
375
- (`git diff --name-only #{commit_hash}..HEAD` || '').strip.split("\n")
382
+ ensure_in_repo!
383
+ git(%W(diff --name-only #{commit_hash}..HEAD)).split("\n")
384
+ end
385
+
386
+ def git(args, include_error: false)
387
+ command = 'git ' << args.join(' ')
388
+ command << ' 2>&1' if include_error
389
+ (`#{command}` || '').strip
376
390
  end
377
391
 
378
392
  #-------------------------------------------------------------------------#
@@ -3,20 +3,14 @@ module Pod
3
3
  # The Aggregate manages a directory of sources repositories.
4
4
  #
5
5
  class Aggregate
6
- # @return [Array<Pathname>] The ordered list of source directories.
6
+ # @return [Array<Source>] The ordered list of sources.
7
7
  #
8
- attr_reader :directories
8
+ attr_reader :sources
9
9
 
10
- # @param [Array<Pathname>] repos_dirs @see directories
10
+ # @param [Array<Source>] repos_dirs @see Sources
11
11
  #
12
- def initialize(repos_dirs)
13
- @directories = Array(repos_dirs)
14
- end
15
-
16
- # @return [Array<Source>] The ordered list of the sources.
17
- #
18
- def sources
19
- @sources ||= directories.map { |repo| Source.new(repo) }
12
+ def initialize(sources)
13
+ @sources = sources
20
14
  end
21
15
 
22
16
  # @return [Array<String>] the names of all the pods available.
@@ -265,13 +265,13 @@ module Pod
265
265
  # @return [Array<Dependency>] the dependencies on subspecs.
266
266
  #
267
267
  def subspec_dependencies(platform = nil)
268
- if default_subspecs.empty?
269
- specs = subspecs.compact
270
- else
271
- specs = default_subspecs.map do |subspec_name|
272
- root.subspec_by_name("#{name}/#{subspec_name}")
273
- end
274
- end
268
+ specs = if default_subspecs.empty?
269
+ subspecs.compact
270
+ else
271
+ default_subspecs.map do |subspec_name|
272
+ root.subspec_by_name("#{name}/#{subspec_name}")
273
+ end
274
+ end
275
275
  if platform
276
276
  specs = specs.select { |s| s.supported_on_platform?(platform) }
277
277
  end
@@ -513,11 +513,11 @@ module Pod
513
513
  #
514
514
  def platform=(args)
515
515
  name, deployment_target = args
516
- if name
517
- attributes_hash['platforms'] = { name.to_s => deployment_target }
518
- else
519
- attributes_hash['platforms'] = {}
520
- end
516
+ attributes_hash['platforms'] = if name
517
+ { name.to_s => deployment_target }
518
+ else
519
+ {}
520
+ end
521
521
  end
522
522
 
523
523
  #------------------#
@@ -122,11 +122,11 @@ module Pod
122
122
  def deprecation_description
123
123
  if spec.deprecated?
124
124
  description = '[DEPRECATED'
125
- if spec.deprecated_in_favor_of.nil?
126
- description += ']'
127
- else
128
- description += " in favor of #{spec.deprecated_in_favor_of}]"
129
- end
125
+ description += if spec.deprecated_in_favor_of.nil?
126
+ ']'
127
+ else
128
+ " in favor of #{spec.deprecated_in_favor_of}]"
129
+ end
130
130
 
131
131
  description
132
132
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta.5
4
+ version: 1.0.0.beta.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-07 00:00:00.000000000 Z
12
+ date: 2016-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: 4.0.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: 4.0.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: nap
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: fuzzy_match
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: 2.0.4
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: 2.0.4
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: bacon
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.1'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.1'
70
70
  description: |-
@@ -87,6 +87,7 @@ files:
87
87
  - lib/cocoapods-core/github.rb
88
88
  - lib/cocoapods-core/http.rb
89
89
  - lib/cocoapods-core/lockfile.rb
90
+ - lib/cocoapods-core/master_source.rb
90
91
  - lib/cocoapods-core/metrics.rb
91
92
  - lib/cocoapods-core/platform.rb
92
93
  - lib/cocoapods-core/podfile.rb
@@ -127,17 +128,17 @@ require_paths:
127
128
  - lib
128
129
  required_ruby_version: !ruby/object:Gem::Requirement
129
130
  requirements:
130
- - - ">="
131
+ - - '>='
131
132
  - !ruby/object:Gem::Version
132
133
  version: 2.0.0
133
134
  required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - ">="
136
+ - - '>='
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  requirements: []
139
140
  rubyforge_project:
140
- rubygems_version: 2.6.1
141
+ rubygems_version: 2.6.2
141
142
  signing_key:
142
143
  specification_version: 3
143
144
  summary: The models of CocoaPods