gct 0.1.8 → 0.1.9
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/create/third.rb +33 -10
- data/lib/gct/command/op/gems.rb +10 -2
- 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: c06014224ab0efd5c15476793d97d566c7089bbc11b52a5aed2550c30655e8b7
         | 
| 4 | 
            +
              data.tar.gz: 3d58f23f04cbf4a618dc8a9810fa4a49d3e41078fe8b0ce84d06181e1fbd69ce
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a43586d042e87cf2ee7640c902f84a1e64caa9a3779a50dfcde6094f0fbfecb57da288de2ebd28dbd90a0f1ebea9bf87482457bb6b31eae1b6ab3d63f5c663e9
         | 
| 7 | 
            +
              data.tar.gz: 7115bddc78ff2a5c9b74610c5c3b3a0b6e17dd486f9dcadd8ae46ee1643b8ce4cf7bb8fabe1f01d19e1ede541acbe6eda6ec789e43a9d243520cda10b20b74c2
         | 
| @@ -10,12 +10,13 @@ module Gct | |
| 10 10 |  | 
| 11 11 | 
             
                    self.arguments = [
         | 
| 12 12 | 
             
                      CLAide::Argument.new('URL', true),
         | 
| 13 | 
            +
                      CLAide::Argument.new('BRANCH', false),
         | 
| 13 14 | 
             
                    ]
         | 
| 14 15 |  | 
| 15 16 | 
             
                    def initialize(argv)
         | 
| 16 17 | 
             
                      @url = argv.shift_argument
         | 
| 18 | 
            +
                      @branch = argv.shift_argument
         | 
| 17 19 | 
             
                      super
         | 
| 18 | 
            -
                      @additional_args = argv.remainder!
         | 
| 19 20 | 
             
                    end
         | 
| 20 21 |  | 
| 21 22 | 
             
                    def validate!
         | 
| @@ -24,16 +25,38 @@ module Gct | |
| 24 25 | 
             
                    end
         | 
| 25 26 |  | 
| 26 27 | 
             
                    def run
         | 
| 27 | 
            -
                       | 
| 28 | 
            -
             | 
| 29 | 
            -
                       | 
| 30 | 
            -
             | 
| 31 | 
            -
                       | 
| 32 | 
            -
             | 
| 33 | 
            -
                      `git push --tags`
         | 
| 34 | 
            -
                      # TODO 将podspec上传到私有specs上
         | 
| 28 | 
            +
                      if @url.include? '.git'
         | 
| 29 | 
            +
                        fork_third_pod_to_gitlab
         | 
| 30 | 
            +
                      else
         | 
| 31 | 
            +
                        puts "该链接不是一个Git仓库".red
         | 
| 32 | 
            +
                      end
         | 
| 33 | 
            +
                    end
         | 
| 35 34 |  | 
| 36 | 
            -
             | 
| 35 | 
            +
                    def fork_third_pod_to_gitlab
         | 
| 36 | 
            +
                      reg = /[a-zA-Z|\-|_|0-9]+(?=\.git)/
         | 
| 37 | 
            +
                      dir = reg.match(@url)
         | 
| 38 | 
            +
                      path = "#{Dir.pwd}/#{dir}"
         | 
| 39 | 
            +
                      if File::exist?(path)
         | 
| 40 | 
            +
                        puts "#{dir}文件夹已存在!".red
         | 
| 41 | 
            +
                      else
         | 
| 42 | 
            +
                        branch = @branch.to_s.empty? ? '' : "-b #{@branch}"
         | 
| 43 | 
            +
                        `git clone #{branch} #{@url}`
         | 
| 44 | 
            +
                        puts "git命令为:<-- git clone #{branch} #{@url} -->".green
         | 
| 45 | 
            +
                        Dir.chdir(path) do
         | 
| 46 | 
            +
                          git_url = "#{Constant.GitURL}#{dir}"
         | 
| 47 | 
            +
                          `git init`
         | 
| 48 | 
            +
                          `git remote set-url origin #{git_url}.git`
         | 
| 49 | 
            +
                          `git add .`
         | 
| 50 | 
            +
                          `git commit -m "First commit"`
         | 
| 51 | 
            +
                          `git push -u origin master`
         | 
| 52 | 
            +
                          `git push --tags`
         | 
| 53 | 
            +
                          # TODO 将podspec上传到私有specs上
         | 
| 54 | 
            +
                
         | 
| 55 | 
            +
                          puts "fork 第三方库成功!".green
         | 
| 56 | 
            +
                          puts "git 地址为:#{git_url}".green
         | 
| 57 | 
            +
                          system "open #{git_url}"
         | 
| 58 | 
            +
                        end
         | 
| 59 | 
            +
                      end
         | 
| 37 60 | 
             
                    end
         | 
| 38 61 | 
             
                  end
         | 
| 39 62 | 
             
                end
         | 
    
        data/lib/gct/command/op/gems.rb
    CHANGED
    
    | @@ -24,8 +24,16 @@ module Gct | |
| 24 24 | 
             
                    end
         | 
| 25 25 |  | 
| 26 26 | 
             
                    def openGems
         | 
| 27 | 
            -
                       | 
| 28 | 
            -
                       | 
| 27 | 
            +
                      last_version_file = "0"
         | 
| 28 | 
            +
                      Dir.foreach('/Library/Ruby/Gems/') do |file|
         | 
| 29 | 
            +
                        if file.to_s > last_version_file
         | 
| 30 | 
            +
                          last_version_file = file.to_s
         | 
| 31 | 
            +
                        end
         | 
| 32 | 
            +
                      end
         | 
| 33 | 
            +
                      version = last_version_file
         | 
| 34 | 
            +
                      path = "/Library/Ruby/Gems/#{version}/gems"
         | 
| 35 | 
            +
                      puts "gem路径为:#{path}".green
         | 
| 36 | 
            +
                      system "open #{path}"
         | 
| 29 37 | 
             
                    end
         | 
| 30 38 | 
             
                  end
         | 
| 31 39 | 
             
                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.1. | 
| 4 | 
            +
              version: 0.1.9
         | 
| 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-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |