lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.0.4 vs lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.0.6

- old
+ new

@@ -46,11 +46,16 @@ end def archive @pub_upgrade ? pub_upgrade : pub_get - setup_pod_sources + if local_podfile_exists? + use_local_podfile + else + setup_pod_sources + end + if @build_run excute_build_run end build_framework @plugins = fetch_plugins @@ -116,10 +121,15 @@ if CommandRunner.run(@flutter_wrapper, 'pub', 'get') == false raise "Pub get fail" end end + def local_podfile_exists? + local_podfile_dir = @working_dir + '/local_podfile' + File.exist? local_podfile_dir + end + def setup_pod_sources Pod::UserInterface.info 'Setup pod sources...' origin_pod_file_root_dir = @working_dir + '/.ios' origin_pod_file_dir = origin_pod_file_root_dir+ '/Podfile' temp_pod_file_dir_1 = @working_dir + '/tmp1.txt' @@ -162,9 +172,19 @@ File.open origin_pod_file_dir, "w+" do |file| file.write IO.readlines(temp_pod_file_2).join('') file.close end + end + + def use_local_podfile + origin_pod_file_root_dir = @working_dir + '/.ios' + origin_pod_file_dir = origin_pod_file_root_dir+ '/Podfile' + if File.exist? origin_pod_file_dir + File.delete(origin_pod_file_dir) + end + local_podfile_dir = @working_dir + '/local_podfile' + FileUtils.copy_file local_podfile_dir, origin_pod_file_dir end def excute_build_run if CommandRunner.run(@flutter_wrapper, 'packages','pub','run','build_runner','build','--delete-conflicting-outputs') == false raise "run build_runner fail"