Module: Pod::Specification::DSL::Deprecations

Included in:
Pod::Specification
Defined in:
lib/cocoapods-core/specification/dsl/deprecations.rb

Overview

Provides warning and errors for the deprecated attributes of the DSL.

Constant Summary collapse

DEPRECATED_METHODS =
[
  :part_of_dependency=,
  :part_of=,
  :exclude_header_search_paths=,
]

Hooks The specification class provides hooks which are called by CocoaPods when a Pod is installed. collapse

Instance Method Summary collapse

Instance Method Details

#clean_paths=(value) ⇒ Object

Raises:



47
48
49
50
51
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 47

def clean_paths=(value)
  raise Informative, "[#{self}] Clean paths are deprecated. " \
    "CocoaPods now cleans unused files by default. Use the " \
      "`preserve_paths` attribute if needed."
end

#documentation=(value) ⇒ Object



42
43
44
45
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 42

def documentation=(value)
  CoreUI.warn "[#{self}] The `documentation` DSL directive of the " \
    "podspec format has been deprecated."
end

#post_install(&block) ⇒ Object

This is a convenience method which gets called after all pods have been downloaded, installed, and the Xcode project and related files have been generated. Note that this hook is called for each Pods library and only for installations where the Pod is installed.

To modify and generate files for the Pod the pre install hook should be used instead of this one.

It receives a [‘Pod::Hooks::LibraryRepresentation`](docs.cocoapods.org/cocoapods/pod/hooks/libraryrepresentation/) instance for the current target.

Override this to, for instance, add to the prefix header.

Examples:


spec.post_install do |library_representation|
  prefix_header = library_representation.prefix_header_path
  prefix_header.open('a') do |file|
    file.puts('#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif')
  end
end


125
126
127
128
129
130
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 125

def post_install(&block)
  CoreUI.warn "[#{self}] The post install hook of the specification " \
    "DSL has been deprecated, use the `resource_bundles` or the " \
      "`prepare_command` attributes."
  @post_install_callback = block
end

#pre_install(&block) ⇒ Object

This is a convenience method which gets called after all pods have been downloaded but before they have been installed, and the Xcode project and related files have been generated. Note that this hook is called for each Pods library and only for installations where the Pod is installed.

This hook should be used to generate and modify the files of the Pod.

It receives the [‘Pod::Hooks::PodRepresentation`](docs.cocoapods.org/cocoapods/pod/hooks/podrepresentation/) and the [`Pod::Hooks::LibraryRepresentation`](docs.cocoapods.org/cocoapods/pod/hooks/libraryrepresentation/) instances.

Override this to, for instance, to run any build script.

Examples:


spec.pre_install do |pod, target_definition|
  Dir.chdir(pod.root){ `sh make.sh` }
end


95
96
97
98
99
100
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 95

def pre_install(&block)
  CoreUI.warn "[#{self}] The pre install hook of the specification " \
    "DSL has been deprecated, use the `resource_bundles` or the " \
      "`prepare_command` attributes."
  @pre_install_callback = block
end

#preferred_dependency=(name) ⇒ Object



9
10
11
12
13
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 9

def preferred_dependency=(name)
  self.default_subspec = name
  CoreUI.warn "[#{self}] `preferred_dependency` has been renamed "\
    "to `default_subspec`."
end

#singleton_method_added(method) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/cocoapods-core/specification/dsl/deprecations.rb', line 15

def singleton_method_added(method)
  if method == :pre_install
    CoreUI.warn "[#{self}] The use of `#{method}` by overriding " \
      "the method is deprecated."
    @pre_install_callback = Proc.new do |pod, target_definition|
      pre_install(pod, target_definition)
    end

  elsif method == :post_install
    CoreUI.warn "[#{self}] The use of `#{method}` by overriding the " \
      "method is deprecated."
    @post_install_callback = Proc.new do |target_installer|
      post_install(target_installer)
    end

  elsif method == :header_mappings
    raise Informative, "[#{self}] The use of the `header_mappings` " \
      "hook has been deprecated.\n Use the `header_dir` and the " \
        "`header_mappings_dir` attributes."

  elsif method == :copy_header_mapping
    raise Informative, "[#{self}] The use of the " \
      "`copy_header_mapping` hook has been deprecated.\nUse" \
        "the `header_dir` and the `header_mappings_dir` attributes."
  end
end