cocoapods-core 0.39.0 → 1.0.0.beta.1

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.
@@ -62,18 +62,12 @@ module Pod
62
62
  # @return [Bool] Whether the specifications are equal.
63
63
  #
64
64
  def ==(other)
65
- # TODO
66
- # self.class === other &&
67
- # attributes_hash == other.attributes_hash &&
68
- # subspecs == other.subspecs &&
69
- to_s == other.to_s
65
+ other.is_a?(self.class) &&
66
+ name == other.name &&
67
+ version == other.version
70
68
  end
71
69
 
72
- # @see ==
73
- #
74
- def eql?(other)
75
- self == other
76
- end
70
+ alias_method :eql?, :==
77
71
 
78
72
  # Return the hash value for this specification according to its attributes
79
73
  # hash.
@@ -86,7 +80,7 @@ module Pod
86
80
  # @return [Fixnum] The hash value.
87
81
  #
88
82
  def hash
89
- to_s.hash
83
+ (name.hash * 53) ^ version.hash
90
84
  end
91
85
 
92
86
  # @return [String] A string suitable for representing the specification in
@@ -115,7 +109,6 @@ module Pod
115
109
  # @example Input examples
116
110
  #
117
111
  # "libPusher (1.0)"
118
- # "libPusher (HEAD based on 1.0)"
119
112
  # "RestKit/JSON (1.0)"
120
113
  #
121
114
  # @return [Array<String, Version>] the name and the version of a
@@ -326,12 +319,11 @@ module Pod
326
319
 
327
320
  # @!group DSL helpers
328
321
 
329
- # @return [Bool] whether the specification should use a directory as it
322
+ # @return [Bool] whether the specification should use a directory as its
330
323
  # source.
331
324
  #
332
325
  def local?
333
326
  return true if source[:path]
334
- return true if source[:local]
335
327
  false
336
328
  end
337
329
 
@@ -104,15 +104,15 @@ module Pod
104
104
 
105
105
  # @!method cocoapods_version=(cocoapods_version)
106
106
  #
107
- # The version of CocoaPods that the sepcification supports.
107
+ # The version of CocoaPods that the specification supports.
108
108
  #
109
- # @example
109
+ # @example
110
110
  #
111
- # spec.cocoapods_version = '>= 0.36'
111
+ # spec.cocoapods_version = '>= 0.36'
112
112
  #
113
- # @param [String] cocoapods_version
114
- # the CocoaPods version that the specification supports.
115
- # CocoaPods follows [semantic versioning](http://semver.org).
113
+ # @param [String] cocoapods_version
114
+ # the CocoaPods version that the specification supports.
115
+ # CocoaPods follows [semantic versioning](http://semver.org).
116
116
  #
117
117
  root_attribute :cocoapods_version
118
118
 
@@ -170,19 +170,6 @@ module Pod
170
170
  #
171
171
  root_attribute :social_media_url
172
172
 
173
- # @!method docset_url=(docset_url)
174
- #
175
- # The URL for the docset for the Pod
176
- #
177
- # @example
178
- #
179
- # spec.docset_url = 'http://example.org/KFData/1.0.0/xcode-docset.atom'
180
- #
181
- # @param [String] docset_url
182
- # the docset URL.
183
- #
184
- root_attribute :docset_url
185
-
186
173
  #------------------#
187
174
 
188
175
  # The keys accepted by the license attribute.
@@ -483,7 +470,7 @@ module Pod
483
470
 
484
471
  # @!group Platform
485
472
  #
486
- # A specification should indicate the platforms and the correspondent
473
+ # A specification should indicate the platform and the correspondent
487
474
  # deployment targets on which the library is supported.
488
475
  #
489
476
  # If not defined in a subspec the attributes of this group inherit the
@@ -504,7 +491,8 @@ module Pod
504
491
  :inherited => true
505
492
 
506
493
  # The platform on which this Pod is supported. Leaving this blank
507
- # means the Pod is supported on all platforms.
494
+ # means the Pod is supported on all platforms. When supporting multiple
495
+ # platforms you should use deployment_target below instead.
508
496
  #
509
497
  # @example
510
498
  #
@@ -1156,7 +1144,7 @@ module Pod
1156
1144
  # We strongly **recommend** library developers to adopt [resource
1157
1145
  # bundles](http://guides.cocoapods.org/syntax/podspec.html#resource_bundles)
1158
1146
  # as there can be name collisions using the resources attribute.
1159
- # Moreover resources specified with this attribute are copied
1147
+ # Moreover, resources specified with this attribute are copied
1160
1148
  # directly to the client target and therefore they are not
1161
1149
  # optimised by Xcode.
1162
1150
  #
@@ -4,12 +4,6 @@ module Pod
4
4
  # Provides warning and errors for the deprecated attributes of the DSL.
5
5
  #
6
6
  module Deprecations
7
- def preferred_dependency=(name)
8
- self.default_subspecs = [name]
9
- CoreUI.warn "[#{self}] `preferred_dependency` has been renamed "\
10
- 'to `default_subspecs`.'
11
- end
12
-
13
7
  DSL.attribute :xcconfig,
14
8
  :container => Hash,
15
9
  :inherited => true
@@ -22,20 +22,15 @@ module Pod
22
22
  #
23
23
  def to_hash
24
24
  hash = attributes_hash.dup
25
+ if root? || available_platforms != parent.available_platforms
26
+ platforms = Hash[available_platforms.map { |p| [p.name.to_s, p.deployment_target && p.deployment_target.to_s] }]
27
+ hash['platforms'] = platforms
28
+ end
25
29
  unless subspecs.empty?
26
30
  hash['subspecs'] = subspecs.map(&:to_hash)
27
31
  end
28
32
  hash
29
33
  end
30
-
31
- # @return [Bool] Whether the specification can be converted to a hash
32
- # without loss of information.
33
- #
34
- # TODO: remove
35
- #
36
- def safe_to_hash?
37
- true
38
- end
39
34
  end
40
35
 
41
36
  # Configures a new specification from the given JSON representation.
@@ -77,12 +77,6 @@ module Pod
77
77
  attributes_hash['social_media_url']
78
78
  end
79
79
 
80
- # @return [String] The docset URL.
81
- #
82
- def docset_url
83
- attributes_hash['docset_url']
84
- end
85
-
86
80
  # @return [Hash] A hash containing the license information of the Pod.
87
81
  #
88
82
  # @note The indentation is stripped from the license text.
@@ -38,24 +38,15 @@ module Pod
38
38
  VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z\-]+)*'
39
39
  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/
40
40
 
41
- # @return [Bool] whether the version represents the `head` of repository.
42
- #
43
- attr_accessor :head
44
- alias_method :head?, :head
45
-
46
41
  # @param [String,Version] version
47
42
  # A string representing a version, or another version.
48
43
  #
49
- # @todo The `from` part of the regular expression should be remove in
50
- # CocoaPods 1.0.0.
44
+ # @todo Remove the `HEAD` code once everyone has migrated past 1.0.
51
45
  #
52
46
  def initialize(version)
53
- if version.is_a?(Version) && version.head?
54
- version = version.version
55
- @head = true
56
- elsif version.is_a?(String) && version =~ /HEAD (based on|from) (.*)/
57
- version = Regexp.last_match[2]
58
- @head = true
47
+ if version.is_a?(String) && version =~ /HEAD based on (.*)/
48
+ CoreUI.warn "Ignoring obsolete HEAD specifier in `#{version}`"
49
+ version = Regexp.last_match[1]
59
50
  end
60
51
 
61
52
  raise ArgumentError, "Malformed version number string #{version}" unless
@@ -68,19 +59,6 @@ module Pod
68
59
  #
69
60
  ZERO = new('0')
70
61
 
71
- # @return [String] a string representation that indicates if the version is
72
- # head.
73
- #
74
- # @note The raw version string is still accessible with the {#version}
75
- # method.
76
- #
77
- # @todo Adding the head information to the string representation creates
78
- # issues (see Dependency#requirement).
79
- #
80
- def to_s
81
- head? ? "HEAD based on #{super}" : super
82
- end
83
-
84
62
  # @return [String] a string representation suitable for debugging.
85
63
  #
86
64
  def inspect
@@ -151,6 +129,68 @@ module Pod
151
129
  # @note Attempts to compare something that's not a {Version} return nil
152
130
  #
153
131
  def <=>(other)
132
+ comparison = compare_segments(other)
133
+ comparison == 0 ? version <=> other.version : comparison
134
+ end
135
+
136
+ # @private
137
+ #
138
+ # Compares the versions for equality.
139
+ #
140
+ # @param [Version] other
141
+ # The other version to compare.
142
+ #
143
+ # @return [Boolean] whether the receiver is equal to other.
144
+ #
145
+ # @note Attempts to compare something that's not a {Version} return nil
146
+ #
147
+ def ==(other)
148
+ compare_segments(other) == 0
149
+ end
150
+
151
+ # @private
152
+ #
153
+ # Compares the versions for equality.
154
+ #
155
+ # @param [Version] other
156
+ # The other version to compare.
157
+ #
158
+ # @return [Boolean] whether the receiver is greater than or equal to other.
159
+ #
160
+ # @note Attempts to compare something that's not a {Version} return nil
161
+ #
162
+ def >=(other)
163
+ comparison = compare_segments(other)
164
+ comparison >= 0
165
+ end
166
+
167
+ # @private
168
+ #
169
+ # Compares the versions for equality.
170
+ #
171
+ # @param [Version] other
172
+ # The other version to compare.
173
+ #
174
+ # @return [Boolean] whether the receiver is less than or equal to other.
175
+ #
176
+ # @note Attempts to compare something that's not a {Version} return nil
177
+ #
178
+ def <=(other)
179
+ comparison = compare_segments(other)
180
+ comparison <= 0
181
+ end
182
+
183
+ protected
184
+
185
+ def numeric_segments
186
+ segments.take_while { |s| s.is_a?(Numeric) }.reverse_each.drop_while { |s| s == 0 }.reverse
187
+ end
188
+
189
+ def prerelease_segments
190
+ segments.drop_while { |s| s.is_a?(Numeric) }
191
+ end
192
+
193
+ def compare_segments(other)
154
194
  return unless other.is_a?(Pod::Version)
155
195
  return 0 if @version == other.version
156
196
 
@@ -170,18 +210,7 @@ module Pod
170
210
 
171
211
  compare[numeric_segments, other.numeric_segments]
172
212
  compare[prerelease_segments, other.prerelease_segments]
173
-
174
- version <=> other.version
175
- end
176
-
177
- protected
178
-
179
- def numeric_segments
180
- segments.take_while { |s| s.is_a?(Numeric) }.reverse_each.drop_while { |s| s == 0 }.reverse
181
- end
182
-
183
- def prerelease_segments
184
- segments.drop_while { |s| s.is_a?(Numeric) }
213
+ 0
185
214
  end
186
215
 
187
216
  #-------------------------------------------------------------------------#
@@ -96,7 +96,7 @@ module Pod
96
96
  case value
97
97
  when Array then process_array(value)
98
98
  when Hash then process_hash(value, hash_keys_hint)
99
- else YAML.dump(value).sub(/\A---/, '').sub(/[.]{3}\s*\Z/, '').strip
99
+ else YAML.dump(value, :line_width => -1).sub(/\A---/, '').sub(/[.]{3}\s*\Z/, '')
100
100
  end.strip
101
101
  end
102
102
 
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: 0.39.0
4
+ version: 1.0.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-09 00:00:00.000000000 Z
12
+ date: 2015-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -78,6 +78,9 @@ executables: []
78
78
  extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
+ - LICENSE
82
+ - README.md
83
+ - lib/cocoapods-core.rb
81
84
  - lib/cocoapods-core/core_ui.rb
82
85
  - lib/cocoapods-core/dependency.rb
83
86
  - lib/cocoapods-core/gem_version.rb
@@ -86,37 +89,34 @@ files:
86
89
  - lib/cocoapods-core/lockfile.rb
87
90
  - lib/cocoapods-core/metrics.rb
88
91
  - lib/cocoapods-core/platform.rb
92
+ - lib/cocoapods-core/podfile.rb
89
93
  - lib/cocoapods-core/podfile/dsl.rb
90
94
  - lib/cocoapods-core/podfile/target_definition.rb
91
- - lib/cocoapods-core/podfile.rb
92
95
  - lib/cocoapods-core/requirement.rb
96
+ - lib/cocoapods-core/source.rb
93
97
  - lib/cocoapods-core/source/acceptor.rb
94
98
  - lib/cocoapods-core/source/aggregate.rb
95
99
  - lib/cocoapods-core/source/health_reporter.rb
96
- - lib/cocoapods-core/source.rb
100
+ - lib/cocoapods-core/specification.rb
97
101
  - lib/cocoapods-core/specification/consumer.rb
102
+ - lib/cocoapods-core/specification/dsl.rb
98
103
  - lib/cocoapods-core/specification/dsl/attribute.rb
99
104
  - lib/cocoapods-core/specification/dsl/attribute_support.rb
100
105
  - lib/cocoapods-core/specification/dsl/deprecations.rb
101
106
  - lib/cocoapods-core/specification/dsl/platform_proxy.rb
102
- - lib/cocoapods-core/specification/dsl.rb
103
107
  - lib/cocoapods-core/specification/json.rb
108
+ - lib/cocoapods-core/specification/linter.rb
104
109
  - lib/cocoapods-core/specification/linter/analyzer.rb
105
110
  - lib/cocoapods-core/specification/linter/result.rb
106
- - lib/cocoapods-core/specification/linter.rb
107
111
  - lib/cocoapods-core/specification/root_attribute_accessors.rb
108
- - lib/cocoapods-core/specification/set/presenter.rb
109
112
  - lib/cocoapods-core/specification/set.rb
110
- - lib/cocoapods-core/specification.rb
113
+ - lib/cocoapods-core/specification/set/presenter.rb
111
114
  - lib/cocoapods-core/standard_error.rb
115
+ - lib/cocoapods-core/vendor.rb
112
116
  - lib/cocoapods-core/vendor/requirement.rb
113
117
  - lib/cocoapods-core/vendor/version.rb
114
- - lib/cocoapods-core/vendor.rb
115
118
  - lib/cocoapods-core/version.rb
116
119
  - lib/cocoapods-core/yaml_helper.rb
117
- - lib/cocoapods-core.rb
118
- - README.md
119
- - LICENSE
120
120
  homepage: https://github.com/CocoaPods/CocoaPods
121
121
  licenses:
122
122
  - MIT
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubyforge_project:
140
- rubygems_version: 2.0.14.1
140
+ rubygems_version: 2.5.1
141
141
  signing_key:
142
142
  specification_version: 3
143
143
  summary: The models of CocoaPods