packaging 0.99.22 → 0.99.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/gem.rb +16 -0
- data/spec/lib/packaging/gem_spec.rb +82 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b0d6c25b216fc87def324998fbe08b683065edfc8e98bc5448b748799a2b9a7
|
4
|
+
data.tar.gz: ab5c52319e75b74c772d395cffe9c6c043b76b9966d875420af99c9547a75be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e21ac37c6e6c7d84920c55897a4c07b07e58168d6efb9c00cf82cd1878e17129c11633ec1af282768e69e44a946e1e072f23e78fb4f8b366636ac6dd1849aec
|
7
|
+
data.tar.gz: 3adb0a5f3cf580b9bba67f382dd04c9cad17926984d13ee658d65296ad08e3830f6b9b171f30009bf7563ccb1595227ea4ffc21567839a10082649372df9a1ca
|
data/lib/packaging/gem.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'json'
|
1
2
|
module Pkg::Gem
|
2
3
|
class << self
|
3
4
|
# This is preserved because I don't want to update the deprecated code path
|
@@ -15,10 +16,25 @@ module Pkg::Gem
|
|
15
16
|
Pkg::Util::Ship.ship_pkgs(["#{file}*"], Pkg::Config.gem_host, Pkg::Config.gem_path, platform_independent: true)
|
16
17
|
end
|
17
18
|
|
19
|
+
def shipped_to_rubygems?(gem_name, gem_version)
|
20
|
+
gem_data = JSON.parse(`curl https://rubygems.org/api/v1/versions/#{gem_name}.json`)
|
21
|
+
gem_versions = gem_data.map { |version| version['number'] }
|
22
|
+
return gem_versions.include? gem_version
|
23
|
+
rescue => e
|
24
|
+
puts "Uh oh, something went wrong searching for gem '#{gem_name}':"
|
25
|
+
puts e
|
26
|
+
puts "Perhaps you're shipping gem '#{gem_name}' for the first time? Congrats!"
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
18
30
|
# Ship a Ruby gem file to rubygems.org. Requires the existence
|
19
31
|
# of a ~/.gem/credentials file or else rubygems.org won't have
|
20
32
|
# any idea who you are.
|
21
33
|
def ship_to_rubygems(file, options = {})
|
34
|
+
if shipped_to_rubygems?(Pkg::Config.gem_name, Pkg::Config.gemversion)
|
35
|
+
puts "#{file} has already been shipped to rubygems, skipping . . ."
|
36
|
+
return
|
37
|
+
end
|
22
38
|
Pkg::Util::File.file_exists?("#{ENV['HOME']}/.gem/credentials", :required => true)
|
23
39
|
gem_push_command = "gem push #{file}"
|
24
40
|
gem_push_command << " --host #{options[:host]}" if options[:host]
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Pkg::Gem' do
|
4
|
+
describe '#shipped_to_rubygems?' do
|
5
|
+
let(:gem_data) {
|
6
|
+
[
|
7
|
+
{"authors"=>"Puppet Labs",
|
8
|
+
"built_at"=>"2018-12-17T00:00:00.000Z",
|
9
|
+
"created_at"=>"2018-12-18T17:31:50.852Z",
|
10
|
+
"description"=>"Puppet, an automated configuration management tool",
|
11
|
+
"downloads_count"=>32750,
|
12
|
+
"metadata"=>{},
|
13
|
+
"number"=>"6.1.0",
|
14
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
15
|
+
"platform"=>"ruby",
|
16
|
+
"rubygems_version"=>"> 1.3.1",
|
17
|
+
"ruby_version"=>">= 2.3.0",
|
18
|
+
"prerelease"=>false,
|
19
|
+
"licenses"=>[],
|
20
|
+
"requirements"=>[],
|
21
|
+
"sha"=>"71ecec1f554cd7a7f23abf1523e4f0f15fb8ddbc973201234d0cc2a889566373"},
|
22
|
+
{"authors"=>"Puppet Labs",
|
23
|
+
"built_at"=>"2019-01-14T00:00:00.000Z",
|
24
|
+
"created_at"=>"2019-01-15T15:25:25.183Z",
|
25
|
+
"description"=>"Puppet, an automated configuration management tool",
|
26
|
+
"downloads_count"=>540,
|
27
|
+
"metadata"=>{},
|
28
|
+
"number"=>"6.0.5",
|
29
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
30
|
+
"platform"=>"ruby",
|
31
|
+
"rubygems_version"=>"> 1.3.1",
|
32
|
+
"ruby_version"=>">= 2.3.0",
|
33
|
+
"prerelease"=>false,
|
34
|
+
"licenses"=>[],
|
35
|
+
"requirements"=>[],
|
36
|
+
"sha"=>"76811bcf4c5ab75470dd6ae5eea552347767748bd80136cac74261336b208916"},
|
37
|
+
{"authors"=>"Puppet Labs",
|
38
|
+
"built_at"=>"2018-10-31T00:00:00.000Z",
|
39
|
+
"created_at"=>"2018-11-01T17:07:19.274Z",
|
40
|
+
"description"=>"Puppet, an automated configuration management tool",
|
41
|
+
"downloads_count"=>71808,
|
42
|
+
"metadata"=>{},
|
43
|
+
"number"=>"6.0.4",
|
44
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
45
|
+
"platform"=>"ruby",
|
46
|
+
"rubygems_version"=>"> 1.3.1",
|
47
|
+
"ruby_version"=>">= 2.3.0",
|
48
|
+
"prerelease"=>false,
|
49
|
+
"licenses"=>[],
|
50
|
+
"requirements"=>[],
|
51
|
+
"sha"=>"203e8b529d37260115ab7e804e607dde5e543144331b40c3c4a77c2d33445026"},
|
52
|
+
{"authors"=>"Puppet Labs",
|
53
|
+
"built_at"=>"2018-10-31T00:00:00.000Z",
|
54
|
+
"created_at"=>"2018-11-01T17:07:10.268Z",
|
55
|
+
"description"=>"Puppet, an automated configuration management tool",
|
56
|
+
"downloads_count"=>1179,
|
57
|
+
"metadata"=>{},
|
58
|
+
"number"=>"6.0.4",
|
59
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
60
|
+
"platform"=>"x86-mingw32",
|
61
|
+
"rubygems_version"=>"> 1.3.1",
|
62
|
+
"ruby_version"=>">= 2.3.0",
|
63
|
+
"prerelease"=>false,
|
64
|
+
"licenses"=>[],
|
65
|
+
"requirements"=>[],
|
66
|
+
"sha"=>"e57ef7d537aaf66343615d7413d1ff759cc2b6ae95cc90514dd8f3caf0f08cb1"}
|
67
|
+
]
|
68
|
+
}
|
69
|
+
it 'returns true if gem version has already been shipped' do
|
70
|
+
allow(JSON).to receive(:parse).and_return(gem_data)
|
71
|
+
expect(Pkg::Gem.shipped_to_rubygems?('puppet', '6.0.5')).to be true
|
72
|
+
end
|
73
|
+
it 'returns false if gem version has not already been shipped' do
|
74
|
+
allow(JSON).to receive(:parse).and_return(gem_data)
|
75
|
+
expect(Pkg::Gem.shipped_to_rubygems?('puppet', '6.0.9')).to be false
|
76
|
+
end
|
77
|
+
it 'returns false if gem is not found at all on rubygems' do
|
78
|
+
expect { Pkg::Gem.shipped_to_rubygems?('totally-not-a-real-gem', '9.9.9') }.to_not raise_error
|
79
|
+
expect(Pkg::Gem.shipped_to_rubygems?('totally-not-a-real-gem', '9.9.9')).to be false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- spec/lib/packaging/config_spec.rb
|
142
142
|
- spec/lib/packaging/deb/repo_spec.rb
|
143
143
|
- spec/lib/packaging/deb_spec.rb
|
144
|
+
- spec/lib/packaging/gem_spec.rb
|
144
145
|
- spec/lib/packaging/paths_spec.rb
|
145
146
|
- spec/lib/packaging/platforms_spec.rb
|
146
147
|
- spec/lib/packaging/repo_spec.rb
|
@@ -232,6 +233,7 @@ test_files:
|
|
232
233
|
- spec/lib/packaging/config_spec.rb
|
233
234
|
- spec/lib/packaging/deb/repo_spec.rb
|
234
235
|
- spec/lib/packaging/deb_spec.rb
|
236
|
+
- spec/lib/packaging/gem_spec.rb
|
235
237
|
- spec/lib/packaging/paths_spec.rb
|
236
238
|
- spec/lib/packaging/platforms_spec.rb
|
237
239
|
- spec/lib/packaging/repo_spec.rb
|