cocoapods-core 1.3.1 → 1.4.0.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: 96af737ecf934debea04d7435690a369c6f23560
4
- data.tar.gz: 336c3874933dc9d7176bba6c8195365b23e34e56
3
+ metadata.gz: 124e2ed7abb0379ce9ee365c6ced5ea69ff08865
4
+ data.tar.gz: 877153422ec76b1f609d8c21410ab76942e2052c
5
5
  SHA512:
6
- metadata.gz: 2f1d8ae60360d5bc05fb344fcd63a4347a1df6cb9a48bc76337e2f32cdd6ab8bc384d93dcf5dadb033af42eb9b49b99a8451a28ecfddd3efb6fb9b573e8dcdaf
7
- data.tar.gz: 0aa890f8197e50892c1ea190b83e3d8596fffa578866adf5f7568ee36104f1d5ac90c05bb924db947f4fe9f58bcb1f520e99de76a154765e795ba385b5176f79
6
+ metadata.gz: cb481a17edf85583140125d9b9b25b5f079edb1354fcf023f71b28f41c95a5c1069f4947cf63b5c8db8345c2851d6977aef705fcbc5884a7f336ffaf347f4005
7
+ data.tar.gz: 2516b6cb3b755936f8d969f1a348804e9634634f4cb848e2e9690f03a2b3e797730092b5904860cab9568f22d32dab1be6ebfa5be6c613c1c4c1217016d2648e
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods-core.
3
3
  #
4
- CORE_VERSION = '1.3.1'.freeze unless defined? Pod::CORE_VERSION
4
+ CORE_VERSION = '1.4.0.beta.1'.freeze unless defined? Pod::CORE_VERSION
5
5
  end
@@ -334,6 +334,48 @@ module Pod
334
334
  self.current_target_definition = parent
335
335
  end
336
336
 
337
+ # Adds a script phase to be integrated with this target. A script phase can be used to execute an arbitrary
338
+ # script that can use all Xcode environment variables during execution. A target may include multiple script
339
+ # phases which they will be added in the order they were declared. Deleting a script phase will effectively remove
340
+ # it from the target if it has been added previously.
341
+ #
342
+ # @example
343
+ # script_phase :name => 'HelloWorldScript', :script => 'echo "Hello World"'
344
+ #
345
+ # @example
346
+ # script_phase :name => 'HelloWorldScript', :script => 'puts "Hello World"', :shell_path => '/usr/bin/ruby'
347
+ #
348
+ # @param [Hash] options
349
+ # the options for this script phase.
350
+ #
351
+ # @option options [String] :name
352
+ # the name of the script phase. This option is required.
353
+ #
354
+ # @option options [String] :script
355
+ # the body of the script to execute. This option is required.
356
+ #
357
+ # @option options [String] :shell_path
358
+ # the shell path to use for this script phase, for example `/usr/bin/ruby` to use Ruby for this phase.
359
+ #
360
+ # @option options [Array<String>] :input_paths
361
+ # the input paths to use for script. This is used by Xcode to determine whether to re-execute this
362
+ # script phase if the input paths have changed or not.
363
+ #
364
+ # @option options [Array<String>] :output_paths
365
+ # the output paths to use for script. This is used by Xcode to avoid re-executing this script phase if
366
+ # none of the output paths have changed.
367
+ #
368
+ # @option options [Boolean] :show_env_vars_in_log
369
+ # whether this script phase should output the environment variables during execution.
370
+ #
371
+ # @return [void]
372
+ #
373
+ def script_phase(options)
374
+ raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?
375
+ raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?
376
+ current_target_definition.store_script_phase(options)
377
+ end
378
+
337
379
  # Defines a new abstract target that can be used for convenient
338
380
  # target dependency inheritance.
339
381
  #
@@ -288,6 +288,14 @@ module Pod
288
288
 
289
289
  #--------------------------------------#
290
290
 
291
+ # @return [Array<Hash>] The list of the script phases of the target definition.
292
+ #
293
+ def script_phases
294
+ get_hash_value('script_phases') || []
295
+ end
296
+
297
+ #--------------------------------------#
298
+
291
299
  # @return [Bool] whether the target definition should inhibit warnings
292
300
  # for a single pod. If inhibit_all_warnings is true, it will
293
301
  # return true for any asked pod.
@@ -575,6 +583,41 @@ module Pod
575
583
  end
576
584
  end
577
585
 
586
+ #--------------------------------------#
587
+
588
+ SCRIPT_PHASE_REQUIRED_KEYS = [:name, :script].freeze
589
+
590
+ SCRIPT_PHASE_OPTIONAL_KEYS = [:shell_path, :input_files, :output_files, :show_env_vars_in_log].freeze
591
+
592
+ ALL_SCRIPT_PHASE_KEYS = (SCRIPT_PHASE_REQUIRED_KEYS + SCRIPT_PHASE_OPTIONAL_KEYS).freeze
593
+
594
+ # Stores the script phase to add for this target definition.
595
+ #
596
+ # @param [Hash] options
597
+ # The options to use for this script phase. The required keys
598
+ # are: `:name`, `:script`, while the optional keys are:
599
+ # `:shell_path`, `:input_files`, `:output_files` and `:show_env_vars_in_log`.
600
+ #
601
+ # @return [void]
602
+ #
603
+ def store_script_phase(options)
604
+ option_keys = options.keys
605
+ unrecognized_keys = option_keys - ALL_SCRIPT_PHASE_KEYS
606
+ unless unrecognized_keys.empty?
607
+ raise StandardError, "Unrecognized options `#{unrecognized_keys}` in shell script `#{options}` within `#{name}` target. " \
608
+ "Available options are `#{ALL_SCRIPT_PHASE_KEYS}`."
609
+ end
610
+ missing_required_keys = SCRIPT_PHASE_REQUIRED_KEYS - option_keys
611
+ unless missing_required_keys.empty?
612
+ raise StandardError, "Missing required shell script phase options `#{missing_required_keys.join(', ')}`"
613
+ end
614
+ script_phases_hash = get_hash_value('script_phases', [])
615
+ if script_phases_hash.map { |script_phase_options| script_phase_options[:name] }.include?(options[:name])
616
+ raise StandardError, "Script phase with name `#{options[:name]}` name already present for target `#{name}`."
617
+ end
618
+ script_phases_hash << options
619
+ end
620
+
578
621
  #-----------------------------------------------------------------------#
579
622
 
580
623
  public
@@ -595,6 +638,7 @@ module Pod
595
638
  user_project_path
596
639
  build_configurations
597
640
  dependencies
641
+ script_phases
598
642
  children
599
643
  configuration_pod_whitelist
600
644
  uses_frameworks
@@ -877,7 +921,8 @@ module Pod
877
921
  end if subspecs
878
922
 
879
923
  test_specs.each do |ss|
880
- store_pod("#{name}/#{ss}", *requirements.dup)
924
+ requirements_copy = requirements.map(&:dup)
925
+ store_pod("#{name}/#{ss}", *requirements_copy)
881
926
  end if test_specs
882
927
 
883
928
  requirements.pop if options.empty?
@@ -138,6 +138,11 @@ module Pod
138
138
 
139
139
  # @!group Test Support
140
140
 
141
+ # @return [Bool] Whether this test specification requires an app host.
142
+ #
143
+ spec_attr_accessor :requires_app_host
144
+ alias_method :requires_app_host?, :requires_app_host
145
+
141
146
  # @return [Symbol] the test type supported by this specification.
142
147
  #
143
148
  spec_attr_accessor :test_type
@@ -486,7 +486,7 @@ module Pod
486
486
  # spec.deprecated = true
487
487
  #
488
488
  # @param [Bool] flag
489
- # whether the library has been deprecated.
489
+ # whether the library has been deprecated.
490
490
  #
491
491
  root_attribute :deprecated,
492
492
  :types => [TrueClass, FalseClass],
@@ -1363,7 +1363,24 @@ module Pod
1363
1363
  # The test type to use.
1364
1364
  attribute :test_type,
1365
1365
  :types => [Symbol, String],
1366
- :multi_platform => false
1366
+ :multi_platform => false,
1367
+ :test_only => true
1368
+
1369
+ # @!method requires_app_host=(flag)
1370
+ #
1371
+ # Whether a test specification requires an app host to run tests. This only applies to test specifications.
1372
+ #
1373
+ # @example
1374
+ #
1375
+ # test_spec.requires_app_host = true
1376
+ #
1377
+ # @param [Bool] flag
1378
+ # whether a test specification requires an app host to run tests.
1379
+ #
1380
+ attribute :requires_app_host,
1381
+ :types => [TrueClass, FalseClass],
1382
+ :default_value => false,
1383
+ :test_only => true
1367
1384
 
1368
1385
  # Represents a test specification for the library. Here you can place all
1369
1386
  # your tests for your podspec along with the test dependencies.
@@ -31,6 +31,7 @@ module Pod
31
31
 
32
32
  @multi_platform = options.delete(:multi_platform) { true }
33
33
  @root_only = options.delete(:root_only) { false }
34
+ @test_only = options.delete(:test_only) { false }
34
35
  @inherited = options.delete(:inherited) { @root_only }
35
36
  @required = options.delete(:required) { false }
36
37
  @singularize = options.delete(:singularize) { false }
@@ -121,6 +122,13 @@ module Pod
121
122
  @root_only
122
123
  end
123
124
 
125
+ # @return [Bool] whether the attribute should be specified only on
126
+ # test specifications.
127
+ #
128
+ def test_only?
129
+ @test_only
130
+ end
131
+
124
132
  # @return [Bool] whether the attribute is multi-platform and should
125
133
  # work in conjunction with #{PlatformProxy}.
126
134
  #
@@ -218,6 +218,8 @@ module Pod
218
218
 
219
219
  # @!group Root spec validation helpers
220
220
 
221
+ # Performs validations related to the `authors` attribute.
222
+ #
221
223
  def _validate_authors(a)
222
224
  if a.is_a? Hash
223
225
  if a == { 'YOUR NAME HERE' => 'YOUR EMAIL HERE' }
@@ -227,6 +229,8 @@ module Pod
227
229
  end
228
230
  end
229
231
 
232
+ # Performs validations related to the `version` attribute.
233
+ #
230
234
  def _validate_version(v)
231
235
  if v.to_s.empty?
232
236
  results.add_error('version', 'A version is required.')
@@ -237,6 +241,7 @@ module Pod
237
241
  end
238
242
 
239
243
  # Performs validations related to the `module_name` attribute.
244
+ #
240
245
  def _validate_module_name(m)
241
246
  unless m.nil? || m =~ /^[a-z_][0-9a-z_]*$/i
242
247
  results.add_error('module_name', 'The module name of a spec' \
@@ -379,11 +384,9 @@ module Pod
379
384
  end
380
385
  end
381
386
 
387
+ # Performs validations related to the `test_type` attribute.
388
+ #
382
389
  def _validate_test_type(t)
383
- unless consumer.spec.test_specification?
384
- results.add_error('test_type', 'Test type can only be used for test specifications.')
385
- return
386
- end
387
390
  supported_test_types = Specification::DSL::SUPPORTED_TEST_TYPES.map(&:to_s)
388
391
  unless supported_test_types.include?(t.to_s)
389
392
  results.add_error('test_type', "The test type `#{t}` is not supported. " \
@@ -140,6 +140,10 @@ module Pod
140
140
  results.add_error('attributes', "Can't set `#{attribute.name}` attribute for " \
141
141
  "subspecs (in `#{consumer.spec.name}`).")
142
142
  end
143
+ if attribute.test_only? && !value.nil? && !consumer.spec.test_specification?
144
+ results.add_error('attributes', "Attribute `#{attribute.name}` can only be set " \
145
+ "within test specs (in `#{consumer.spec.name}`).")
146
+ end
143
147
  end
144
148
 
145
149
  # Validates the given value for the given attribute.
@@ -42,6 +42,11 @@ module Pod
42
42
  # is used to disambiguate.
43
43
  #
44
44
  def specification
45
+ unless highest_version_spec_path
46
+ raise Informative, "Could not find the highest version for `#{name}`. "\
47
+ "This could be due to an empty #{name} directory in a local repository."
48
+ end
49
+
45
50
  Specification.from_file(highest_version_spec_path)
46
51
  end
47
52
 
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.3.1
4
+ version: 1.4.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: 2017-08-06 00:00:00.000000000 Z
12
+ date: 2017-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport