geminabox 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/lib/geminabox.rb +2 -0
- data/lib/geminabox/server.rb +6 -0
- data/lib/geminabox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c58b87ab694d0e78e224fd5faf56aa4b7676c88f2c10da711980765fbb8bd1bc
|
4
|
+
data.tar.gz: ca6355cf693daf3a94826f7e9ab29a9f73714077d78dac0c298352e280fbbaee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc317ab13ac74784a371820b55bb6625c3d2af1aa3b04a7efcedeb1484ef08c29daa690975079776add41b374a2bb9d9703dfb73ad6930ffdf539d53eee97d9
|
7
|
+
data.tar.gz: 90da6706ea509db2a15c4aafe267334120954e42a5d5c06a918c4bb5e4a9a5626257ccbeb6b39132efb89cb8a45363794854581b2646831e7906159dcf870170
|
data/README.md
CHANGED
@@ -92,6 +92,24 @@ local systems SSL certificates.
|
|
92
92
|
|
93
93
|
TemplateFaradayAdapter is provided as an example of an alternative HTTPAdapter.
|
94
94
|
|
95
|
+
## Hooks
|
96
|
+
|
97
|
+
You can add a hook (anything callable) which will be called when a gem is
|
98
|
+
successfully received.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
Geminabox.on_gem_received = Proc.new do |gem|
|
102
|
+
puts "Gem received: #{gem.spec.name} #{gem.spec.version}"
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
Typically you might use this to push a notification to your team chat. Any
|
107
|
+
exceptions which occur within the hook is silently ignored, so please ensure they
|
108
|
+
are handled properly if this is not desirable.
|
109
|
+
|
110
|
+
Also, please note that this hook blocks `POST /upload` and `POST /api/v1/gems` APIs processing.
|
111
|
+
Hook authors are responsible to perform any action non-blocking/async to avoid HTTP timeout.
|
112
|
+
|
95
113
|
## Client Usage
|
96
114
|
|
97
115
|
Since version 0.10, Geminabox supports the standard gemcutter push API:
|
data/lib/geminabox.rb
CHANGED
@@ -53,6 +53,7 @@ module Geminabox
|
|
53
53
|
:ruby_gems_url,
|
54
54
|
:bundler_ruby_gems_url,
|
55
55
|
:allow_upload,
|
56
|
+
:on_gem_received
|
56
57
|
)
|
57
58
|
|
58
59
|
def set_defaults(defaults)
|
@@ -88,6 +89,7 @@ module Geminabox
|
|
88
89
|
ruby_gems_url: 'https://rubygems.org/',
|
89
90
|
bundler_ruby_gems_url: 'https://bundler.rubygems.org/',
|
90
91
|
allow_upload: true,
|
92
|
+
on_gem_received: nil
|
91
93
|
)
|
92
94
|
|
93
95
|
end
|
data/lib/geminabox/server.rb
CHANGED
@@ -197,6 +197,12 @@ module Geminabox
|
|
197
197
|
error_response error.code, error.reason
|
198
198
|
end
|
199
199
|
|
200
|
+
begin
|
201
|
+
Geminabox.on_gem_received.call(gem) if Geminabox.on_gem_received
|
202
|
+
rescue
|
203
|
+
# ignore errors which occur within the hook
|
204
|
+
end
|
205
|
+
|
200
206
|
if api_request?
|
201
207
|
"Gem #{gem.name} received and indexed."
|
202
208
|
else
|
data/lib/geminabox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geminabox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lea
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-04-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: sinatra
|