bundler-alive 0.1.2 → 0.1.3
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/.rspec +1 -0
- data/Gemfile +5 -1
- data/README.md +11 -2
- data/lib/bundler/alive/announcer.rb +31 -0
- data/lib/bundler/alive/cli.rb +10 -14
- data/lib/bundler/alive/client/gems_api_client.rb +108 -0
- data/lib/bundler/alive/client/gems_api_response.rb +29 -0
- data/lib/bundler/alive/client/git_hub_api.rb +120 -20
- data/lib/bundler/alive/client/source_code_client.rb +5 -2
- data/lib/bundler/alive/doctor.rb +75 -70
- data/lib/bundler/alive/report.rb +35 -0
- data/lib/bundler/alive/reportable.rb +67 -0
- data/lib/bundler/alive/source_code_repository.rb +1 -11
- data/lib/bundler/alive/source_code_repository_url.rb +41 -8
- data/lib/bundler/alive/{gem_status.rb → status.rb} +23 -8
- data/lib/bundler/alive/status_collection.rb +149 -0
- data/lib/bundler/alive/status_result.rb +40 -0
- data/lib/bundler/alive/version.rb +1 -1
- data/lib/bundler/alive.rb +8 -3
- metadata +10 -6
- data/Gemfile.lock +0 -119
- data/lib/bundler/alive/client/gems_api.rb +0 -55
- data/lib/bundler/alive/gem_status_collection.rb +0 -49
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "faraday"
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
module Bundler
|
7
|
-
module Alive
|
8
|
-
module Client
|
9
|
-
#
|
10
|
-
# API Client for RubyGems.org API
|
11
|
-
#
|
12
|
-
# @see https://guides.rubygems.org/rubygems-org-api/
|
13
|
-
#
|
14
|
-
class GemsApi
|
15
|
-
#
|
16
|
-
# Not found in rubygems.org error
|
17
|
-
#
|
18
|
-
class NotFound < StandardError
|
19
|
-
end
|
20
|
-
|
21
|
-
#
|
22
|
-
# Returns repository url
|
23
|
-
#
|
24
|
-
# @param [String] gem_name
|
25
|
-
#
|
26
|
-
# @return [SourceCodeRepositoryUrl]
|
27
|
-
#
|
28
|
-
def get_repository_url(gem_name)
|
29
|
-
url = api_url(gem_name)
|
30
|
-
response = connection.get(url)
|
31
|
-
|
32
|
-
raise NotFound, "#{gem_name} is not found in gems.org." if response.status == 404
|
33
|
-
|
34
|
-
body = JSON.parse(response.body)
|
35
|
-
raw_url = body["source_code_uri"] || body["homepage_uri"]
|
36
|
-
SourceCodeRepositoryUrl.new(raw_url)
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def api_url(gem_name)
|
42
|
-
"https://rubygems.org/api/v1/gems/#{gem_name}.json"
|
43
|
-
end
|
44
|
-
|
45
|
-
def connection
|
46
|
-
return @connection if instance_variable_defined?(:@connection)
|
47
|
-
|
48
|
-
@connection = Faraday.new do |connection|
|
49
|
-
connection.adapter :net_http
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "forwardable"
|
4
|
-
|
5
|
-
module Bundler
|
6
|
-
module Alive
|
7
|
-
# Collection of GemStatus
|
8
|
-
class GemStatusCollection
|
9
|
-
extend Forwardable
|
10
|
-
delegate each: :gems
|
11
|
-
|
12
|
-
def initialize(gems = {})
|
13
|
-
@gems = gems
|
14
|
-
freeze
|
15
|
-
end
|
16
|
-
|
17
|
-
def add(name, gem_status)
|
18
|
-
gems[name] = gem_status
|
19
|
-
|
20
|
-
self.class.new(gems)
|
21
|
-
end
|
22
|
-
|
23
|
-
def get_unchecked(name)
|
24
|
-
return nil unless gems.key?(name)
|
25
|
-
|
26
|
-
gem_status = gems[name]
|
27
|
-
return nil if gem_status.unknown?
|
28
|
-
|
29
|
-
gem_status
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_h
|
33
|
-
hash = {}
|
34
|
-
gems.each do |k, v|
|
35
|
-
hash[k] = v.to_h
|
36
|
-
end
|
37
|
-
hash
|
38
|
-
end
|
39
|
-
|
40
|
-
def need_to_report_gems
|
41
|
-
gems.find_all { |_name, gem| !!!gem.alive }
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
attr_reader :gems
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|