gct 0.2.5 → 0.2.6
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/lib/gct/command/spec/lint.rb +53 -14
- data/lib/gct/version.rb +1 -1
- 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: fcbe1a0b358a5d2f8579f1dcdbc323a94c390ad1d022ea362955399c158572b6
         | 
| 4 | 
            +
              data.tar.gz: 7bbf206c9c77fbff1d2e101cd1156167ad758b2d9092038ec8f7cb9081005375
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9180c790294328532eaa45342f656b16fcf7689b53d7d93bb68fdde1357a72bcaaf6621df390869d085be924130730c2166ddc47583ef357ddba94fe3f562478
         | 
| 7 | 
            +
              data.tar.gz: 0f6fd44317552e8a3be79ae42b65b69cd8bf4a9bd585f5ad0ecc06d22073dd87bca49047191dfca57d50c9d84ab90cf090db0ce393a0e05a71866d91b82dbe4f
         | 
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            require 'cocoapods'
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            module Gct
         | 
| 2 4 | 
             
              class Command
         | 
| 3 5 | 
             
                class Spec < Command
         | 
| @@ -20,24 +22,61 @@ module Gct | |
| 20 22 | 
             
                    end
         | 
| 21 23 |  | 
| 22 24 | 
             
                    def run
         | 
| 23 | 
            -
                       | 
| 25 | 
            +
                      lint_spec
         | 
| 26 | 
            +
                    end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    def generate_podfile(pod_name, spec_path)
         | 
| 29 | 
            +
                      Pod::Podfile.new do
         | 
| 30 | 
            +
                        install! 'cocoapods', :integrate_targets => false
         | 
| 31 | 
            +
                        inhibit_all_warnings!
         | 
| 32 | 
            +
                        source 'https://gi-dev.ccrgt.com/ios/iOSCRGTPodSource.git'
         | 
| 33 | 
            +
                        target 'App' do
         | 
| 34 | 
            +
                          platform :ios, 10.0
         | 
| 35 | 
            +
                          pod pod_name, :podspec => spec_path, :inhibit_warnings => false
         | 
| 36 | 
            +
                        end
         | 
| 37 | 
            +
                      end
         | 
| 24 38 | 
             
                    end
         | 
| 25 39 |  | 
| 26 | 
            -
                    def  | 
| 27 | 
            -
                       | 
| 28 | 
            -
                       | 
| 29 | 
            -
             | 
| 30 | 
            -
                       | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 40 | 
            +
                    def lint_spec
         | 
| 41 | 
            +
                      spec_file = Pathname.glob('*.podspec').first
         | 
| 42 | 
            +
                      raise "在 #{Dir.pwd} 目录下找不到podspec文件".red if spec_file.nil?
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                      spec_path = spec_file.realpath
         | 
| 45 | 
            +
                      spec = Pod::Specification.from_file(spec_file)
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                      puts ''
         | 
| 48 | 
            +
                      Pod::UI.section('校验组件循环引用'.green) do
         | 
| 49 | 
            +
                        sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root)
         | 
| 50 | 
            +
                        podfile = generate_podfile(spec.name, spec_path)
         | 
| 51 | 
            +
                        installer = Pod::Installer.new(sandbox, podfile)
         | 
| 52 | 
            +
                        %i(prepare resolve_dependencies download_dependencies write_lockfiles).each { |m| installer.send(m) }
         | 
| 53 | 
            +
                      end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                      puts ''
         | 
| 56 | 
            +
                      Pod::UI.section('校验组件包含关系'.green) do
         | 
| 57 | 
            +
                        specific_bussiness_line_pods = %w[
         | 
| 58 | 
            +
                          GCT.R
         | 
| 59 | 
            +
                        ].freeze
         | 
| 60 | 
            +
                        specific_pods = []
         | 
| 61 | 
            +
                        if spec.dependencies.length > 0
         | 
| 62 | 
            +
                          specific_pods = spec.dependencies.select do |dep|
         | 
| 63 | 
            +
                            specific_bussiness_line_pods.include?(dep.root_name)
         | 
| 64 | 
            +
                          end
         | 
| 65 | 
            +
                        end
         | 
| 66 | 
            +
                        if spec.subspecs.length > 0 
         | 
| 67 | 
            +
                          spec.subspecs.each do |subspec|
         | 
| 68 | 
            +
                            new_specific_pods = []
         | 
| 69 | 
            +
                            new_specific_pods = subspec.dependencies.select do |dep|
         | 
| 70 | 
            +
                              specific_bussiness_line_pods.include?(dep.root_name)
         | 
| 37 71 | 
             
                            end
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                           | 
| 72 | 
            +
                            specific_pods = specific_pods + new_specific_pods
         | 
| 73 | 
            +
                          end
         | 
| 74 | 
            +
                        end 
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                        if specific_pods.any?
         | 
| 77 | 
            +
                          raise "podspec 不建议包含组件 #{specific_pods.map(&:name).join(', ')}".red
         | 
| 40 78 | 
             
                        end
         | 
| 79 | 
            +
                        puts '业务线私有组件包含关系校验完毕'.green
         | 
| 41 80 | 
             
                      end
         | 
| 42 81 | 
             
                    end
         | 
| 43 82 | 
             
                  end
         | 
    
        data/lib/gct/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gct
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - jieming
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-05- | 
| 11 | 
            +
            date: 2020-05-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |