class Pod::X::Xcode::Open
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/cocoapods-x/extension/xcode/open.rb, line 9 def initialize @urls_w = Dir[File.join(Dir.pwd, "*.xcworkspace")] @urls_p = Dir[File.join(Dir.pwd, "*.xcodeproj")] @urls = @urls_w + @urls_p super end
Public Instance Methods
openxc!(url)
click to toggle source
# File lib/cocoapods-x/extension/xcode/open.rb, line 35 def openxc! url UI.section('Pod::X '.magenta + "Opening #{File.basename(url)}.") do open! [url] end end
run!()
click to toggle source
# File lib/cocoapods-x/extension/xcode/open.rb, line 16 def run! if @urls_w.size == 1 openxc!(@urls_w[0]) elsif @urls_p.size == 1 openxc!(@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?') openxc!(urls[index]) rescue => exception UI.puts '[!] Pod::X '.magenta + "#{exception}".red end else openxc!('/Applications/Xcode.app') end end