package_cloud 0.3.07 → 0.3.10
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 +5 -5
- data/README.md +18 -0
- data/lib/package_cloud/cli/entry.rb +24 -14
- data/lib/package_cloud/validator.rb +8 -1
- data/lib/package_cloud/version.rb +1 -1
- data/package_cloud.gemspec +3 -3
- metadata +16 -17
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 742e3bad6322b16c1174addee4ee290a0eb880bc3f1150deb5367a0733c49a33
         | 
| 4 | 
            +
              data.tar.gz: e3aae0a0e065b9880548d035a835a26eba3b46827a5ac6f579ac5cdc160a4364
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 4a3e4cbea1c841372a448cbb87947449410d2b5bbba384239ed14d006b8ee39c055e58003db21a23024607c6703eeb473631c2766021b2899976e0d3aa21297a
         | 
| 7 | 
            +
              data.tar.gz: f694739c61f3a63f1c84abb45246c7ae638a3affbb01868c3bb4e2c1aa1a95203e2178ef9d355b78cf38243bc19f014c460f377afbc3352778800e8e7d5bffcf
         | 
    
        data/README.md
    CHANGED
    
    | @@ -164,6 +164,24 @@ repository owned by `example-user` as a RubyGem package. | |
| 164 164 | 
             
            Note that unlike all other package types, RubyGems do not require any
         | 
| 165 165 | 
             
            additional specification on upload.
         | 
| 166 166 |  | 
| 167 | 
            +
            #### Uploading a arbitrary file 
         | 
| 168 | 
            +
             | 
| 169 | 
            +
            NOTE:
         | 
| 170 | 
            +
             | 
| 171 | 
            +
            Currently supported files:
         | 
| 172 | 
            +
             | 
| 173 | 
            +
            * .asc (armored ascii signature file)
         | 
| 174 | 
            +
             | 
| 175 | 
            +
            You can upload a Anyfile package found at the path `/tmp/example.asc` by
         | 
| 176 | 
            +
            running:
         | 
| 177 | 
            +
             | 
| 178 | 
            +
            ```
         | 
| 179 | 
            +
            package_cloud push example-user/example-repository/anyfile /tmp/example.asc
         | 
| 180 | 
            +
            ```
         | 
| 181 | 
            +
             | 
| 182 | 
            +
            This command will upload `/tmp/example.asc` to the `example-repository`
         | 
| 183 | 
            +
            repository owned by `example-user` as an Anyfile package.
         | 
| 184 | 
            +
             | 
| 167 185 | 
             
            #### Uploading a Python package
         | 
| 168 186 |  | 
| 169 187 | 
             
            You can upload a Python package found at the path `/tmp/example.whl` by
         | 
| @@ -2,8 +2,10 @@ module PackageCloud | |
| 2 2 | 
             
              module CLI
         | 
| 3 3 | 
             
                JAVA_EXTS = ["jar", "aar", "war"]
         | 
| 4 4 | 
             
                PY_EXTS = ["gz", "bz2", "z", "tar", "egg-info", "zip", "whl", "egg"]
         | 
| 5 | 
            -
                 | 
| 6 | 
            -
                 | 
| 5 | 
            +
                ANYFILE_EXTS = ["asc"]
         | 
| 6 | 
            +
                NODE_EXTS = []
         | 
| 7 | 
            +
                AMBIGUOUS_EXTS = ["tgz", "apk"]
         | 
| 8 | 
            +
                SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + ANYFILE_EXTS + AMBIGUOUS_EXTS + ["gem", "deb", "rpm", "dsc"]
         | 
| 7 9 |  | 
| 8 10 | 
             
                class Entry < Base
         | 
| 9 11 | 
             
                  desc "repository SUBCMD ...ARGS", "manage repositories"
         | 
| @@ -105,12 +107,13 @@ module PackageCloud | |
| 105 107 | 
             
                                        :desc => "Specify the exact maven coordinates to use for a JAR. Useful for JARs without coordinates, 'fat JARs', and WARs."
         | 
| 106 108 |  | 
| 107 109 | 
             
                  def push(repo, package_file, *package_files)
         | 
| 110 | 
            +
            puts "################### push- repo: #{repo.inspect}"
         | 
| 108 111 | 
             
                    total_time = Benchmark.measure do
         | 
| 109 112 | 
             
                      ARGV.clear # otherwise gets explodes
         | 
| 110 113 | 
             
                      package_files << package_file
         | 
| 111 114 |  | 
| 112 115 | 
             
                      exts = package_files.map { |f| f.split(".").last }.uniq
         | 
| 113 | 
            -
                      exts = handle_special_exts(repo, exts)
         | 
| 116 | 
            +
            ####          exts = handle_special_exts(repo, exts)
         | 
| 114 117 |  | 
| 115 118 | 
             
                      if package_files.length > 1 && exts.length > 1
         | 
| 116 119 | 
             
                        abort("You can't push multiple packages of different types at the same time.\nFor example, use *.deb to push all your debs at once.".color(:red))
         | 
| @@ -129,7 +132,8 @@ module PackageCloud | |
| 129 132 | 
             
                        invalid_packages.each do |p|
         | 
| 130 133 | 
             
                          message << "  #{p}\n"
         | 
| 131 134 | 
             
                        end
         | 
| 132 | 
            -
                        message << "\npackage_cloud only supports node.js, deb, gem, java, python,  | 
| 135 | 
            +
                        message << "\npackage_cloud only supports node.js, deb, gem, java, python, "\
         | 
| 136 | 
            +
                                   "rpm, alpine, helm, anyfile (.zip, .asc) packages".color(:red)
         | 
| 133 137 | 
             
                        abort(message)
         | 
| 134 138 | 
             
                      end
         | 
| 135 139 |  | 
| @@ -146,11 +150,15 @@ module PackageCloud | |
| 146 150 | 
             
                      validator = Validator.new(client)
         | 
| 147 151 | 
             
                      if PY_EXTS.include?(exts.first.downcase)
         | 
| 148 152 | 
             
                        dist_id   = validator.distribution_id(repo, package_files, 'py')
         | 
| 153 | 
            +
                      elsif ANYFILE_EXTS.include?(exts.first.downcase)
         | 
| 154 | 
            +
                        dist_id   = validator.distribution_id(repo, package_files, 'anyfile')
         | 
| 149 155 | 
             
                      elsif NODE_EXTS.include?(exts.first.downcase)
         | 
| 150 156 | 
             
                        dist_id   = validator.distribution_id(repo, package_files, 'node')
         | 
| 151 157 | 
             
                      elsif JAVA_EXTS.include?(exts.first.downcase)
         | 
| 152 158 | 
             
                        abort_if_snapshot!(package_files)
         | 
| 153 159 | 
             
                        dist_id   = validator.distribution_id(repo, package_files, 'jar')
         | 
| 160 | 
            +
                      elsif AMBIGUOUS_EXTS.include?(exts.first.downcase)
         | 
| 161 | 
            +
                        dist_id   = validator.distribution_id_from_url(repo, package_files)
         | 
| 154 162 | 
             
                      else
         | 
| 155 163 | 
             
                        dist_id   = validator.distribution_id(repo, package_files, exts.first)
         | 
| 156 164 | 
             
                      end
         | 
| @@ -196,16 +204,16 @@ module PackageCloud | |
| 196 204 | 
             
                  end
         | 
| 197 205 |  | 
| 198 206 | 
             
                  private
         | 
| 199 | 
            -
                    def handle_special_exts(repo, exts)
         | 
| 200 | 
            -
                      exts.map do |elem|
         | 
| 201 | 
            -
                        case elem
         | 
| 202 | 
            -
                        when 'apk'
         | 
| 203 | 
            -
                          elem = repo.include?("alpine") ? "alpine" : elem
         | 
| 204 | 
            -
                        else
         | 
| 205 | 
            -
                          elem
         | 
| 206 | 
            -
                        end
         | 
| 207 | 
            -
                      end
         | 
| 208 | 
            -
                    end
         | 
| 207 | 
            +
            ####        def handle_special_exts(repo, exts)
         | 
| 208 | 
            +
            ####          exts.map do |elem|
         | 
| 209 | 
            +
            ####            case elem
         | 
| 210 | 
            +
            ####            when 'apk'
         | 
| 211 | 
            +
            ####              elem = repo.include?("alpine") ? "alpine" : elem
         | 
| 212 | 
            +
            ####            else
         | 
| 213 | 
            +
            ####              elem
         | 
| 214 | 
            +
            ####            end
         | 
| 215 | 
            +
            ####          end
         | 
| 216 | 
            +
            ####        end
         | 
| 209 217 |  | 
| 210 218 | 
             
                    def expand_dist_shortcut(dist)
         | 
| 211 219 | 
             
                      case dist
         | 
| @@ -213,6 +221,8 @@ module PackageCloud | |
| 213 221 | 
             
                        'java/maven2'
         | 
| 214 222 | 
             
                      when 'python'
         | 
| 215 223 | 
             
                        'python/1'
         | 
| 224 | 
            +
                      when 'anyfile'
         | 
| 225 | 
            +
                        'anyfile/1'
         | 
| 216 226 | 
             
                      when 'node'
         | 
| 217 227 | 
             
                        'node/1'
         | 
| 218 228 | 
             
                      else
         | 
| @@ -4,12 +4,19 @@ module PackageCloud | |
| 4 4 | 
             
                  @client = client
         | 
| 5 5 | 
             
                end
         | 
| 6 6 |  | 
| 7 | 
            +
                def distribution_id_from_url(repo, filenames)
         | 
| 8 | 
            +
                  _,_,dist_sel,ver_sel = repo.split("/")
         | 
| 9 | 
            +
                 package_type = dist_sel
         | 
| 10 | 
            +
            puts "ambiguous extensions, so using repo url to deduce package_type, package_type: #{package_type}"
         | 
| 11 | 
            +
                distribution_id(repo, filenames, package_type)
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 7 14 | 
             
                def distribution_id(repo, filenames, package_type)
         | 
| 8 15 | 
             
                  if distributions[package_type]
         | 
| 9 16 | 
             
                    _,_,dist_sel,ver_sel = repo.split("/")
         | 
| 10 17 |  | 
| 11 18 | 
             
                    # These are all 'single version' distros
         | 
| 12 | 
            -
                    if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node")
         | 
| 19 | 
            +
                    if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node" || dist_sel == "anyfile")
         | 
| 13 20 | 
             
                      dist = distributions[package_type].detect { |d| d["index_name"] == dist_sel }
         | 
| 14 21 | 
             
                      dist["versions"].first["id"]
         | 
| 15 22 | 
             
                    elsif dist_sel && ver_sel
         | 
    
        data/package_cloud.gemspec
    CHANGED
    
    | @@ -19,10 +19,10 @@ Gem::Specification.new do |spec| | |
| 19 19 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 20 20 | 
             
              spec.require_paths = ["lib"]
         | 
| 21 21 |  | 
| 22 | 
            -
              spec.add_runtime_dependency "thor", "~>  | 
| 23 | 
            -
              spec.add_runtime_dependency "highline", " | 
| 22 | 
            +
              spec.add_runtime_dependency "thor", "~> 1.2"
         | 
| 23 | 
            +
              spec.add_runtime_dependency "highline", "~> 2.0.0"
         | 
| 24 24 | 
             
              spec.add_runtime_dependency "rest-client", "~> 2.0"
         | 
| 25 | 
            -
              spec.add_runtime_dependency "json_pure", " | 
| 25 | 
            +
              spec.add_runtime_dependency "json_pure", "~> 2.3.0"
         | 
| 26 26 | 
             
              spec.add_runtime_dependency "rainbow", "2.2.2"
         | 
| 27 27 |  | 
| 28 28 | 
             
              spec.add_development_dependency "bundler", "~> 1.3"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: package_cloud
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Joe Damato
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-09-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thor
         | 
| @@ -16,28 +16,28 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: ' | 
| 19 | 
            +
                    version: '1.2'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: ' | 
| 26 | 
            +
                    version: '1.2'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: highline
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 | 
            -
                - -  | 
| 31 | 
            +
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 33 | 
            +
                    version: 2.0.0
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 | 
            -
                - -  | 
| 38 | 
            +
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 40 | 
            +
                    version: 2.0.0
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: rest-client
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -56,16 +56,16 @@ dependencies: | |
| 56 56 | 
             
              name: json_pure
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 | 
            -
                - -  | 
| 59 | 
            +
                - - "~>"
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version:  | 
| 61 | 
            +
                    version: 2.3.0
         | 
| 62 62 | 
             
              type: :runtime
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 | 
            -
                - -  | 
| 66 | 
            +
                - - "~>"
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version:  | 
| 68 | 
            +
                    version: 2.3.0
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: rainbow
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -163,7 +163,7 @@ homepage: https://packagecloud.io | |
| 163 163 | 
             
            licenses:
         | 
| 164 164 | 
             
            - MIT
         | 
| 165 165 | 
             
            metadata: {}
         | 
| 166 | 
            -
            post_install_message: | 
| 166 | 
            +
            post_install_message:
         | 
| 167 167 | 
             
            rdoc_options: []
         | 
| 168 168 | 
             
            require_paths:
         | 
| 169 169 | 
             
            - lib
         | 
| @@ -178,9 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 178 178 | 
             
                - !ruby/object:Gem::Version
         | 
| 179 179 | 
             
                  version: '0'
         | 
| 180 180 | 
             
            requirements: []
         | 
| 181 | 
            -
             | 
| 182 | 
            -
             | 
| 183 | 
            -
            signing_key: 
         | 
| 181 | 
            +
            rubygems_version: 3.2.3
         | 
| 182 | 
            +
            signing_key:
         | 
| 184 183 | 
             
            specification_version: 4
         | 
| 185 184 | 
             
            summary: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,
         | 
| 186 185 | 
             
              Python, and Java packages. Check our website or the RubyDoc documentation for detailed
         |