prospectus_dockerhub 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: affb37b9ff270b5798c98cf5cc23295789fd38087e5130c6e18f1285156e5676
4
- data.tar.gz: 880cd39f99fc2ba2e5b571df52b4023adff6924088fcada750c847c7d70df301
3
+ metadata.gz: c015da8e1681bfd56d6109ae71fd012d55d78f8c80e8d8bab10611360f7992a8
4
+ data.tar.gz: 566c5815d1ed5282414157964368e66f27c5cc01fa48d0ad69d29ee2b146d6a6
5
5
  SHA512:
6
- metadata.gz: 846c79c1d79071714a7095ba15409770f74c60b8213366319349cb1f3cd94998340264d30cfc0e5bb0106500bb1186c8ad0c554d187d368c592e2c1ebf7efbcf
7
- data.tar.gz: 44a481551ac011e6dcb6c420c9805117368c37d662fcfb2c31addeca93caca0ba74f12c4030ea9b03517ba37c1a132ead3d11e107ae6be1869713c50fe48b49e
6
+ metadata.gz: bc477a90959b0a5e91c1ef9c4b34a29ae065f3251da9fc4e487045aaae2d8cdb32f5fd4e6aa6aa9defe1b255f87391c9f1e56076407eb2ec6471dd5e70a692a4
7
+ data.tar.gz: dbf0ece227c91f045ed3a0e9758e9ca240995bea266b2a14a7dc4add7d22b0ed1413e1a6c242a3810695af38911c4c24d60719c7bc3053e3afa64be5b549b07d
data/.circle-ruby CHANGED
@@ -1,3 +1,3 @@
1
- 2.5.1
2
- 2.4.4
3
- 2.3.7
1
+ 2.5.3
2
+ 2.4.5
3
+ 2.3.8
@@ -2,8 +2,25 @@ require 'nokogiri'
2
2
  require 'open-uri'
3
3
 
4
4
  module ProspectusDockerhub
5
- GOOD_STATUSES = %w[queued building success].freeze
5
+ STATUS_MAP = {
6
+ -4 => 'canceled',
7
+ -2 => 'exception',
8
+ -1 => 'error',
9
+ 0 => 'pending',
10
+ 1 => 'claimed',
11
+ 2 => 'started',
12
+ 3 => 'cloned',
13
+ 4 => 'readme',
14
+ 5 => 'dockerfile',
15
+ 6 => 'built',
16
+ 7 => 'bundled',
17
+ 8 => 'uploaded',
18
+ 9 => 'pushed',
19
+ 10 => 'done',
20
+ 11 => 'queued'
21
+ }.freeze
6
22
  # rubocop:disable Metrics/LineLength
23
+ GOOD_STATUSES = %w[started cloned readme dockerfile built bundled uploaded pushed queued claimed pending].freeze
7
24
  STATUS_XPATH = '//span[contains(@class, "BuildStatus__statusWrapper__")]'.freeze
8
25
  # rubocop:enable Metrics/LineLength
9
26
 
@@ -38,23 +55,27 @@ module ProspectusDockerhub
38
55
 
39
56
  def parse_status
40
57
  return [status, status] if GOOD_STATUSES.include?(status)
41
- [status, 'success']
58
+ [status, 'done']
42
59
  end
43
60
 
44
61
  def status
45
- @status ||= html.xpath(STATUS_XPATH).first.text.strip.downcase
62
+ @status ||= STATUS_MAP[status_code]
46
63
  end
47
64
 
48
- def html
49
- @html ||= Nokogiri::HTML(open(url)) # rubocop:disable Security/Open
65
+ def status_code
66
+ @status_code ||= json['results'].first['status']
67
+ end
68
+
69
+ def json
70
+ @json ||= JSON.parse(open(url).read) # rubocop:disable Security/Open
50
71
  end
51
72
 
52
73
  def url
53
- "#{base_url}/#{@repo_slug}/builds"
74
+ "#{base_url}/#{@repo_slug}/buildhistory/?page_size=1&page=1"
54
75
  end
55
76
 
56
77
  def base_url
57
- 'https://hub.docker.com/r'
78
+ 'https://hub.docker.com/v2/repositories'
58
79
  end
59
80
  end
60
81
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'prospectus_dockerhub'
3
- s.version = '0.0.8'
3
+ s.version = '0.1.0'
4
4
  s.date = Time.now.strftime('%Y-%m-%d')
5
5
 
6
6
  s.summary = 'Prospectus helpers for docker hub'
@@ -18,8 +18,8 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_development_dependency 'codecov', '~> 0.1.1'
20
20
  s.add_development_dependency 'fuubar', '~> 2.3.0'
21
- s.add_development_dependency 'goodcop', '~> 0.5.0'
21
+ s.add_development_dependency 'goodcop', '~> 0.6.0'
22
22
  s.add_development_dependency 'rake', '~> 12.3.0'
23
23
  s.add_development_dependency 'rspec', '~> 3.8.0'
24
- s.add_development_dependency 'rubocop', '~> 0.58.0'
24
+ s.add_development_dependency 'rubocop', '~> 0.61.1'
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prospectus_dockerhub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-09 00:00:00.000000000 Z
11
+ date: 2018-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.6.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.58.0
117
+ version: 0.61.1
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.58.0
124
+ version: 0.61.1
125
125
  description: Prospectus helpers for docker hub
126
126
  email: me@lesaker.org
127
127
  executables: []