rails_server_timings 1.0.0 → 1.0.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: c371d112a0e9ec4cedd13ad49092943a9547a23b
4
- data.tar.gz: 5c6ac8e59d859be6f3f21aa9c0a5848415c8907b
3
+ metadata.gz: 5913482ecd3901806522437a90777f68c08b7047
4
+ data.tar.gz: cfbb869fc27d3e1122fd4904d238ecb570041f25
5
5
  SHA512:
6
- metadata.gz: 92d8c30669f108e75ad856f08c636dd2b7a67105b15c583399be2eb78dd3f266f68e62a99c308380107f8e329958f92ca28e85e712a21c3874675fd700c479f4
7
- data.tar.gz: eed3bade55c62b5866a34f56104fbbb0952104df8a72d4b4aef915b1731443704c1a67c9541bcc68f5169848964d9f6b6f0d69a72fc37b051a223f0f103550c6
6
+ metadata.gz: 495ae69d7e2ae236a2648c439627a803666d54c9af52aa5cd873c3d28f43add54c58a1e61690917de7216f11fe9d0a19a9071443e18c9ea579bda3f427990f84
7
+ data.tar.gz: b1cab32b50fe92f9cb222af56c9caa9201a7232226c07c0395affc5a364887d616b8d118bbabb6700d2af0a12c8548d7b4aafca5e88aeec737ce38b1b708781c
data/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ end_of_line = lf
5
+ indent_style = space
6
+ insert_final_newline = true
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ indent_size = 2
data/.gitignore ADDED
@@ -0,0 +1,30 @@
1
+ *.DS_Store
2
+ *.swp
3
+ *~
4
+ .#*
5
+
6
+ *.gem
7
+ *.rbc
8
+ /.config
9
+ /coverage/
10
+ /InstalledFiles
11
+ /pkg/
12
+ /spec/reports/
13
+ /spec/examples.txt
14
+ /test/tmp/
15
+ /test/version_tmp/
16
+ /tmp/
17
+
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ /.bundle/
24
+ /vendor/bundle
25
+ /lib/bundler/man/
26
+
27
+ Gemfile.lock
28
+ .ruby-version
29
+ .ruby-gemset
30
+ .rvmrc
@@ -0,0 +1,75 @@
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,
8
+ body size, disability, ethnicity, gender identity and expression, level of
9
+ experience, nationality, personal appearance, race, religion, or sexual
10
+ identity and 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
52
+ appointed representative at an online or offline event. Representation of a
53
+ project may be 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 darryl@dpogue.ca. All complaints
59
+ will be reviewed and investigated and will result in a response that is deemed
60
+ necessary and appropriate to the circumstances. The project team is obligated
61
+ 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],
71
+ version 1.4, available at
72
+ [http://contributor-covenant.org/version/1/4][version]
73
+
74
+ [homepage]: http://contributor-covenant.org
75
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in curler.gemspec
4
+ gemspec
data/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Darryl Pogue
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ rails_server_timings
2
+ ====================
3
+
4
+ Rails support for returning [Server Timing](http://wicg.github.io/server-timing/) headers on requests providing instrumentation information to in-browser developer tools.
5
+
6
+
7
+ Download
8
+ --------
9
+
10
+ * Github: https://github.com/dpogue/rails_server_timings
11
+
12
+ * Gem:
13
+
14
+ $ gem install rails_server_timings
15
+
16
+
17
+ Configuration
18
+ -------------
19
+
20
+ Add `rails_server_timings` to your Gemfile:
21
+
22
+ ```ruby
23
+ gem 'rails_server_timings'
24
+ ```
25
+
26
+ By default, Rails will now include the `Server-Timing` response header on every controller response.
27
+
28
+ To disable, set `config.server_timings.enabled` to false in your application configuration.
29
+
30
+
31
+ Contributing
32
+ ------------
33
+
34
+ Contributions of bug reports, feature requests, and pull requests are greatly appreciated!
35
+
36
+ Please note that this project is released with a [Contributor Code of Conduct](https://github.com/dpogue/rails_server_timings/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
37
+
38
+
39
+ Licence
40
+ -------
41
+
42
+ Copyright © 2017 Darryl Pogue
43
+ Licensed under the MIT Licence.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ require 'rails_server_timings/version'
2
+ require 'rails_server_timings/railtie'
3
+
4
+ module RailsServerTimings
5
+ end
@@ -0,0 +1,26 @@
1
+ module RailsServerTimings
2
+ module ControllerRuntime
3
+ def process_action(*args)
4
+ callback = lambda do |*_|
5
+ event = ActiveSupport::Notifications::Event.new(*_)
6
+ payload = event.payload
7
+ timings = []
8
+
9
+ payload.each do |key, value|
10
+ if idx = key.to_s =~ /_runtime/
11
+ timings << ("#{key[0, idx]}=%.1f" % value.to_f)
12
+ end
13
+ end
14
+
15
+ timings << ("total=%.1f" % event.duration.to_f)
16
+
17
+ response.headers['Server-Timing'] = timings.join(', ')
18
+ end
19
+
20
+
21
+ ActiveSupport::Notifications.subscribed(callback, 'process_action.action_controller') do
22
+ super
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails'
2
+ require 'rails_server_timings/controller_runtime'
3
+
4
+ module RailsServerTimings
5
+ class Railtie < Rails::Railtie
6
+ config.server_timings = ActiveSupport::OrderedOptions.new
7
+ config.server_timings.enabled = true
8
+
9
+ initializer 'server_timings.subscribe' do |app|
10
+ if app.config.server_timings.enabled
11
+ ActiveSupport.on_load(:action_controller) do
12
+ include RailsServerTimings::ControllerRuntime
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+
2
+ module RailsServerTimings
3
+ VERSION = "1.0.1".freeze
4
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+ require File.expand_path('../lib/rails_server_timings/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'rails_server_timings'
6
+ s.version = RailsServerTimings::VERSION
7
+ s.authors = ['Darryl Pogue']
8
+ s.email = 'darryl@dpogue.ca'
9
+ s.homepage = 'https://github.com/dpogue/rails_server_timings'
10
+ s.license = 'MIT'
11
+
12
+ s.summary = 'Server Timing headers for Rails apps'
13
+
14
+ s.files = [
15
+ '.editorconfig',
16
+ '.gitignore',
17
+ 'CODE_OF_CONDUCT.md',
18
+ 'Gemfile',
19
+ 'LICENCE',
20
+ 'README.md',
21
+ 'Rakefile',
22
+ 'lib/rails_server_timings.rb',
23
+ 'lib/rails_server_timings/controller_runtime.rb',
24
+ 'lib/rails_server_timings/railtie.rb',
25
+ 'lib/rails_server_timings/version.rb',
26
+ 'rails_server_timings.gemspec'
27
+ ]
28
+ s.executables = []
29
+ s.require_paths = ['lib']
30
+
31
+ s.add_runtime_dependency('railties', '>= 3.0.0')
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_server_timings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darryl Pogue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-19 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -29,7 +29,19 @@ email: darryl@dpogue.ca
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
- files: []
32
+ files:
33
+ - ".editorconfig"
34
+ - ".gitignore"
35
+ - CODE_OF_CONDUCT.md
36
+ - Gemfile
37
+ - LICENCE
38
+ - README.md
39
+ - Rakefile
40
+ - lib/rails_server_timings.rb
41
+ - lib/rails_server_timings/controller_runtime.rb
42
+ - lib/rails_server_timings/railtie.rb
43
+ - lib/rails_server_timings/version.rb
44
+ - rails_server_timings.gemspec
33
45
  homepage: https://github.com/dpogue/rails_server_timings
34
46
  licenses:
35
47
  - MIT
@@ -50,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
62
  version: '0'
51
63
  requirements: []
52
64
  rubyforge_project:
53
- rubygems_version: 2.6.10
65
+ rubygems_version: 2.6.8
54
66
  signing_key:
55
67
  specification_version: 4
56
68
  summary: Server Timing headers for Rails apps