Class: Swiftproj::GenerateXcconfigCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/swiftproj/commands/generate_xcconfig_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#command_class, command_name, #get_command, help_message, #initialize, #parse_options

Constructor Details

This class inherits a constructor from Swiftproj::Command

Class Method Details

.descriptionObject



3
4
5
# File 'lib/swiftproj/commands/generate_xcconfig_command.rb', line 3

def self.description()
  return "Generates a Xcode project file"
end

.optionsObject



7
8
9
10
11
# File 'lib/swiftproj/commands/generate_xcconfig_command.rb', line 7

def self.options()
  return {
    "--podspec" => "A path for podspec file",
  }
end

Instance Method Details

#run(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/swiftproj/commands/generate_xcconfig_command.rb', line 13

def run(options)
  podspec_path = options["--podspec"]
  if podspec_path.nil?
    raise Swiftproj::MissingArgumentError.new("--podspec")
  end

  begin
    podspec_content = @file.open(podspec_path).read
  rescue
    raise Swiftproj::NoSuchFileError.new(podspec_path)
  end

  podspec = Pod::Spec.from_podspec(podspec_content)
  @core.generate_xcconfig(podspec)
end