rack-logstasher 0.0.3 → 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: 2d5dadb9e4dfe9709a500d0d95c547473c085fde
4
+ data.tar.gz: 3bfee07e71c02dc05878c8824a258d86193302b9
5
+ SHA512:
6
+ metadata.gz: 0bdce96aa0baed8c87f6866d2587160830b6431809141d3f184560a3fd6ba8966fbe5309ae1606f9a3bf23a8b31118d9cfd6d33d3017b192839eebc664c3377f
7
+ data.tar.gz: 71dfb7ba5e1e77a33f2f379feef745d74c693736e292530ab1e5c477e4e5fb591b159cce7560e7d5c6ae75b4d6a42b80576ae971864cba22b5421db8b4d9a03f
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 1.9.3-p484
1
+ 2.3.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # 1.0.0
2
+
3
+ - Add support for Rack 2 (thanks @anicholson https://github.com/alphagov/rack-logstasher/issues/5)
4
+ - Drop support for Rack < 2
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  Add this to the middleware stack. e.g.
22
22
 
23
- use Rask::Logstasher::Logger, Logger.new("/path/to/logfile.json.log")
23
+ use Rack::Logstasher::Logger, Logger.new("/path/to/logfile.json.log")
24
24
 
25
25
  ## Contributing
26
26
 
data/jenkins.sh CHANGED
@@ -1,10 +1,58 @@
1
- #!/bin/bash -x
2
- set -e
1
+ #!/bin/bash
3
2
 
4
- rm -f Gemfile.lock
3
+ REPO_NAME=${REPO_NAME:-"alphagov/rack-logstasher"}
4
+ CONTEXT_MESSAGE=${CONTEXT_MESSAGE:-"default"}
5
+ GH_STATUS_GIT_COMMIT=${SCHEMA_GIT_COMMIT:-${GIT_COMMIT}}
6
+
7
+ function github_status {
8
+ REPO_NAME="$1"
9
+ STATUS="$2"
10
+ MESSAGE="$3"
11
+ gh-status "$REPO_NAME" "$GH_STATUS_GIT_COMMIT" "$STATUS" -d "Build #${BUILD_NUMBER} ${MESSAGE}" -u "$BUILD_URL" -c "$CONTEXT_MESSAGE" >/dev/null
12
+ }
13
+
14
+ function error_handler {
15
+ trap - ERR # disable error trap to avoid recursion
16
+ local parent_lineno="$1"
17
+ local message="$2"
18
+ local code="${3:-1}"
19
+ if [[ -n "$message" ]] ; then
20
+ echo "Error on or near line ${parent_lineno}: ${message}; exiting with status ${code}"
21
+ else
22
+ echo "Error on or near line ${parent_lineno}; exiting with status ${code}"
23
+ fi
24
+ github_status "$REPO_NAME" error "errored on Jenkins"
25
+ exit "${code}"
26
+ }
27
+
28
+ trap 'error_handler ${LINENO}' ERR
29
+ github_status "$REPO_NAME" pending "is running on Jenkins"
30
+
31
+ # Cleanup anything left from previous test runs
5
32
  git clean -fdx
6
33
 
7
- bundle install --path "${HOME}/bundles/${JOB_NAME}"
34
+ # Try to merge master into the current branch, and abort if it doesn't exit
35
+ # cleanly (ie there are conflicts). This will be a noop if the current branch
36
+ # is master.
37
+ git merge --no-commit origin/master || git merge --abort
38
+
39
+ # Bundle and run tests against multiple ruby versions
40
+ for version in 2.3 2.2; do
41
+ rm -f Gemfile.lock
42
+ export RBENV_VERSION=$version
43
+ echo "Running tests under ruby $version"
44
+ bundle install --path "${HOME}/bundles/${JOB_NAME}"
45
+
46
+ if ! bundle exec rake ${TEST_TASK:-"default"}; then
47
+ github_status "$REPO_NAME" failure "failed on Jenkins"
48
+ exit 1
49
+ fi
50
+ done
51
+ unset RBENV_VERSION
52
+
53
+ if [[ -n "$PUBLISH_GEM" ]]; then
54
+ bundle install --path "${HOME}/bundles/${JOB_NAME}"
55
+ bundle exec rake publish_gem --trace
56
+ fi
8
57
 
9
- bundle exec rake
10
- bundle exec rake publish_gem
58
+ github_status "$REPO_NAME" success "succeeded on Jenkins"
@@ -1,4 +1,4 @@
1
- require 'rack/commonlogger'
1
+ require 'rack/common_logger'
2
2
  require 'logstash/event'
3
3
 
4
4
  module Rack
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Logstasher
3
- VERSION = "0.0.3"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "rack"
21
+ spec.add_dependency "rack", "~> 2.0"
22
22
  spec.add_dependency "logstash-event"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
metadata CHANGED
@@ -1,84 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-logstasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alex Tomlins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '2.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: '2.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: logstash-event
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.3'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.3'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rack-test
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - '='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - '='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: gem_publisher
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - '='
124
109
  - !ruby/object:Gem::Version
@@ -131,9 +116,10 @@ executables: []
131
116
  extensions: []
132
117
  extra_rdoc_files: []
133
118
  files:
134
- - .gitignore
135
- - .rspec
136
- - .ruby-version
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".ruby-version"
122
+ - CHANGELOG.md
137
123
  - Gemfile
138
124
  - LICENSE.txt
139
125
  - README.md
@@ -149,33 +135,26 @@ files:
149
135
  homepage: https://github.com/alphagov/rack-logstasher
150
136
  licenses:
151
137
  - MIT
138
+ metadata: {}
152
139
  post_install_message:
153
140
  rdoc_options: []
154
141
  require_paths:
155
142
  - lib
156
143
  required_ruby_version: !ruby/object:Gem::Requirement
157
- none: false
158
144
  requirements:
159
- - - ! '>='
145
+ - - ">="
160
146
  - !ruby/object:Gem::Version
161
147
  version: '0'
162
- segments:
163
- - 0
164
- hash: -1970584439746248370
165
148
  required_rubygems_version: !ruby/object:Gem::Requirement
166
- none: false
167
149
  requirements:
168
- - - ! '>='
150
+ - - ">="
169
151
  - !ruby/object:Gem::Version
170
152
  version: '0'
171
- segments:
172
- - 0
173
- hash: -1970584439746248370
174
153
  requirements: []
175
154
  rubyforge_project:
176
- rubygems_version: 1.8.23
155
+ rubygems_version: 2.5.1
177
156
  signing_key:
178
- specification_version: 3
157
+ specification_version: 4
179
158
  summary: Rack middleware to log requests in logstash json event format
180
159
  test_files:
181
160
  - spec/logger_spec.rb