Class: LgPodPlugin::Main
- Inherits:
-
Object
- Object
- LgPodPlugin::Main
- Defined in:
- lib/lg_pod_plugin/installer/main.rb
Class Method Summary collapse
- .check_podfile_exist?(workspace) ⇒ Boolean
-
.clean_sandbox ⇒ Object
删除旧的换成目录.
- .install_external_pod(project) ⇒ Object
- .run(command, options = {}) ⇒ Object
Class Method Details
.check_podfile_exist?(workspace) ⇒ Boolean
55 56 57 58 59 60 61 |
# File 'lib/lg_pod_plugin/installer/main.rb', line 55 def self.check_podfile_exist?(workspace) podfile_path = workspace.join("Podfile") return podfile_path if podfile_path.exist? podfile_path = workspace.join("Podfile.rb") return podfile_path if podfile_path.exist? raise Informative, "No `Podfile' found in the project directory." end |
.clean_sandbox ⇒ Object
删除旧的换成目录
10 11 12 13 14 15 16 17 18 |
# File 'lib/lg_pod_plugin/installer/main.rb', line 10 def self.clean_sandbox sand_box = LFileManager.download_director sand_box.each_child do |f| ftype = File::ftype(f) next unless ftype == "directory" next if f.to_path.include?("database") FileUtils.rm_rf f.to_path end end |
.install_external_pod(project) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lg_pod_plugin/installer/main.rb', line 38 def self.install_external_pod(project) #下载 External pods LgPodPlugin.log_blue "Pre-downloading External Pods" unless project.targets.empty? all_installers = Hash.new project.targets.each do |target| target.dependencies.each do |_, pod| installer = LPodInstaller.new download_params = installer.install(pod) if download_params all_installers[download_params["name"]] = installer end end end # 通过 swift 可执行文件进行异步下载任务 LgPodPlugin::Concurrency.async_download_pods(all_installers.values) end |
.run(command, options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lg_pod_plugin/installer/main.rb', line 21 def self.run(command, = {}) self.clean_sandbox workspace = Pathname(Dir.pwd) update = (command == "update") LSqliteDb.shared.init_database repo_update = [:repo_update] ||= false LgPodPlugin.log_blue "当前工作目录 #{workspace}" podfile_path = check_podfile_exist?(workspace) return unless podfile_path project = LProject.shared.setup(workspace, podfile_path, update, repo_update) self.install_external_pod(project) # # 安装开发版本pod verbose = [:verbose] ||= false clean_install = [:clean_install] ||= false ReleasePod.install_release_pod(update, repo_update, verbose, clean_install) end |