Class: PodBuilder::Command::SyncPodfile

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

Class Method Summary collapse

Class Method Details

.callObject



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/sync_podfile.rb', line 6

def self.call
  Configuration.check_inited
  PodBuilder::prepare_basepath
  
  install_update_repo = OPTIONS.fetch(:update_repos, true)
  installer, analyzer = Analyze.installer_at(PodBuilder::basepath, install_update_repo)

  all_buildable_items = Analyze.podfile_items(installer, analyzer)

  Dir.chdir(PodBuilder::project_path) do
    previous_podfile_content = File.read("Podfile")
    Podfile::write_prebuilt(all_buildable_items, analyzer)        
    updated_podfile_content = File.read("Podfile")
  
    Licenses::write([], all_buildable_items)
  
    if previous_podfile_content != updated_podfile_content
      bundler_prefix = Configuration.use_bundler ? "bundle exec " : ""
      system("#{bundler_prefix}pod install;")
    end  
  end
  
  puts "\n\nšŸŽ‰ done!\n".green
  return 0
end