Class: Pod::Command::Dev::Create

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Create

Returns a new instance of Create.



20
21
22
23
# File 'lib/cocoapods-extension/command/development/create.rb', line 20

def initialize(argv)
    @name = argv.shift_argument
    super
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods-extension/command/development/create.rb', line 25

def run
    project_name = @name
    target_url = File.join(Dir::pwd, project_name)
    configure_url = Pod::Extension::Sandbox::workspace::template::configure
    template_url = Pod::Extension::Sandbox::workspace::template::ios_template
    if Dir::exist?(target_url) && !Dir::empty?(target_url)
        UI.puts "fatal: destination path '#{project_name}' already exists and is not an empty directory.".red
    else
        rm! ['-rf', target_url]
        if !template_url.exist? 
            Pod::Extension::Sandbox::update!
        end
        UI.section("Configuring #{project_name} template.") do
            system('ruby', configure_url.to_s, template_url.to_s, target_url.to_s, project_name.to_s)
        end
    end

end