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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 989dda9f55d23070e5c33746b9dc21d32e63e1a336bf3d82aa8ac935f7571385
4
- data.tar.gz: bd529519469468e0d51a74bccfe3509f7038fed8238c1431c344755ea380ba59
3
+ metadata.gz: c58b87ab694d0e78e224fd5faf56aa4b7676c88f2c10da711980765fbb8bd1bc
4
+ data.tar.gz: ca6355cf693daf3a94826f7e9ab29a9f73714077d78dac0c298352e280fbbaee
5
5
  SHA512:
6
- metadata.gz: 9ae826eedc94f20eabb4a8a581aab83a01f68708271c93fbdd4f405690bd61633ef5f523ce4d831ecfdcd79d0cb72feb37f2cce7a9b7fc421b78b0a84e7fef2b
7
- data.tar.gz: f3a64cbf0e89de75122d3de47cd22198ed2205ffdcfc05153adcab2bce114dc120782562c569edbba6759c66378de43070434f3ab5401c7a04b317978fb9abba
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:
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Geminabox
2
- VERSION = '1.0.1' unless defined? VERSION
2
+ VERSION = '1.1.0' unless defined? VERSION
3
3
  end
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.1
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-03-13 00:00:00.000000000 Z
14
+ date: 2018-04-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sinatra