Class: Pod::Command::Reopen
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Reopen
- Defined in:
- lib/pod/command/reopen.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Reopen
constructor
A new instance of Reopen.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Reopen
Returns a new instance of Reopen.
12 13 14 15 |
# File 'lib/pod/command/reopen.rb', line 12 def initialize(argv) @workspace = find_workspace_in(Pathname.pwd) super end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pod/command/reopen.rb', line 22 def run ascript = <<~STR.strip_heredoc tell application "Xcode" set docs to (document of every window) repeat with doc in docs if class of doc is workspace document then set docPath to path of doc if docPath begins with "#{@workspace}" then log docPath close doc return end if end if end repeat end tell STR `osascript -e '#{ascript}'` `open "#{@workspace}"` end |
#validate! ⇒ Object
17 18 19 20 |
# File 'lib/pod/command/reopen.rb', line 17 def validate! super raise Informative, 'No xcode workspace found' unless @workspace end |