closing_comments 0.1.1 → 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
- metadata +1 -2
- data/ensure_version.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bef0056b13f3db85e99df174cf592eff2a14f70
|
4
|
+
data.tar.gz: 8ad3a77527b75209b25ff28c18a8c4c71b1bd0fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ef0a5b662196d1bc87ddc9917240a7c7ad261c237f4483800c07f39988afc40c1839c631e8d4d32021d132764dcaa4b9b00c2f1841544f599d1fab3cce79d7b
|
7
|
+
data.tar.gz: 4fcc67ad98d899810f0573d1a90f9372608536e6735b79eb70e028fcf5c53ab607dc63ce49f8b723a0b7502e237aed7548bdec24acc6ce6b06d139ed19018910
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closing_comments
|
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
|
- Marcin Wyszynski
|
@@ -86,7 +86,6 @@ extensions: []
|
|
86
86
|
extra_rdoc_files: []
|
87
87
|
files:
|
88
88
|
- bin/closing_comments
|
89
|
-
- ensure_version.rb
|
90
89
|
- lib/closing_comments.rb
|
91
90
|
- lib/closing_comments/commentable.rb
|
92
91
|
- lib/closing_comments/processor.rb
|
data/ensure_version.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'net/http'
|
3
|
-
require 'singleton'
|
4
|
-
|
5
|
-
require 'colorize'
|
6
|
-
|
7
|
-
class EnsureVersion
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
def call
|
11
|
-
if compare
|
12
|
-
puts "#{'[OK]'.green} Local version (#{local_version}) higher than " \
|
13
|
-
"remote (#{remote_version})."
|
14
|
-
Kernel.exit(0)
|
15
|
-
end
|
16
|
-
puts "#{'[FAIL]'.red} Local version (#{local_version}) not higher than " \
|
17
|
-
"remote (#{remote_version}), please bump."
|
18
|
-
Kernel.exit(1)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def compare
|
24
|
-
local_version > remote_version
|
25
|
-
end
|
26
|
-
|
27
|
-
def local_version
|
28
|
-
Gem.loaded_specs[name].version
|
29
|
-
end
|
30
|
-
|
31
|
-
def remote_version
|
32
|
-
@remote_version ||= begin
|
33
|
-
version = JSON.parse(rubygems_response.body).fetch('version')
|
34
|
-
Gem::Version.new(version == 'unknown' ? 0 : version)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# This method reeks of :reek:FeatureEnvy (url).
|
39
|
-
def rubygems_response
|
40
|
-
url = URI.parse("https://rubygems.org/api/v1/versions/#{name}/latest.json")
|
41
|
-
req = Net::HTTP::Get.new(url.to_s)
|
42
|
-
Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
|
43
|
-
http.request(req)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def name
|
48
|
-
'closing_comments'
|
49
|
-
end
|
50
|
-
end # class EnsureVersion
|
51
|
-
|
52
|
-
EnsureVersion.instance.call if __FILE__ == $PROGRAM_NAME
|