Class: Danger::DangerXcodeproj

Inherits:
Plugin
  • Object
show all
Defined in:
lib/xcodeproj/plugin.rb

Overview

This is your plugin class. Any attributes or methods you expose here will be available from within your Dangerfile.

To be published on the Danger plugins site, you will need to have the public interface documented. Danger uses [YARD](yardoc.org/) for generating documentation from your plugin source, and you can verify by running ‘danger plugins lint` or `bundle exec rake spec`.

You should replace these comments with a public description of your library.

Examples:

Ensure people are well warned about merging on Mondays


my_plugin.warn_on_mondays

See Also:

  • Manoj/danger-xcodeproj

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#projectProject

Xcode project object

Returns:

  • (Project)

    Xcode project object



27
28
29
# File 'lib/xcodeproj/plugin.rb', line 27

def project
  @project
end

Instance Method Details

#open(path = nil) ⇒ void

This method returns an undefined value.

Opens Xcode project file using the given path



33
34
35
36
37
38
# File 'lib/xcodeproj/plugin.rb', line 33

def open(path=nil)
  # Fails if Xcode project file path is not provided
  raise "Xcode project file path in not set!" unless !path.nil?

  @project = Xcodeproj::Project.open(path)
end

#target_attributesArray<TargetAttributes>

Targets Attributes in Xcode Project file

Returns:

  • (Array<TargetAttributes>)


54
55
56
57
58
# File 'lib/xcodeproj/plugin.rb', line 54

def target_attributes
  raise "Xcode project is not opened!" if project.nil?
  
  @project.root_object.attributes["TargetAttributes"]
end

#targetsArray<Target>

Targets in Xcode Project file

Returns:

  • (Array<Target>)


44
45
46
47
48
# File 'lib/xcodeproj/plugin.rb', line 44

def targets
  raise "Xcode project is not opened!" if @project.nil?

  @project.targets
end