Class: PodBuilder::Command::RestoreAll

Inherits:
Object
  • Object
show all
Defined in:
lib/pod_builder/command/restore_all.rb

Class Method Summary collapse

Class Method Details

.call(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pod_builder/command/restore_all.rb', line 6

def self.call(options)
  unless Configuration.restore_enabled
    raise "Restore not enabled!".red
  end
  
  Configuration.check_inited
  PodBuilder::prepare_basepath

  begin
    File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.tmp2"))
    File.rename(PodBuilder::basepath("Podfile.restore"), PodBuilder::basepath("Podfile"))

    ARGV << "*"
    options[:skip_prebuild_update] = true
    return Command::Build::call(options)
  rescue Exception => e
    raise e
  ensure
    FileUtils.rm_f(PodBuilder::basepath("Podfile.restore"))
    File.rename(PodBuilder::basepath("Podfile"), PodBuilder::basepath("Podfile.restore"))
    File.rename(PodBuilder::basepath("Podfile.tmp2"), PodBuilder::basepath("Podfile"))
  end

  return -1
end