Class: Pod::Command::Reopen

Inherits:
Pod::Command show all
Defined in:
lib/pod/command/reopen.rb

Instance Method Summary collapse

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

#runObject



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 = "    tell application \"Xcode\"\n            set docs to (document of every window)\n            repeat with doc in docs\n                if class of doc is workspace document then\n                    set docPath to path of doc\n                    if docPath begins with \"\#{@workspace}\" then\n                        log docPath\n                        close doc\n                        return\n                    end if\n                end if\n            end repeat\n    end tell\n  STR\n  `osascript -e '\#{ascript}'`\n  `open \"\#{@workspace}\"`\nend\n".strip_heredoc

#validate!Object

Raises:

  • (Informative)


17
18
19
20
# File 'lib/pod/command/reopen.rb', line 17

def validate!
  super
  raise Informative, 'No xcode workspace found' unless @workspace
end