class Pod::Command::Lib::Schoutedenapus

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/cocoapods-schoutedenapus/command/schoutedenapus.rb, line 11
def initialize(argv)
  @spec = spec_with_path(argv.shift_argument)
  super
end

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-schoutedenapus/command/schoutedenapus.rb, line 21
def run
  File.write('Package.swift', ::Schoutedenapus::Converter.new(@spec).to_s)
end
validate!() click to toggle source
Calls superclass method
# File lib/cocoapods-schoutedenapus/command/schoutedenapus.rb, line 16
def validate!
  super
  help! 'A podspec is required.' unless @spec
end

Private Instance Methods

spec_with_path(path) click to toggle source
# File lib/cocoapods-schoutedenapus/command/schoutedenapus.rb, line 27
def spec_with_path(path)
  return if path.nil? || !Pathname.new(path).exist?

  if Pathname.new(path).directory?
    help! path + ': is a directory.'
    return
  end

  unless ['.podspec', '.json'].include? Pathname.new(path).extname
    help! path + ': is not a podspec.'
    return
  end

  Specification.from_file(path)
end