Class: Pod::Command::Open

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Open

Returns a new instance of Open.



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

def initialize(argv)
  @use_appcode = (argv.shift_argument == '-a')
  @workspace = find_workspace_in(Pathname.pwd)
  super
end

Class Method Details

.optionsObject



11
12
13
14
15
# File 'lib/pod/command/open.rb', line 11

def self.options
  [
    ['-a',     'Open in AppCode.']
  ]
end

Instance Method Details

#runObject



31
32
33
34
35
36
37
# File 'lib/pod/command/open.rb', line 31

def run
  if @use_appcode
    `#{appcode_executable} "#{@workspace}"`
  else
    `open "#{@workspace}"`
  end
end

#validate!Object

Raises:

  • (Informative)


23
24
25
26
27
28
29
# File 'lib/pod/command/open.rb', line 23

def validate!
  super
  raise Informative, "No xcode workspace found" unless @workspace
  if @use_appcode
    raise Informative, "Can't find `#{appcode_executable}` command line launcher. Have you created it? 'AppCode->Tools->Create Command line launcher'" unless appcode_available?
  end
end