class Pod::Command::XC::Open

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/cocoapods-extension/command/xcode/open.rb, line 9
def initialize(argv)
    super
end

Public Instance Methods

run() click to toggle source
# File lib/cocoapods-extension/command/xcode/open.rb, line 13
def run 
    urls_w = Dir[File.join(Dir.pwd, "*.xcworkspace")] 
    urls_p = Dir[File.join(Dir.pwd, "*.xcodeproj")]
    urls = urls_w + urls_p
    if urls_w.size == 1
        open urls_w[0]
    elsif urls_p.size == 1
        open urls_p[0]
    elsif urls.size > 0
        choices = urls.map { |l| File.basename(l) }
        begin
            index = UI.choose_from_array(choices, 'Which file do you want to open?')
            open urls[index]
        rescue => exception
            UI.puts "[!] #{exception}".red
        end
    else
        open '/Applications/Xcode.app'
    end
end

Private Instance Methods

openxc(url) click to toggle source
# File lib/cocoapods-extension/command/xcode/open.rb, line 39
def openxc url
    UI.section("Opening #{File.basename(url)}.") do
        open! [url]
    end
end