thanks 0.3.2 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/thanks/registry.rb +46 -6
- data/lib/thanks/registry.yml +5 -0
- data/lib/thanks/version.rb +1 -1
- data/lib/thanks.rb +3 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2309a06ca3fa70810f93ce1a080ba00331c3e321
|
4
|
+
data.tar.gz: 3aced666c930246034c900dba2679f945e9a6dd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24bb10637e3b15cc1308eb2ba526d6b000abfc54e8790aae92e1c3b365147d361cf90029f4c43fc938626465761ec2b187a33613207a00ee63b918f22e45bc9e
|
7
|
+
data.tar.gz: 1077a77ab2c59194e4c1b6595e4ae19a45bdb1b822ab7688cf6490a6c52ec4f9a38413bd236b71f9cc3f4499c23333f9a0b5520a2622eb04d325f399bfcd01da
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Thanks
|
2
2
|
|
3
|
-
![download counter link at rubygems](https://img.shields.io/gem/dt/thanks.svg)
|
3
|
+
[![download counter link at rubygems](https://img.shields.io/gem/dt/thanks.svg)](https://rubygems.org/gems/thanks)
|
4
|
+
[![Build Status at Travis CI](https://travis-ci.org/dpritchett/thanks-ruby.svg?branch=master)](https://travis-ci.org/dpritchett/thanks-ruby)
|
4
5
|
|
5
6
|
Find out how to support the authors of the gems you depend on. Inspired by @feross's [thanks package for Node](https://github.com/feross/thanks).
|
6
7
|
|
@@ -8,7 +9,7 @@ Find out how to support the authors of the gems you depend on. Inspired by @fero
|
|
8
9
|
|
9
10
|
TODO:
|
10
11
|
|
11
|
-
- Add your donation
|
12
|
+
- Add your donation link to the registry
|
12
13
|
- Cleaner gem listing code?
|
13
14
|
|
14
15
|
Help wanted! This is free of course :)
|
data/lib/thanks/registry.rb
CHANGED
@@ -1,8 +1,48 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'net/http'
|
3
|
+
|
1
4
|
module Thanks
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# Loaders for the local registry and the online version
|
6
|
+
class Registry
|
7
|
+
def fetch
|
8
|
+
@remote_memoized ||= remote
|
9
|
+
rescue SocketError => err
|
10
|
+
STDERR.puts("Unable to contact GitHub: #{err}")
|
11
|
+
local
|
12
|
+
end
|
13
|
+
|
14
|
+
def local
|
15
|
+
@_local ||= YAML.load_file(File.join(__dir__, 'registry.yml'))
|
16
|
+
end
|
17
|
+
|
18
|
+
def remote
|
19
|
+
if response.code != '200'
|
20
|
+
STDERR.puts "Bad HTTP request: #{response.body}"
|
21
|
+
false
|
22
|
+
else
|
23
|
+
YAML.safe_load(response.body.to_s)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def request
|
30
|
+
Net::HTTP::Get.new(remote_uri)
|
31
|
+
end
|
32
|
+
|
33
|
+
def response
|
34
|
+
Net::HTTP.start(
|
35
|
+
remote_uri.hostname,
|
36
|
+
remote_uri.port,
|
37
|
+
use_ssl: true,
|
38
|
+
timeout: 2
|
39
|
+
) do |http|
|
40
|
+
http.request(request)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def remote_uri
|
45
|
+
URI('https://raw.githubusercontent.com/dpritchett/thanks-ruby/master/lib/thanks/registry.yml')
|
46
|
+
end
|
47
|
+
end
|
8
48
|
end
|
data/lib/thanks/version.rb
CHANGED
data/lib/thanks.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thanks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Pritchett
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- img/screencast.gif
|
89
89
|
- lib/thanks.rb
|
90
90
|
- lib/thanks/registry.rb
|
91
|
+
- lib/thanks/registry.yml
|
91
92
|
- lib/thanks/version.rb
|
92
93
|
- thanks.gemspec
|
93
94
|
homepage: https://github.com/dpritchett/thanks-ruby
|