circuitry-middleware 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b9d45fd5d5fbbb9c44fa397c0f2597aed4e3a915
4
+ data.tar.gz: 600f49ffdf7736ce580d25744d412b80bf083dbe
5
+ SHA512:
6
+ metadata.gz: 53b4d05fcb215e6b5ad2b450e328fb28a2905fddb0f40058501558196dc79dc86e7bfacd097a6bf2f947e03bc24b6f6b6068c0583d8ca004dcd3d68373ef1243
7
+ data.tar.gz: c09774c1fefdc9d332e2a0febb07f003d9311477c331e1fc1e87778dd7b440d73941ea082dcb81a2f2e9e2817e2fbfa769f496c379c02626301bc61e3b2c79c2
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.idea/
3
+ /.ruby-gemset
4
+ /.ruby-version
5
+ /.yardoc
6
+ /Gemfile.lock
7
+ /_yardoc/
8
+ /coverage/
9
+ /doc/
10
+ /pkg/
11
+ /spec/reports/
12
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in circuitry-middleware.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Kapost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # Circuitry::Middleware
2
+
3
+ Rails/Rack middleware for batching circuitry notifications.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'circuitry-middleware'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install circuitry-middleware
20
+
21
+ ## Usage
22
+
23
+ ### Ruby on Rails
24
+
25
+ If using this gem in the context of a Ruby on Rails application, there's nothing
26
+ more that you need to do beyond including the gem in your `Gemfile`.
27
+
28
+ If you do not have a `Gemfile` or you're explicitly setting `require: false`
29
+ within your `Gemfile`, then you'll need to require the gem within an
30
+ initializer:
31
+
32
+ ```ruby
33
+ require 'circuitry-middleware'
34
+ ```
35
+
36
+ ### Rack
37
+
38
+ If using this gem in the context of a Rack application, you'll need to explicitly
39
+ include the middleware as a part of your Rackup file (generally `config.ru`):
40
+
41
+ ```ruby
42
+ require 'circuitry-middleware'
43
+ use Circuitry::Middleware
44
+ ```
45
+
46
+ ## Development
47
+
48
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
49
+ `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To
52
+ release a new version, update the version number in `version.rb`, and then run
53
+ `bundle exec rake release` to create a git tag for the version, push git commits
54
+ and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ 1. Fork it ( https://github.com/kapost/circuitry-middleware/fork )
59
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
60
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
61
+ 4. Push to the branch (`git push origin my-new-feature`)
62
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "circuitry/middleware"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/circle.yml ADDED
@@ -0,0 +1,7 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.2.0
4
+
5
+ dependencies:
6
+ pre:
7
+ - gem install bundler -v 1.8.9
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'circuitry/middleware/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'circuitry-middleware'
8
+ spec.version = Circuitry::Middleware::VERSION
9
+ spec.authors = ['Matt Huggins']
10
+ spec.email = ['matt.huggins@kapost.com']
11
+
12
+ spec.summary = %q{Rails/Rack middleware for batching circuitry notifications.}
13
+ spec.description = %q{Batches and flushes circuitry SNS messages after a request finishes processing.}
14
+ spec.homepage = 'https://github.com/kapost/circuitry-middleware'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.add_dependency 'circuitry', '>= 1.1.0'
23
+
24
+ spec.add_development_dependency 'pry-nav'
25
+ spec.add_development_dependency 'bundler', '~> 1.8'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.2'
28
+ spec.add_development_dependency 'codeclimate-test-reporter'
29
+ end
@@ -0,0 +1,18 @@
1
+ require 'circuitry/middleware/version'
2
+ require 'circuitry/middleware/railtie' if defined?(Rails)
3
+ require 'circuitry'
4
+
5
+ module Circuitry
6
+ class Middleware
7
+ def initialize(app, options = {})
8
+ @app = app
9
+ Circuitry.config.publish_async_strategy = options.fetch(:publish_async_strategy, :batch)
10
+ Circuitry.config.subscribe_async_strategy = options.fetch(:subscribe_async_strategy, :thread)
11
+ end
12
+
13
+ def call(env)
14
+ @app.call(env)
15
+ Circuitry.flush
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ module Circuitry
2
+ class Middleware
3
+ class Railtie < ::Rails::Railtie
4
+ initializer 'circuitry.middleware' do |app|
5
+ app.middleware.use Middleware
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Circuitry
2
+ class Middleware
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: circuitry-middleware
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Huggins
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: circuitry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry-nav
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: codeclimate-test-reporter
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Batches and flushes circuitry SNS messages after a request finishes processing.
98
+ email:
99
+ - matt.huggins@kapost.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - bin/console
111
+ - bin/setup
112
+ - circle.yml
113
+ - circuitry-middleware.gemspec
114
+ - lib/circuitry/middleware.rb
115
+ - lib/circuitry/middleware/railtie.rb
116
+ - lib/circuitry/middleware/version.rb
117
+ homepage: https://github.com/kapost/circuitry-middleware
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.4.8
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Rails/Rack middleware for batching circuitry notifications.
141
+ test_files: []