lib/big_keeper/util/podfile_operator.rb in bigkeeper-0.8.9 vs lib/big_keeper/util/podfile_operator.rb in bigkeeper-0.9.0

- old
+ new

@@ -38,19 +38,26 @@ def find_and_lock(podfile, dictionary) temp_file = Tempfile.new('.Podfile.tmp') begin File.open(podfile, 'r') do |file| file.each_line do |line| - pod_model = PodfileDetector.get_pod_model(line) + pod_model = PodfileParser.get_pod_model(line) if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil - # p "#{pod_name},#{dictionary[pod_name]}" temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment) + dictionary.delete(pod_model.name) else temp_file.puts line end end end + if !dictionary.empty? + temp_file.puts 'def sub_dependency' + dictionary.keys.each do |sub_pod| + temp_file.puts generate_pod_config(sub_pod, dictionary[sub_pod], 'bigkeeper') + end + temp_file.puts 'end' + end temp_file.close FileUtils.mv(temp_file.path, podfile) ensure temp_file.close temp_file.unlink @@ -60,11 +67,12 @@ def find_and_upgrade(podfile, dictionary) temp_file = Tempfile.new('.Podfile.tmp') begin File.open(podfile, 'r') do |file| file.each_line do |line| - pod_model = PodfileDetector.get_pod_model(line) + pod_model = PodfileParser.get_pod_model(line) if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil + #替换 temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment) else temp_file.puts line end end