Sha256: 2004d205e19c06c849d0fd12dd1f8424eccf53f0cd8a2b2bf286238e69d27d58

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require "open3"

module Danger
    # Runs SwiftInfo and prints the results to the pull request.
    # You must have [SwiftInfo](https://github.com/rockbruno/SwiftInfo) installed
    # somewhere in your project.
    # You can detect that SwiftInfo is running specifically for Danger
    # by adding a `if isInPullRequestMode` condition in your Infofile.
    # You can use this condition to extract different rules and prevent saving the new output.
    # @example Run SwiftInfo
    #
    #          swiftinfo.run './Pods/SwiftInfo/bin/swiftinfo'
    #
    # @see  rockbruno/danger-SwiftInfo
    # @tags swift, xcode, swiftinfo, ios
    #
    class DangerSwiftInfo < Plugin
        # Run SwiftInfo and print the results to the PR.
        # @param    [String] path Path to the SwiftInfo binary.
        # @return   [void]
        #
        def run(path)
            binPath = path + " -s --pullRequest"
            output = `#{binPath}`
            html = output.sub("\n", "<br>")
            message(output)
        end

        def self.instance_name
            "swiftinfo"
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-SwiftInfo-0.1.0 lib/danger_plugin.rb