blast_wave 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4d25799a46b042613ae42a51abdf9102a39c9db97009576aaff8751493568ff2
4
+ data.tar.gz: e859be4b0e08e00604d8a23c3153d391767c702739b5294346af29295909975e
5
+ SHA512:
6
+ metadata.gz: 5d3f74d347b70ff678de4e934f7544190a56ecdd24ac635a83b3f4e8eb7ccb26baecd12c881a3a5a75e12777e6592df17ea3980ae4155401d44084a3c8ca34ca
7
+ data.tar.gz: 94889f99f1a3eaf5d6e533e6f14bfe5c0bfd23f7994c85bc7aad7ddc1d940c78c021e0f1ecc744adf55338301f4056530f608e935c621240d23aa2dccae9dc4f
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .rspec_status
11
+ .ruby-version
12
+ gemfiles/*.lock
13
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=progress
3
+ --require spec_helper
@@ -0,0 +1,15 @@
1
+ inherit_gem:
2
+ armitage-rubocop:
3
+ - lib/rubocop.general.yml
4
+ - lib/rubocop.rspec.yml
5
+
6
+ AllCops:
7
+ UseCache: true
8
+ TargetRubyVersion: 2.5.1
9
+ Include:
10
+ - bin/console
11
+ - lib/**/*.rb
12
+ - spec/**/*.rb
13
+ - Gemfile
14
+ - Rakefile
15
+ - blast_wave.gemspec
@@ -0,0 +1,20 @@
1
+ sudo: false
2
+ language: ruby
3
+ before_install: gem install bundler
4
+ cache: bundler
5
+ matrix:
6
+ fast_finish: true
7
+ include:
8
+ - rvm: 2.3.7
9
+ - rvm: 2.4.4
10
+ - rvm: 2.5.1
11
+ - rvm: ruby-head
12
+ - rvm: jruby-head
13
+ allow_failures:
14
+ - rvm: ruby-head
15
+ - rvm: jruby-head
16
+ script:
17
+ - bundle exec rspec
18
+ notifications:
19
+ slack:
20
+ secure: Q+ekBKUsaRXWKg1nEDdfFT7o8ol22IKhVEAmcQgQeL9s2qDafs/0FZvsPj/UYjNIeX7zqRe1jTQv/P+9rbDzOLtZSG3z5PG2iWrPpOdBzPeoxdTboqsFbC57gsCB6YjZwV6tw7xDC3AudJUZQjEtoZkhhf5R3D8aK+x/ujuaT2xG5sR1ZGcH2vIjP47GLdaLfyBMlg2FYxG3UlWOsb7nCSdwVi1Ez1GW7cWAYaE9lYRCiy/vL8rOzDwbDXEOdDGjTnKqW76c95c983tEBCA3NJt3P3n/azCapnANgdHROcAxy0/9JwJ2iFvaRm+7Fm8EtQvsvzOAf5GdUi5xQ9RrdVUzh8SeUh9o5U14XNOjPy1QgA0IlXJSLJrDbdTgnSBa35EWxkLv35PDboAzbAbSrMG3Xsk8vxzZLLoMP8EKqWXjjX7WxUTPCyGL0Pxrp3ZMIqhoPcI4qsDUQo3rQSp8ITO3rqGQYLsuRlN3lEKz697D6I6y6sd2drmKUe30N/A5vauf8JDUPs/4IDwzG5+qlN+E2O9pZQR+oSeKB70pjb2yIOyVlRbP3mJuHdnvwjwJzwBN/d8TZr4v0rXOGSyZq4eTah75xlzKpQcq1fZltco2vDM9gQHyj7iT6i/puXtfjCPheFGIM0N7/4j0dukYliUD8qmgTZWsoeuh1mC2PCQ=
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ ## Unreleased
5
+ ### Added
6
+ - `Rack::BlastWave::RequestId` - rack middleware that provides an unique id attribute
7
+ to the each rack request object and rack `#env` scope;
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at iamdaiver@icloud.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in blastwave.gemspec
8
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Rustam Ibragimov
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.
@@ -0,0 +1,3 @@
1
+ # BlastWave
2
+
3
+ In active development...
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'blast_wave'
6
+
7
+ require 'pry'
8
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'blast_wave/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'blast_wave'
9
+ spec.version = Rack::BlastWave::VERSION
10
+ spec.authors = ['Rustam Ibragimov']
11
+ spec.email = ['iamdaiver@icloud.com']
12
+ spec.summary = 'Soon'
13
+ spec.description = 'Soon'
14
+ spec.homepage = 'https://github.com/0exp/blast_wave'
15
+ spec.license = 'MIT'
16
+
17
+ spec.bindir = 'bin'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
23
+ end
24
+
25
+ spec.add_dependency 'rack'
26
+ spec.add_dependency 'qonfig'
27
+
28
+ spec.add_development_dependency 'coveralls', '~> 0.8'
29
+ spec.add_development_dependency 'simplecov', '~> 0.16'
30
+ spec.add_development_dependency 'armitage-rubocop', '~> 0.5'
31
+ spec.add_development_dependency 'rspec', '~> 3.8'
32
+ spec.add_development_dependency 'rack-test', '~> 1.1'
33
+
34
+ spec.add_development_dependency 'bundler'
35
+ spec.add_development_dependency 'rake'
36
+ spec.add_development_dependency 'pry'
37
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rack'
4
+ require 'rack/test'
5
+ require 'securerandom'
6
+ require 'qonfig'
7
+
8
+ module Rack
9
+ # @api public
10
+ # @since 0.0.0
11
+ module BlastWave
12
+ require_relative 'blast_wave/version'
13
+ require_relative 'blast_wave/middleware'
14
+ require_relative 'blast_wave/request_id'
15
+ require_relative 'blast_wave/request_id/extensions/request_interface'
16
+ require_relative 'blast_wave/request_id/initializer'
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ # @api public
5
+ # @since 0.1.0
6
+ class BlastWave::Middleware
7
+ # @return [Object]
8
+ #
9
+ # @api public
10
+ # @since 0.1.0
11
+ attr_reader :app
12
+
13
+ # @param app [Object]
14
+ # @return [void]
15
+ #
16
+ # @api public
17
+ # @since 0.1.0
18
+ def initialize(app)
19
+ @app = app
20
+ end
21
+
22
+ # @param env [Hash]
23
+ # @return [void]
24
+ #
25
+ # @api public
26
+ # @since 0.1.0
27
+ def call(env)
28
+ app.call(env)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ # @api public
5
+ # @since 0.1.0
6
+ class BlastWave::RequestId < BlastWave::Middleware
7
+ # @since 0.1.0
8
+ include Qonfig::Configurable
9
+
10
+ # @return [String]
11
+ #
12
+ # @api public
13
+ # @since 0.1.0
14
+ REQUEST_ID_ENV_KEY = 'rack.blastwave.request_id'
15
+
16
+ # @since 0.1.0
17
+ configuration { setting :id_randomizer, -> { SecureRandom.hex } }
18
+
19
+ # @param app [Object]
20
+ # @return [void]
21
+ #
22
+ # @api private
23
+ # @since 0.1.0
24
+ def initialize(app)
25
+ super
26
+ Initializer.call(app)
27
+ end
28
+
29
+ # @param env [Hash]
30
+ # @return [Object]
31
+ #
32
+ # @see Rack::BlastWave::Middleware
33
+ #
34
+ # @api private
35
+ # @since 0.1.0
36
+ def call(env)
37
+ append_request_id!(env)
38
+ super
39
+ end
40
+
41
+ private
42
+
43
+ # @return [String]
44
+ #
45
+ # @see generate_request_id
46
+ #
47
+ # @api private
48
+ # @since 0.1.0
49
+ def append_request_id!(env)
50
+ env[REQUEST_ID_ENV_KEY] = generate_request_id
51
+ end
52
+
53
+ # @return [String]
54
+ #
55
+ # @api private
56
+ # @since 0.1.0
57
+ def generate_request_id
58
+ self.class.config.settings.id_randomizer.call
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ class BlastWave::RequestId
5
+ module Extentions
6
+ # @api private
7
+ # @since 0.1.0
8
+ module RequestInterface
9
+ # @return [String]
10
+ #
11
+ # @api public
12
+ # @since 0.1.0
13
+ def request_id
14
+ env[BlastWave::RequestId::REQUEST_ID_ENV_KEY]
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ class BlastWave::RequestId
5
+ # @api private
6
+ # @since 0.1.0
7
+ module Initializer
8
+ # @return [Mutex]
9
+ #
10
+ # @api private
11
+ # @since 0.1.0
12
+ INITIALIZATION_LOCK = Mutex.new
13
+
14
+ class << self
15
+ # @param app [Object]
16
+ # @return [void]
17
+ #
18
+ # @see extend_request_interface!
19
+ #
20
+ # @api private
21
+ # @since 0.1.0
22
+ def call(app)
23
+ extend_request_interface!
24
+ end
25
+
26
+ private
27
+
28
+ # @return [void]
29
+ #
30
+ # @see Rack::BlastWave::RequestId::Extensions::RequestInterface
31
+ #
32
+ # @api private
33
+ # @since 0.1.0
34
+ def extend_request_interface!
35
+ INITIALIZATION_LOCK.synchronize do
36
+ unless Rack::Request.include?(BlastWave::RequestId::Extentions::RequestInterface)
37
+ Rack::Request.prepend(BlastWave::RequestId::Extentions::RequestInterface)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rack
4
+ module BlastWave
5
+ # @return [String]
6
+ #
7
+ # @api public
8
+ # @since 0.0.0
9
+ VERSION = '0.0.0'
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blast_wave
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Rustam Ibragimov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: qonfig
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: armitage-rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rack-test
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: bundler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Soon
154
+ email:
155
+ - iamdaiver@icloud.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - CHANGELOG.md
165
+ - CODE_OF_CONDUCT.md
166
+ - Gemfile
167
+ - LICENSE.txt
168
+ - README.md
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - blast_wave.gemspec
173
+ - lib/blast_wave.rb
174
+ - lib/blast_wave/middleware.rb
175
+ - lib/blast_wave/request_id.rb
176
+ - lib/blast_wave/request_id/extensions/request_interface.rb
177
+ - lib/blast_wave/request_id/initializer.rb
178
+ - lib/blast_wave/version.rb
179
+ homepage: https://github.com/0exp/blast_wave
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubyforge_project:
199
+ rubygems_version: 2.7.6
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: Soon
203
+ test_files: []