cocoapods-cafswitcher 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cocoapods-cafswitcher/Main.rb +60 -44
- data/lib/cocoapods-cafswitcher/gem_version.rb +1 -1
- data/lib/cocoapods-cafswitcher/podfile_switch.rb +113 -37
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f4cb2218088b7d582c2096ff569b5b76fa713a778e11753091070153738fc35d
         | 
| 4 | 
            +
              data.tar.gz: de86507394b201e011239d135392e6924c6c5800df6175633ec82fc90e907822
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 607aa67ef50f0065f9979fd57bb531d640560bb53448a0233c02ca1ad8dce4ff228e01eee30fd80537b1765a5c45945bf55437b5ad739f671bc560bd62a0bf08
         | 
| 7 | 
            +
              data.tar.gz: 4475e8ae542181376dc1818a61ad6cfda5a517d31af8d6a4071d04930e8ebe290ba432a295e2fd709ad0aae4a4ec8a8a5060f79ed578557cb73963cc3e5b44ae
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -1,7 +1,8 @@ | |
| 1 | 
            -
            # encoding: UTF-8
         | 
| 2 1 | 
             
            require 'fileutils'
         | 
| 3 2 | 
             
            require 'yaml'
         | 
| 4 3 | 
             
            require 'pathname'
         | 
| 4 | 
            +
            require 'cocoapods/downloader'
         | 
| 5 | 
            +
            require 'cocoapods/config'
         | 
| 5 6 |  | 
| 6 7 | 
             
            require_relative('podfile_switch')
         | 
| 7 8 |  | 
| @@ -41,21 +42,22 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_ | |
| 41 42 |  | 
| 42 43 | 
             
              if ENV['IS_ARCHIVE']
         | 
| 43 44 | 
             
                ENV.delete('IS_ARCHIVE')
         | 
| 44 | 
            -
                 | 
| 45 | 
            -
                  setEnv(name,  | 
| 45 | 
            +
                allNames.each do |name|
         | 
| 46 | 
            +
                  setEnv(name, '_ARCHIVE')
         | 
| 46 47 | 
             
                  # ENV["#{name}_ARCHIVE"] = '1'
         | 
| 47 48 | 
             
                end
         | 
| 48 49 | 
             
              elsif ENV['IS_SOURCE']
         | 
| 49 50 | 
             
                ENV.delete('IS_SOURCE')
         | 
| 50 | 
            -
                 | 
| 51 | 
            -
                  setEnv(name,  | 
| 51 | 
            +
                allNames.each do |name|
         | 
| 52 | 
            +
                  setEnv(name, '_SOURCE')
         | 
| 52 53 | 
             
                  # ENV["#{name}_SOURCE"] = '1'
         | 
| 54 | 
            +
                  Pod::Podfile.tmpSourceList << name
         | 
| 53 55 | 
             
                end
         | 
| 54 56 | 
             
              end
         | 
| 55 57 |  | 
| 56 58 | 
             
              # 对于git和path的直接设置成源码
         | 
| 57 | 
            -
               | 
| 58 | 
            -
                currentSourceList = currentSourceList << name  | 
| 59 | 
            +
              needUpdatePodList.each do |name|
         | 
| 60 | 
            +
                currentSourceList = currentSourceList << name unless currentSourceList.include?(name)
         | 
| 59 61 | 
             
              end
         | 
| 60 62 |  | 
| 61 63 |  | 
| @@ -81,31 +83,31 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_ | |
| 81 83 | 
             
              # end
         | 
| 82 84 |  | 
| 83 85 | 
             
              # 二进制切换
         | 
| 84 | 
            -
               | 
| 86 | 
            +
              currentSourceList.each do |sourceName|
         | 
| 85 87 | 
             
                cleanENV(sourceName)
         | 
| 86 | 
            -
                setEnv(sourceName,  | 
| 88 | 
            +
                setEnv(sourceName, '_SOURCE')
         | 
| 87 89 | 
             
                # ENV["#{sourceName}_SOURCE"] = '1'
         | 
| 88 90 | 
             
              end
         | 
| 89 91 |  | 
| 90 | 
            -
               | 
| 92 | 
            +
              currentArchiveList.each do |archiveName|
         | 
| 91 93 | 
             
                cleanENV(archiveName)
         | 
| 92 | 
            -
                setEnv(archiveName,  | 
| 94 | 
            +
                setEnv(archiveName, '_ARCHIVE')
         | 
| 93 95 | 
             
                # ENV["#{archiveName}_ARCHIVE"] = '1'
         | 
| 94 96 | 
             
              end
         | 
| 95 97 |  | 
| 96 | 
            -
               | 
| 98 | 
            +
              currentFrameworkList.each do |frameworkName|
         | 
| 97 99 | 
             
                cleanENV(frameworkName)
         | 
| 98 | 
            -
                setEnv(frameworkName,  | 
| 100 | 
            +
                setEnv(frameworkName, '_FRAMEWORK')
         | 
| 99 101 | 
             
                # ENV["#{frameworkName}_FRAMEWORK"] = '1'
         | 
| 100 102 | 
             
              end
         | 
| 101 103 |  | 
| 102 | 
            -
              sourceList =  | 
| 103 | 
            -
              archiveList =  | 
| 104 | 
            -
              frameworkList =  | 
| 104 | 
            +
              sourceList = []
         | 
| 105 | 
            +
              archiveList = []
         | 
| 106 | 
            +
              frameworkList = []
         | 
| 105 107 | 
             
              # debugPackageList = Array.new
         | 
| 106 108 | 
             
              # releasePackageList = Array.new
         | 
| 107 109 |  | 
| 108 | 
            -
               | 
| 110 | 
            +
              allNames.each do |name|
         | 
| 109 111 | 
             
                envName = name.gsub(/[\/]/, '_')
         | 
| 110 112 | 
             
                # if ENV["#{name}_DEBUG"] == '1'
         | 
| 111 113 | 
             
                #   debugPackageList << name
         | 
| @@ -138,7 +140,7 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_ | |
| 138 140 |  | 
| 139 141 | 
             
              # caf_hash = Hash["sourceList" => sourceList, "archiveList" => archiveList, "frameworkList" => frameworkList,
         | 
| 140 142 | 
             
              #                 "debugPackageList" => debugPackageList, "releasePackageList" => releasePackageList]
         | 
| 141 | 
            -
              caf_hash = Hash[ | 
| 143 | 
            +
              caf_hash = Hash['sourceList' => sourceList, 'archiveList' => archiveList, 'frameworkList' => frameworkList]
         | 
| 142 144 |  | 
| 143 145 |  | 
| 144 146 | 
             
              config = Pod::Config.instance
         | 
| @@ -146,70 +148,81 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_ | |
| 146 148 | 
             
              require_relative('cafswitcher_config')
         | 
| 147 149 |  | 
| 148 150 | 
             
              configPath = config.cafConfigPath
         | 
| 149 | 
            -
              FileUtils.mkdir_p(configPath)  | 
| 151 | 
            +
              FileUtils.mkdir_p(configPath) unless configPath.exist?
         | 
| 150 152 | 
             
              configFile = config.cafConfigFile
         | 
| 151 | 
            -
              cafConfig = Hash | 
| 153 | 
            +
              cafConfig = Hash['sourceList' => [], 'archiveList' => [], 'frameworkList' => []]
         | 
| 152 154 | 
             
              if configFile.exist?
         | 
| 153 155 | 
             
                cafConfig = YAML.load(File.open(configFile))
         | 
| 156 | 
            +
                cafConfig ||= Hash['sourceList' => [], 'archiveList' => [], 'frameworkList' => []]
         | 
| 154 157 | 
             
              else
         | 
| 155 158 | 
             
                FileUtils.touch configFile
         | 
| 156 | 
            -
                # cafConfig = Hash["sourceList" => [], "archiveList" => [], "frameworkList" => [],
         | 
| 157 | 
            -
                #                  "debugPackageList" => [], "releasePackageList" => []]
         | 
| 158 | 
            -
                cafConfig = Hash["sourceList" => [], "archiveList" => [], "frameworkList" => []]
         | 
| 159 159 | 
             
              end
         | 
| 160 160 | 
             
              # 比较不同
         | 
| 161 | 
            -
              changedSubPods =  | 
| 161 | 
            +
              changedSubPods = []
         | 
| 162 162 | 
             
              cafConfig.each do |key, value|
         | 
| 163 163 | 
             
                # if key == "debugPackageList"
         | 
| 164 164 | 
             
                #   changedSubPods |= (value | debugPackageList) - (value & debugPackageList)
         | 
| 165 165 | 
             
                # elsif key == "releasePackageList"
         | 
| 166 166 | 
             
                #   changedSubPods |= (value | releasePackageList) - (value & releasePackageList)
         | 
| 167 | 
            -
                if key ==  | 
| 167 | 
            +
                if key == 'sourceList'
         | 
| 168 168 | 
             
                  changedSubPods |= (value | sourceList) - (value & sourceList)
         | 
| 169 | 
            -
                elsif key ==  | 
| 169 | 
            +
                elsif key == 'archiveList'
         | 
| 170 170 | 
             
                  changedSubPods |= (value | archiveList) - (value & archiveList)
         | 
| 171 | 
            -
                elsif key ==  | 
| 171 | 
            +
                elsif key == 'frameworkList'
         | 
| 172 172 | 
             
                  changedSubPods |= (value | frameworkList) - (value & frameworkList)
         | 
| 173 173 | 
             
                end
         | 
| 174 174 | 
             
              end
         | 
| 175 | 
            -
             | 
| 175 | 
            +
             | 
| 176 | 
            +
              Pod::UI.puts "\nchanged sub Pod is:\n   " + changedSubPods.to_s unless changedSubPods.empty?
         | 
| 176 177 | 
             
              # changedPod 里是根据subspec来存的,需要进行合并,找到pod库而不是含有subspec的库
         | 
| 177 | 
            -
              changedPods =  | 
| 178 | 
            +
              changedPods = []
         | 
| 178 179 | 
             
              changedSubPods.each do |subPod|
         | 
| 179 | 
            -
                podName  = subPod.split( | 
| 180 | 
            +
                podName  = subPod.split('/')[0]
         | 
| 180 181 | 
             
                changedPods << podName
         | 
| 181 182 | 
             
              end
         | 
| 182 183 | 
             
              # changedPods = changedPods | needUpdatePodList
         | 
| 183 184 | 
             
              changedPods.uniq!
         | 
| 185 | 
            +
              Pod::Podfile.changedPods.concat changedPods if changedPods
         | 
| 186 | 
            +
              Pod::Podfile.changedSubPods.concat changedSubPods if changedSubPods
         | 
| 187 | 
            +
              Pod::UI.puts "\nchanged Pod is:\n   " + changedPods.to_s unless changedPods.empty?
         | 
| 184 188 |  | 
| 185 | 
            -
              Pod:: | 
| 186 | 
            -
             | 
| 189 | 
            +
              @cache = Pod::Downloader::Cache.new(Pod::Config.instance.cache_root + 'Pods')
         | 
| 187 190 | 
             
              # 根据不同删除cache
         | 
| 188 191 | 
             
              podRoot = config.project_pods_root
         | 
| 189 192 | 
             
              changedSubPods.each do |changedSubPod|
         | 
| 190 | 
            -
                changedPod = changedSubPod.split( | 
| 193 | 
            +
                changedPod = changedSubPod.split('/')[0]
         | 
| 191 194 | 
             
                if needUpdatePodList.delete(changedSubPod)
         | 
| 192 | 
            -
                   | 
| 193 | 
            -
                   | 
| 194 | 
            -
             | 
| 195 | 
            -
             | 
| 195 | 
            +
                  cache_descriptors = @cache.cache_descriptors_per_pod[changedPod]
         | 
| 196 | 
            +
                  if cache_descriptors
         | 
| 197 | 
            +
                    cache_descriptors.each do |desc|
         | 
| 198 | 
            +
                      next unless desc[:release] == false
         | 
| 199 | 
            +
                      Pod::UI.message("Removing spec #{desc[:spec_file]} (v#{desc[:version]})") do
         | 
| 200 | 
            +
                        FileUtils.rm desc[:spec_file]
         | 
| 201 | 
            +
                      end
         | 
| 202 | 
            +
                      Pod::UI.message("Removing cache #{desc[:slug]}") do
         | 
| 203 | 
            +
                        FileUtils.rm_rf(desc[:slug])
         | 
| 204 | 
            +
                      end
         | 
| 205 | 
            +
                    end
         | 
| 206 | 
            +
                  end
         | 
| 196 207 | 
             
                end
         | 
| 197 | 
            -
                 | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 208 | 
            +
                next unless changedSubPod =~ /^(?i)LJ/ || changedSubPod =~ /^(?i)Lianjia/
         | 
| 209 | 
            +
                # 清除目录 pods 文件夹下的缓存
         | 
| 210 | 
            +
                changedPodPath = podRoot + changedPod
         | 
| 211 | 
            +
                if changedPodPath.exist?
         | 
| 212 | 
            +
                  Pod::UI.message "Removing Folder #{changedPodPath}"
         | 
| 213 | 
            +
                  FileUtils.rm_r(changedPodPath)
         | 
| 201 214 | 
             
                end
         | 
| 202 215 | 
             
              end
         | 
| 203 216 |  | 
| 204 217 | 
             
              # 把新的配置写入file
         | 
| 205 | 
            -
              File.open(configFile,  | 
| 218 | 
            +
              File.open(configFile, 'wb') {|f| YAML.dump(caf_hash, f) } unless changedSubPods.empty?
         | 
| 206 219 | 
             
            end
         | 
| 207 220 |  | 
| 208 221 |  | 
| 209 222 | 
             
            def setEnv(name, suffix)
         | 
| 210 223 | 
             
              envName = name.gsub(/[\/]/, '_')
         | 
| 211 224 | 
             
              ENV["#{envName}#{suffix}"] = '1'
         | 
| 212 | 
            -
              podName = name.split( | 
| 225 | 
            +
              podName = name.split('/')[0]
         | 
| 213 226 | 
             
              ENV["#{podName}#{suffix}"] = '1'
         | 
| 214 227 | 
             
            end
         | 
| 215 228 |  | 
| @@ -228,4 +241,7 @@ end | |
| 228 241 | 
             
            #   ENV.delete("#{name}_DEBUG")
         | 
| 229 242 | 
             
            #   ENV.delete("#{name}_RELEASE")
         | 
| 230 243 | 
             
            #   ENV.delete('IS_DEBUG')
         | 
| 231 | 
            -
            # end
         | 
| 244 | 
            +
            # end
         | 
| 245 | 
            +
            #
         | 
| 246 | 
            +
             | 
| 247 | 
            +
            Pod
         | 
| @@ -1,7 +1,9 @@ | |
| 1 | 
            +
            require 'cocoapods/installer'
         | 
| 2 | 
            +
            require 'cocoapods/resolver'
         | 
| 3 | 
            +
            require 'cocoapods-cafswitcher/Main'
         | 
| 1 4 | 
             
            module Pod
         | 
| 2 5 |  | 
| 3 6 | 
             
              class Podfile
         | 
| 4 | 
            -
             | 
| 5 7 | 
             
                # add flag
         | 
| 6 8 | 
             
                # :isSource => true
         | 
| 7 9 | 
             
                def self.isSource
         | 
| @@ -31,21 +33,21 @@ module Pod | |
| 31 33 | 
             
                #   :isReleasePackage
         | 
| 32 34 | 
             
                # end
         | 
| 33 35 |  | 
| 34 | 
            -
                @@sourceList =  | 
| 36 | 
            +
                @@sourceList = []
         | 
| 35 37 |  | 
| 36 | 
            -
                def  | 
| 38 | 
            +
                def self.sourceList
         | 
| 37 39 | 
             
                  @@sourceList
         | 
| 38 40 | 
             
                end
         | 
| 39 41 |  | 
| 40 | 
            -
                @@archiveList =  | 
| 42 | 
            +
                @@archiveList = []
         | 
| 41 43 |  | 
| 42 | 
            -
                def  | 
| 44 | 
            +
                def self.archiveList
         | 
| 43 45 | 
             
                  @@archiveList
         | 
| 44 46 | 
             
                end
         | 
| 45 47 |  | 
| 46 | 
            -
                @@frameworkList =  | 
| 48 | 
            +
                @@frameworkList = []
         | 
| 47 49 |  | 
| 48 | 
            -
                def  | 
| 50 | 
            +
                def self.frameworkList
         | 
| 49 51 | 
             
                  @@frameworkList
         | 
| 50 52 | 
             
                end
         | 
| 51 53 |  | 
| @@ -62,18 +64,36 @@ module Pod | |
| 62 64 | 
             
                # end
         | 
| 63 65 |  | 
| 64 66 | 
             
                # all the name of Pod
         | 
| 65 | 
            -
                @@allPodName =  | 
| 67 | 
            +
                @@allPodName = []
         | 
| 66 68 |  | 
| 67 | 
            -
                def  | 
| 69 | 
            +
                def self.allPodName
         | 
| 68 70 | 
             
                  @@allPodName
         | 
| 69 71 | 
             
                end
         | 
| 70 72 |  | 
| 71 | 
            -
                @@needUpdatePodList =  | 
| 73 | 
            +
                @@needUpdatePodList = []
         | 
| 72 74 |  | 
| 73 | 
            -
                def  | 
| 75 | 
            +
                def self.needUpdatePodList
         | 
| 74 76 | 
             
                  @@needUpdatePodList
         | 
| 75 77 | 
             
                end
         | 
| 76 78 |  | 
| 79 | 
            +
                @@changedSubPods = []
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                def self.changedSubPods
         | 
| 82 | 
            +
                  @@changedSubPods
         | 
| 83 | 
            +
                end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                @@changedPods= []
         | 
| 86 | 
            +
             | 
| 87 | 
            +
                def self.changedPods
         | 
| 88 | 
            +
                  @@changedPods
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                @@tmpSourceList= []
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                def self.tmpSourceList
         | 
| 94 | 
            +
                  @@tmpSourceList
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 77 97 |  | 
| 78 98 | 
             
                module DSL
         | 
| 79 99 | 
             
                  # Enable code for all pods
         | 
| @@ -102,11 +122,9 @@ module Pod | |
| 102 122 | 
             
                  def parse_isFramework(name, requirements)
         | 
| 103 123 | 
             
                    options = requirements.last
         | 
| 104 124 | 
             
                    return requirements unless options.is_a?(Hash)
         | 
| 105 | 
            -
                    isFramework = options. | 
| 125 | 
            +
                    isFramework = options.key?(Pod::Podfile.isFramework)
         | 
| 106 126 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 107 | 
            -
                    if isFramework
         | 
| 108 | 
            -
                      Pod::Podfile.frameworkList << name
         | 
| 109 | 
            -
                    end
         | 
| 127 | 
            +
                    Pod::Podfile.frameworkList << name if isFramework
         | 
| 110 128 | 
             
                    requirements.pop if options.empty?
         | 
| 111 129 | 
             
                  end
         | 
| 112 130 |  | 
| @@ -114,11 +132,9 @@ module Pod | |
| 114 132 | 
             
                    options = requirements.last
         | 
| 115 133 | 
             
                    return requirements unless options.is_a?(Hash)
         | 
| 116 134 |  | 
| 117 | 
            -
                    isSource = options. | 
| 135 | 
            +
                    isSource = options.key?(Pod::Podfile.isSource)
         | 
| 118 136 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 119 | 
            -
                    if isSource
         | 
| 120 | 
            -
                      Pod::Podfile.sourceList << name
         | 
| 121 | 
            -
                    end
         | 
| 137 | 
            +
                    Pod::Podfile.sourceList << name if isSource
         | 
| 122 138 | 
             
                    requirements.pop if options.empty?
         | 
| 123 139 | 
             
                  end
         | 
| 124 140 |  | 
| @@ -126,11 +142,9 @@ module Pod | |
| 126 142 | 
             
                    options = requirements.last
         | 
| 127 143 | 
             
                    return requirements unless options.is_a?(Hash)
         | 
| 128 144 |  | 
| 129 | 
            -
                    isArchive = options. | 
| 145 | 
            +
                    isArchive = options.key?(Pod::Podfile.isArchive)
         | 
| 130 146 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 131 | 
            -
                    if isArchive
         | 
| 132 | 
            -
                      Pod::Podfile.archiveList << name
         | 
| 133 | 
            -
                    end
         | 
| 147 | 
            +
                    Pod::Podfile.archiveList << name if isArchive
         | 
| 134 148 |  | 
| 135 149 | 
             
                    requirements.pop if options.empty?
         | 
| 136 150 | 
             
                  end
         | 
| @@ -163,11 +177,9 @@ module Pod | |
| 163 177 | 
             
                    options = requirements.last
         | 
| 164 178 | 
             
                    return requirements unless options.is_a?(Hash)
         | 
| 165 179 |  | 
| 166 | 
            -
                    isGitPath = options. | 
| 180 | 
            +
                    isGitPath = options.key?(:git)
         | 
| 167 181 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 168 | 
            -
                    if isGitPath
         | 
| 169 | 
            -
                      Pod::Podfile.needUpdatePodList << name
         | 
| 170 | 
            -
                    end
         | 
| 182 | 
            +
                    Pod::Podfile.needUpdatePodList << name if isGitPath
         | 
| 171 183 | 
             
                    requirements.pop if options.empty?
         | 
| 172 184 | 
             
                  end
         | 
| 173 185 |  | 
| @@ -175,11 +187,9 @@ module Pod | |
| 175 187 | 
             
                    options = requirements.last
         | 
| 176 188 | 
             
                    return requirements unless options.is_a?(Hash)
         | 
| 177 189 |  | 
| 178 | 
            -
                    isPath = options. | 
| 190 | 
            +
                    isPath = options.key?(:path)
         | 
| 179 191 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 180 | 
            -
                    if isPath
         | 
| 181 | 
            -
                      Pod::Podfile.needUpdatePodList << name
         | 
| 182 | 
            -
                    end
         | 
| 192 | 
            +
                    Pod::Podfile.needUpdatePodList << name if isPath
         | 
| 183 193 | 
             
                    requirements.pop if options.empty?
         | 
| 184 194 | 
             
                  end
         | 
| 185 195 |  | 
| @@ -198,7 +208,7 @@ module Pod | |
| 198 208 | 
             
                    parse_needUpdatePod_path(name, requirements)
         | 
| 199 209 | 
             
                    # pod_name = Specification.root_name(name)
         | 
| 200 210 | 
             
                    Pod::Podfile.allPodName << name
         | 
| 201 | 
            -
                    old_method.bind(self).(name, requirements)
         | 
| 211 | 
            +
                    old_method.bind(self).call(name, requirements)
         | 
| 202 212 | 
             
                  end
         | 
| 203 213 |  | 
| 204 214 | 
             
                  def deep_copy(o)
         | 
| @@ -227,18 +237,84 @@ module Pod | |
| 227 237 |  | 
| 228 238 | 
             
                    # 去掉添加的字段
         | 
| 229 239 | 
             
                    tmp_hash = clean(name, requirements)
         | 
| 230 | 
            -
                    if tmp_hash && !tmp_hash.empty?
         | 
| 231 | 
            -
                       | 
| 240 | 
            +
                    pod = if tmp_hash && !tmp_hash.empty?
         | 
| 241 | 
            +
                      { name => tmp_hash }
         | 
| 232 242 | 
             
                    else
         | 
| 233 | 
            -
                       | 
| 234 | 
            -
             | 
| 243 | 
            +
                      name
         | 
| 244 | 
            +
                          end
         | 
| 235 245 |  | 
| 236 246 | 
             
                    get_hash_value('dependencies', []) << pod
         | 
| 237 247 | 
             
                    nil
         | 
| 238 248 | 
             
                  end
         | 
| 239 249 |  | 
| 240 | 
            -
             | 
| 241 250 | 
             
                end
         | 
| 251 | 
            +
              end
         | 
| 252 | 
            +
             | 
| 242 253 |  | 
| 254 | 
            +
              class Specification
         | 
| 255 | 
            +
                class Set
         | 
| 256 | 
            +
             | 
| 257 | 
            +
                  old_specification_name = instance_method(:specification_name)
         | 
| 258 | 
            +
                  # 对于内部依赖,如果父依赖是源码,则子依赖也是源码,父依赖决定
         | 
| 259 | 
            +
                  define_method(:specification_name) do ||
         | 
| 260 | 
            +
                    if Pod::Podfile.changedSubPods
         | 
| 261 | 
            +
                      spec = Specification.from_file(specification_paths_for_version(any_version).first)
         | 
| 262 | 
            +
                      if (spec.name =~ /^(?i)LJ/ || spec.name =~ /^(?i)Lianjia/) && spec.subspecs
         | 
| 263 | 
            +
                        dependence_note =[]
         | 
| 264 | 
            +
                        spec.subspecs.each do |subspec|
         | 
| 265 | 
            +
                          next if Pod::Podfile.archiveList.include?(subspec.name)
         | 
| 266 | 
            +
                          next if Pod::Podfile.frameworkList.include?(subspec.name)
         | 
| 267 | 
            +
                          if Pod::Podfile.sourceList.include?(spec.name) || Pod::Podfile.tmpSourceList.include?(spec.name)
         | 
| 268 | 
            +
                            dependence_note << subspec.name
         | 
| 269 | 
            +
                            next
         | 
| 270 | 
            +
                          end
         | 
| 271 | 
            +
                          envName = subspec.name.gsub(/[\/]/, '_')
         | 
| 272 | 
            +
                          next unless Pod::Podfile.sourceList.include?(subspec.name) || Pod::Podfile.tmpSourceList.include?(subspec.name)
         | 
| 273 | 
            +
                          next unless subspec.dependencies
         | 
| 274 | 
            +
                          subspec.dependencies.each do |dependency|
         | 
| 275 | 
            +
                            next unless dependency.name =~ /^(?i)#{spec.name}/
         | 
| 276 | 
            +
                            next if Pod::Podfile.archiveList.include?(dependency.name)
         | 
| 277 | 
            +
                            next if Pod::Podfile.frameworkList.include?(dependency.name)
         | 
| 278 | 
            +
                            dependence_note << dependency.name
         | 
| 279 | 
            +
                            # Pod::Podfile.sourceList << dependency.name unless Pod::Podfile.sourceList.include?(dependency.name)
         | 
| 280 | 
            +
                          end
         | 
| 281 | 
            +
                        end
         | 
| 282 | 
            +
             | 
| 283 | 
            +
                        dependence_note.each do |note|
         | 
| 284 | 
            +
                          cleanENV note
         | 
| 285 | 
            +
                          setEnv note, '_SOURCE'
         | 
| 286 | 
            +
                        end
         | 
| 287 | 
            +
                      end
         | 
| 288 | 
            +
                    end
         | 
| 289 | 
            +
                    name = old_specification_name.bind(self).call
         | 
| 290 | 
            +
                    name
         | 
| 291 | 
            +
                  end
         | 
| 292 | 
            +
             | 
| 293 | 
            +
                end
         | 
| 243 294 | 
             
              end
         | 
| 295 | 
            +
             | 
| 296 | 
            +
             | 
| 297 | 
            +
             | 
| 298 | 
            +
              # class Lockfile
         | 
| 299 | 
            +
              #
         | 
| 300 | 
            +
              #   old_detect_changes_with_podfile = instance_method(:detect_changes_with_podfile)
         | 
| 301 | 
            +
              #
         | 
| 302 | 
            +
              #   define_method(:detect_changes_with_podfile) do |podfile|
         | 
| 303 | 
            +
              #     pods_by_state = old_detect_changes_with_podfile.bind(self).(podfile)
         | 
| 304 | 
            +
              #     Pod::UI.puts Pod::Podfile.changedSubPods
         | 
| 305 | 
            +
              #     Pod::Podfile.changedSubPods.each do |changedSubPod|
         | 
| 306 | 
            +
              #       changedPod = changedSubPod.split("/")[0]
         | 
| 307 | 
            +
              #       if changedSubPod =~ /^(?i)LJ/ or changedSubPod =~ /^(?i)Lianjia/
         | 
| 308 | 
            +
              #         if pods_by_state.has_key?(:changed) and !pods_by_state[:changed].include? changedPod
         | 
| 309 | 
            +
              #           pods_by_state[:changed] << changedPod
         | 
| 310 | 
            +
              #           if pods_by_state.has_key?(:unchanged) and pods_by_state[:unchanged].include? changedPod
         | 
| 311 | 
            +
              #               pods_by_state[:unchanged].delete changedPod
         | 
| 312 | 
            +
              #           end
         | 
| 313 | 
            +
              #         end
         | 
| 314 | 
            +
              #       end
         | 
| 315 | 
            +
              #     end
         | 
| 316 | 
            +
              #     pods_by_state
         | 
| 317 | 
            +
              #   end
         | 
| 318 | 
            +
              #
         | 
| 319 | 
            +
              # end
         | 
| 244 320 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cocoapods-cafswitcher
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.12
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - handa
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-11-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |