Class: Pod::Source::Acceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-core/source/acceptor.rb

Overview

Checks whether a podspec can be accepted by a source. The check takes into account the introduction of 0.0.1 version if there are already tagged ones or whether there is change in the source.

Instance Attribute Summary collapse

Actions collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Acceptor

Returns a new instance of Acceptor.

Parameters:

  • repo (Pathname)

    @see Source#repo.



14
15
16
# File 'lib/cocoapods-core/source/acceptor.rb', line 14

def initialize(repo)
  @source = Source.new(repo)
end

Instance Attribute Details

#sourceSource (readonly)

Returns the source where the podspec should be added.

Returns:

  • (Source)

    the source where the podspec should be added.



10
11
12
# File 'lib/cocoapods-core/source/acceptor.rb', line 10

def source
  @source
end

Instance Method Details

#analyze(spec, previous_spec = nil) ⇒ Array<String>

Checks whether the given specification can be accepted.

Returns:

  • (Array<String>)

    A list of errors. If the list is empty the specification should be accepted.



28
29
30
31
32
33
34
35
# File 'lib/cocoapods-core/source/acceptor.rb', line 28

def analyze(spec, previous_spec = nil)
  errors = []
  check_spec_source_change(spec, errors)
  check_if_untagged_version_is_acceptable(spec, previous_spec, errors)
  check_commit_change_for_untagged_version(spec, previous_spec, errors)
  check_dependencies(spec, errors)
  errors
end

#analyze_path(spec_path) ⇒ Array<String>

Checks whether the specification at the given path can be accepted.

Returns:

  • (Array<String>)

    A list of errors. If the list is empty the specification should be accepted.



42
43
44
45
46
47
# File 'lib/cocoapods-core/source/acceptor.rb', line 42

def analyze_path(spec_path)
  spec = Specification.from_file(spec_path)
  analyze(spec)
rescue
  ['Unable to load the specification.']
end