Class: BigKeeper::DepPodOperator

Inherits:
DepOperator show all
Defined in:
lib/big_keeper/dependency/dep_pod_operator.rb

Overview

Operator for podfile

Instance Method Summary collapse

Methods inherited from DepOperator

#initialize, #release_home_finish, #release_home_start, #release_module_finish, #release_module_start

Constructor Details

This class inherits a constructor from BigKeeper::DepOperator

Instance Method Details

#backupObject



11
12
13
# File 'lib/big_keeper/dependency/dep_pod_operator.rb', line 11

def backup
  CacheOperator.new(@path).save('Podfile')
end

#install(modules, type, should_update) ⇒ Object



39
40
41
# File 'lib/big_keeper/dependency/dep_pod_operator.rb', line 39

def install(modules, type, should_update)
  PodOperator.pod_install(@path, should_update)
end

#openObject



43
44
45
# File 'lib/big_keeper/dependency/dep_pod_operator.rb', line 43

def open
  XcodeOperator.open_workspace(@path)
end

#recoverObject



15
16
17
18
19
# File 'lib/big_keeper/dependency/dep_pod_operator.rb', line 15

def recover
  cache_operator = CacheOperator.new(@path)
  cache_operator.load('Podfile')
  cache_operator.clean
end

#update_module_config(module_name, module_operate_type) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/big_keeper/dependency/dep_pod_operator.rb', line 21

def update_module_config(module_name, module_operate_type)
  file = "#{@path}/Podfile"
  temp_file = Tempfile.new('.Podfile.tmp')

  begin
    File.open(file, 'r') do |file|
      file.each_line do |line|
        temp_file.puts generate_module_config(line, module_name, module_operate_type)
      end
    end
    temp_file.close
    FileUtils.mv(temp_file.path, file)
  ensure
    temp_file.close
    temp_file.unlink
  end
end