subserver 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: ed0057cefa344204a08c579efd92a9f0df33aae3
4
- data.tar.gz: 1d76ebad4bcf2f65e7dda873a21a39c13cebcd6c
3
+ metadata.gz: 4a000b5012eabb4cb6dd63890ebcfd6c7fb114fd
4
+ data.tar.gz: ad5e305ef09bf8695711265cb5ef97b9b7e88ccb
5
5
  SHA512:
6
- metadata.gz: 07745b6c86ef5001384bf36fa6195f01ffa8c73676c4012936ae3d33a174eedad014336a3b94b2873b931eafec3b2fa56af4659234266f11a943a57799a72a77
7
- data.tar.gz: 8ca91c9f88a06a5ab50ba7290da4754bf6f98fbfdb7ce6798054f31e359f431673dc1006d5c07222c642907f88f2172ad32158d466d6c97444f59faaa88cc7c8
6
+ metadata.gz: 91bc0892c40cabfc4e45f18bc077c6c3d14febd0f16ee0ad971efd9122923881bb3a54c6067c3d480893802076977ca2a3bb3b5a567296bba685984249d26e2b
7
+ data.tar.gz: 1df78a378a6990db9597e49a55b7f4719597eae63d714f292552e13e14de5cbd10b8741b43b671144713f9b8c674aaaad193fac4dee82e556d00a4b6eff1341d
data/README.md CHANGED
@@ -1,5 +1,52 @@
1
1
  Subserver
2
2
  ==============
3
3
 
4
- <!-- [![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq) -->
4
+ [![Gem Version](https://badge.fury.io/rb/subserver.svg)](https://rubygems.org/gems/subserver)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7aa605d1010c949bfbe4/maintainability)](https://codeclimate.com/github/lifechurch/subserver/maintainability)
6
+ [![Build Status](https://travis-ci.com/lifechurch/subserver.svg?branch=master)](https://travis-ci.com/lifechurch/subserver)
5
7
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)
8
+
9
+ Subserver is a background server process for processing messages from Google Pub/Sub.
10
+
11
+ Subserver was designed to be an efficient, configurable process that easily integrates into any ruby app.
12
+ It is built as a wrapper around [Google's Pub/Sub gem](https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-pubsub) and
13
+ provides:
14
+ - Threaded multi-subscription support
15
+ - Message processing middleware.
16
+ - Auto subscriber loading.
17
+ - Per subscriber configuration.
18
+ - Error handling and logging.
19
+
20
+ Subserver is based off of [Sidekiq](https://github.com/mperham/sidekiq). A huge thanks to [@mperham](https://github.com/mperham) and the Sidekiq contributers for giving Subserver an incredible foundation to build off of.
21
+
22
+ ## Requirements
23
+ Subserver Supports:
24
+ - Ruby >= 2.3.1
25
+ - All Rails releases >= 4.0
26
+ - Google Cloud PubSub Ruby >= 0.31.0
27
+
28
+ ## Getting Started
29
+ ### Install
30
+ ```
31
+ gem install subserver
32
+ ```
33
+ Checkout the [Getting Started](https://github.com/lifechurch/subserver/wiki/Getting-Started) page in the wiki to follow the setup for Subserver.
34
+
35
+ ## Contributing
36
+
37
+ The main purpose of this repository is to continue to grow the Subserver gem, making it faster and easier to use and more robust. Development of Subserver happens in the open on GitHub, and we look forward to working with many talented developers on this project. Read below to learn how you can take part in improving Subserver.
38
+
39
+ ### Contributing Guide
40
+
41
+ Read our [contribution guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Subserver.
42
+
43
+ ### License
44
+
45
+ Subserver is [MIT licensed](./LICENSE).
46
+
47
+ ## Open Digerati
48
+
49
+ This project is part of the Open Digerati initiative at [Life.Church](https://life.church). It's our belief that we can move faster together and that starts with irrational generosity so we are opening up our code to the community.
50
+
51
+ To find more projects like this one, or join the initiative, checkout our website at [opendigerati.com](https://www.opendigerati.com/).
52
+
@@ -263,6 +263,26 @@ module Subserver
263
263
  die(1)
264
264
  end
265
265
 
266
+ # Test Pubsub Connection
267
+ if ENV['PUBSUB_EMULATOR_HOST']
268
+ uri = URI.parse("http://#{ENV['PUBSUB_EMULATOR_HOST']}")
269
+ http = Net::HTTP.new(uri.host, uri.port)
270
+ begin
271
+ response = http.request_get(uri)
272
+ rescue Errno::ECONNREFUSED
273
+ logger.error "Errno::ECONNREFUSED - Could not connect to Pubsub Emulator at connection: #{ENV['PUBSUB_EMULATOR_HOST']}."
274
+ logger.info "If you are not intending to connect to the Pubsub Emulator remove the PUBSUB_EMULATOR_HOST environment variable."
275
+ die(1)
276
+ end
277
+ else
278
+ begin
279
+ client = Subserver::Pubsub.client
280
+ rescue StandardError => e
281
+ logger.error "Pubsub Connection Error: #{e.message}"
282
+ die(1)
283
+ end
284
+ end
285
+
266
286
  raise ArgumentError, "#{timeout}: #{options[:timeout]} is not a valid value" if options.has_key?(:timeout) && options[:timeout].to_i <= 0
267
287
  end
268
288
 
@@ -9,7 +9,7 @@ module Subserver
9
9
  def self.initialize_client
10
10
  @client = Google::Cloud::Pubsub.new(
11
11
  project_id: options[:project_id],
12
- credentials: File.expand_path(options[:credentials])
12
+ credentials: ( File.expand_path(options[:credentials]) if options[:credentials] )
13
13
  )
14
14
  end
15
15
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Subserver
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Hill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-05 00:00:00.000000000 Z
11
+ date: 2018-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-pubsub