Module: CocoapodsRepoUpdate::Helper

Defined in:
lib/cocoapods_repo_update/helper.rb

Class Method Summary collapse

Class Method Details

.no_spec_found?(exception) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/cocoapods_repo_update/helper.rb', line 21

def self.no_spec_found?(exception)
  exception.is_a?(Pod::NoSpecFoundError)
end

.specs_need_update?(exception) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cocoapods_repo_update/helper.rb', line 17

def self.specs_need_update?(exception)
  no_spec_found?(exception) || version_conflict?(exception)
end

.suppress_output { ... } ⇒ Object

Suppress stdout & stderr while the block is run

Yields:

  • invokes the block with output suppressed



7
8
9
10
11
12
13
14
15
# File 'lib/cocoapods_repo_update/helper.rb', line 7

def self.suppress_output
  original_stdout, original_stderr = $stdout.clone, $stderr.clone
  $stderr.reopen File.new('/dev/null', 'w')
  $stdout.reopen File.new('/dev/null', 'w')
  yield
ensure
  $stdout.reopen original_stdout
  $stderr.reopen original_stderr
end

.version_conflict?(exception) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/cocoapods_repo_update/helper.rb', line 25

def self.version_conflict?(exception)
  exception.cause.is_a?(Molinillo::VersionConflict)
end