Class: Pod::Command::Dev::Open

Inherits:
Pod::Command::Dev show all
Extended by:
Executable
Defined in:
lib/cocoapods-extension/command/development/open.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Open

Returns a new instance of Open.



21
22
23
24
25
# File 'lib/cocoapods-extension/command/development/open.rb', line 21

def initialize(argv)
    @wipe_proj = argv.flag?('proj')
    @wipe_wks = argv.flag?('wks')
    super
end

Class Method Details

.optionsObject



14
15
16
17
18
19
# File 'lib/cocoapods-extension/command/development/open.rb', line 14

def self.options
    [
        ['--proj', 'Open development project.'],
        ['--wks', 'Open development workspace.'],
    ].concat(super)
end

Instance Method Details

#open_projObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/cocoapods-extension/command/development/open.rb', line 41

def open_proj
    project_url = Pathname(Dir.pwd) 
    Pod::Extension::Sandbox::install!
    Pod::Extension::Sandbox::podfile_exists! project_url
    conf = Pod::Extension::Configurator::find_conf? project_url
    if !conf.nil? && conf.verify?
        UI.section("Opening project.") do
            open! [conf::project_debug_url]
        end
    else
        UI.puts "Please run `pod dev init`."
    end
end

#open_wksObject



55
56
57
58
59
# File 'lib/cocoapods-extension/command/development/open.rb', line 55

def open_wks
    UI.section("Opening workspace.") do
        open! [Pod::Extension::Sandbox::workspace::root]
    end
end

#runObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cocoapods-extension/command/development/open.rb', line 27

def run
    if @wipe_proj
        open_proj
    end

    if @wipe_wks
        open_wks
    end

    if !@wipe_proj && !@wipe_wks
        help!
    end
end