rack-log 1.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
+ SHA1:
3
+ metadata.gz: ebeb77cb9b198aeb0c499217b7a0e2ec4d0e1ec9
4
+ data.tar.gz: 0f4a9ffb9985018a049bda7fa3a182943e6cad65
5
+ SHA512:
6
+ metadata.gz: 3ee2abfb9afba4fafb6db41ff72590990d58f3cbe36d31412c9ef3d03de354e7b510d02dff63eae325e3d3344e6889c40fbd378d504e84e0732fa76a0b24f827
7
+ data.tar.gz: be79b92550d0899ee3c5ec6c4dc03f5dcc67314d4c47888d49973ea2054470b17c75ad8d73ed8f004b48749733fa7dd30fa7984773a3c8d564e3e8526452aa79
@@ -0,0 +1,3 @@
1
+ module Rack
2
+ require_relative "rack/log"
3
+ end
@@ -0,0 +1,37 @@
1
+ module Rack
2
+ class Log
3
+ require_relative "log/version"
4
+ RACK_KEY = "rack.logger"
5
+
6
+ def initialize(stack, logger)
7
+ @stack = stack
8
+ @logger = logger
9
+ end
10
+
11
+ def call(previous_state)
12
+ @state = previous_state
13
+ state[RACK_KEY] = @logger
14
+ stack.call(state)
15
+ end
16
+
17
+ private def stack
18
+ @stack
19
+ end
20
+
21
+ private def state
22
+ @state
23
+ end
24
+
25
+ private def headers
26
+ @headers
27
+ end
28
+
29
+ private def status
30
+ @status
31
+ end
32
+
33
+ private def body
34
+ @body
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ class Log
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "spec_helper"
2
+
3
+ describe Rack::Log::VERSION do
4
+ it "should be a string" do
5
+ expect(Rack::Log::VERSION).to be_kind_of(String)
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe Rack::Log do
4
+ let(:application) { instance_double("Application") }
5
+ let(:middleware) { described_class.new(application) }
6
+ let(:verb) { "GET" }
7
+ let(:status) { 200 }
8
+ let(:headers) do
9
+ {
10
+ "REQUEST_METHOD" => verb,
11
+ "Content-Type" => "text/plain",
12
+ "Content-Length" => "0"
13
+ }
14
+ end
15
+ let(:body) { "" }
16
+
17
+ before(:each) do
18
+ allow(application).to receive(:call).and_return([status, headers, body])
19
+ end
20
+
21
+ describe "#call" do
22
+
23
+ end
24
+ end
@@ -0,0 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
4
+ require "pry"
5
+ require "rspec"
6
+ require "rack/log"
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-log
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kurtis Rainbolt-Greene
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-doc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.6'
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.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.4'
97
+ description: Gives a global scope logger for rack middleware
98
+ email:
99
+ - me@kurtisrainboltgreene.name
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - lib/rack-log.rb
105
+ - lib/rack/log.rb
106
+ - lib/rack/log/version.rb
107
+ - spec/lib/rack/log/version_spec.rb
108
+ - spec/lib/rack/log_spec.rb
109
+ - spec/spec_helper.rb
110
+ homepage: http://krainboltgreene.github.io/rack-log
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.2.2
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Gives a global scope logger for rack middleware
134
+ test_files:
135
+ - spec/lib/rack/log/version_spec.rb
136
+ - spec/lib/rack/log_spec.rb
137
+ - spec/spec_helper.rb
138
+ has_rdoc: