bun 1.1.0 → 1.2.0
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/gemfile.lock +1 -1
- data/lib/bun/runner.rb +1 -0
- data/lib/bun/version.rb +1 -1
- data/lib/bun/version_fetcher.rb +9 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1b4b5d7a749db8a2b3ab21198d3c6976c43238396191f1ab1bc825bfff6176
|
4
|
+
data.tar.gz: 1580273ec6395600642231b0363ff8702c7bbf2793fb3ab5ca05d0b0074c1f85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fff2b557d0b84693aa4b687792828f2d942d3e7c1537cacc4d6137d663949d5613b80630a2be6e65d333628b9bc8c185e7d128e6f17d4ce4de70484a2940f69
|
7
|
+
data.tar.gz: 147c1eb63f8a4e55858ab6691c64d81e1faf7afac90f57491a0bbc6a1a90699b452b4c680922dae8daf403276684375b0905a9e0db2a6337dda2625ba2007419
|
data/gemfile.lock
CHANGED
data/lib/bun/runner.rb
CHANGED
data/lib/bun/version.rb
CHANGED
data/lib/bun/version_fetcher.rb
CHANGED
@@ -4,7 +4,7 @@ require "tty/spinner"
|
|
4
4
|
|
5
5
|
module Bun
|
6
6
|
class VersionFetcher
|
7
|
-
|
7
|
+
RUBYGEMS_GEM_URL = "https://rubygems.org/api/v1/gems"
|
8
8
|
|
9
9
|
def initialize(gem, arguments)
|
10
10
|
@gem = gem
|
@@ -15,16 +15,8 @@ module Bun
|
|
15
15
|
version = nil
|
16
16
|
|
17
17
|
with_optional_spinner do
|
18
|
-
|
19
|
-
|
20
|
-
latest_gem_attributes = json_response.
|
21
|
-
find {|attributes| attributes["name"] == gem }
|
22
|
-
|
23
|
-
unless latest_gem_attributes
|
24
|
-
raise ::Bun::Errors::GemNotFoundError.new("Aborting. Gem not found: #{gem}")
|
25
|
-
end
|
26
|
-
|
27
|
-
version = latest_gem_attributes["version"]
|
18
|
+
json_response = JSON.parse(fetch)
|
19
|
+
version = json_response["version"]
|
28
20
|
end
|
29
21
|
|
30
22
|
version
|
@@ -43,6 +35,12 @@ module Bun
|
|
43
35
|
|
44
36
|
private
|
45
37
|
|
38
|
+
def fetch
|
39
|
+
open("#{RUBYGEMS_GEM_URL}/#{gem}.json").read
|
40
|
+
rescue OpenURI::HTTPError
|
41
|
+
raise ::Bun::Errors::GemNotFoundError.new("Aborting. Gem not found: #{gem}")
|
42
|
+
end
|
43
|
+
|
46
44
|
attr :gem
|
47
45
|
attr :arguments
|
48
46
|
end
|