latest_ruby_version_is 0.1.0 → 0.1.2
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/latest_ruby_version_is.rb +9 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1c33ce5ed2d9ac17fdfa5e5280f6426d57fcd161dd6e5ea83dcfb460d208929
|
4
|
+
data.tar.gz: 2cbc1db84057200b7b2e483329ba7aa4f812ee9d8ade220b93aaee1b39681c86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecb798603e247ce231c75f009dfb31fe2cc5797a73e232f5bc8605286cc6548097739dc4df11ddffa01af856c0701ebe4d2bda9809f9b941ce06eb9b847866b4
|
7
|
+
data.tar.gz: 4f14fa7522f8efe32989550180c496d0bd1bb3ad288aad222df1ca805934db4aeb2e8e63cade690955f07f839c39b878e0fc62c6ea4ee96ae73a875a5c5c76e1
|
data/latest_ruby_version_is.rb
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require 'json'
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
LATEST_HARDCODED_RUBY_VERSION = '2.7.1'.freeze
|
5
|
+
|
6
|
+
def latest_ruby_version_is( src = :remote , fallback = true )
|
5
7
|
case src
|
6
|
-
when :local then
|
8
|
+
when :local then LATEST_HARDCODED_RUBY_VERSION
|
7
9
|
when :remote
|
8
10
|
begin
|
9
|
-
|
11
|
+
JSON.parse(
|
12
|
+
Net::HTTP.get( URI 'https://api.github.com/repos/ruby/ruby/tags?per_page=1')
|
13
|
+
).first['name'][1..-1].gsub('_','.')
|
10
14
|
rescue
|
11
|
-
fallback ?
|
15
|
+
fallback ? LATEST_HARDCODED_RUBY_VERSION : raise
|
12
16
|
end
|
13
17
|
else
|
14
18
|
raise ArgumentError.new( 'src must be :local or :remote.' )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: latest_ruby_version_is
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- deemytch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: aspamkiller@yandex.ru
|
@@ -39,5 +39,5 @@ requirements: []
|
|
39
39
|
rubygems_version: 3.1.2
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
|
-
summary:
|
42
|
+
summary: Determine which is the last ruby version.
|
43
43
|
test_files: []
|