sha_header 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZDJmZjAxOWRlYjNiNDhmODg4NGM4YjlhZjFlMzczZDJmOWY5ZjcyMA==
5
- data.tar.gz: !binary |-
6
- YzIzYzllMjU1NTAzZDE5MjgxNGY4NDJiN2Y1ZTFkM2I5MjAxZmQ5MA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- YmI5ZWZjYWMzMDY2M2Y3MjgzMmQyMmVkOThkYmUyNTM3N2VkNWVlN2I0YWU5
10
- ZDBiMzljN2U2NGU4ZDRhYTIwYThiYjg3MDA4MTlmMWYwYzQ3MjgwOGJmODQ5
11
- ZDdjZGZmYmEzNmNmMGYyNDU1OWY2OWM0MDQ1OTI5NzdmZjRhMWU=
12
- data.tar.gz: !binary |-
13
- Yjc3MjMxYzJlM2EyOWZlY2ViOTgyOThiMzdhYmNjNzNkZjM5Y2MyY2YwOTI3
14
- YTMyMDZlNDc5NzUzYjJjMjg2ZjQxZDM1MDQ0MTJlODg0Njc3ZjBiYTg1Y2Ni
15
- NTkyMWVjYTZlNTAyNmY1YTdiNDk5MDMxZTBhMGU0NjIzN2NhNTU=
2
+ SHA1:
3
+ metadata.gz: 927abaa366daf63661393c31de23b001af89ec1d
4
+ data.tar.gz: 04fb06c7765cda54e5cf6f3c29b953d21863e474
5
+ SHA512:
6
+ metadata.gz: 6480cbf93718a16469b4f4c9fb161f71e70dadd0eaac798240cbd6c64ccc213ec1feaa70d718f73143b7ae3f9fac1c6917cd7a00d98f03a7bc329e595f85df6b
7
+ data.tar.gz: 60d5bd323acb6a972ddf00fcf24d73433a1e62a8f526173d908ab3dab77429ff8681e5b257b3c66751859bca73bfeb4f1c38c951793e150bac5274f29df54cf5
data/.gitignore CHANGED
@@ -1,8 +1,12 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /gemfiles/*.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
5
11
 
6
- .rvmrc
7
- .ruby-version
8
- .ruby-gemset
12
+ /.ruby-version
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
+ --format documentation
1
2
  --color
2
- --format progress
@@ -1,8 +1,29 @@
1
+ before_install: gem install bundler -v 1.13.7
2
+ cache: bundler
3
+ gemfile:
4
+ - gemfiles/railties_3.2.gemfile
5
+ - gemfiles/railties_4.x.gemfile
6
+ - gemfiles/railties_5.x.gemfile
1
7
  language: ruby
8
+ matrix:
9
+ allow_failures:
10
+ # json 1.8.3 fails to build under 2.4.0
11
+ - rvm: 2.4.0
12
+ gemfile: gemfiles/railties_3.2.gemfile
13
+ - rvm: 2.4.0
14
+ gemfile: gemfiles/railties_4.x.gemfile
15
+ exclude:
16
+ # rails 5 requires Ruby 2.2.2+
17
+ - rvm: 2.1.10
18
+ gemfile: gemfiles/railties_5.x.gemfile
19
+ fast_finish: true
2
20
  rvm:
3
- - 1.9.3
4
- - 2.0.0
21
+ - 2.1.10
22
+ - 2.2.6
23
+ - 2.3.3
24
+ - 2.4.0
5
25
  notifications:
6
26
  email:
7
- on_success: change
8
27
  on_failure: always
28
+ on_success: change
29
+ sudo: false
@@ -0,0 +1,11 @@
1
+ appraise "railties-3.2" do
2
+ gem "railties", "~> 3.2"
3
+ end
4
+
5
+ appraise "railties-4.x" do
6
+ gem "railties", "~> 4.0"
7
+ end
8
+
9
+ appraise "railties-5.x" do
10
+ gem "railties", "~> 5.0"
11
+ end
@@ -1,18 +1,26 @@
1
1
  # sha_header changelog
2
2
 
3
- ## [HEAD][head] / unreleased
3
+ [![Gem Version](http://img.shields.io/gem/v/sha_header.svg?style=flat)](http://rubygems.org/gems/sha_header)
4
+ [![Build Status](http://img.shields.io/travis/nbibler/sha_header/master.svg?style=flat)](https://travis-ci.org/nbibler/sha_header)
5
+
6
+ ## [HEAD][] / unreleased
4
7
 
5
8
  * No significant changes.
6
9
 
7
- ## [v1.0.0][v1.0.0] / 2013-04-27
10
+ ## [v1.1.0][] / 2017-01-08
11
+
12
+ * Widen supported Rails version to include 3.2 to 5.0.
13
+
14
+ ## [v1.0.0][] / 2013-04-27
8
15
 
9
16
  * Version 1.0 release after ~2 years of stability.
10
17
 
11
- [v0.0.4][v0.0.4], [v0.0.3][v0.0.3], [v0.0.2][v0.0.2], [v0.0.1][v0.0.1]
18
+ [v0.0.4][], [v0.0.3][], [v0.0.2][], [v0.0.1][]
12
19
 
13
- [head]: https://github.com/nbibler/sha_header/compare/v1.0.0...master
14
- [v1.0.0]: https://github.com/nbibler/sha_header/compare/v0.0.4...v1.0.0
15
- [v0.0.4]: https://github.com/nbibler/sha_header/compare/v0.0.3...v0.0.4
16
- [v0.0.3]: https://github.com/nbibler/sha_header/compare/v0.0.2...v0.0.3
17
- [v0.0.2]: https://github.com/nbibler/sha_header/compare/v0.0.1...v0.0.2
18
20
  [v0.0.1]: https://github.com/nbibler/sha_header/compare/8ae9dffa5425bfeaa42eb1a0c6362558690ae3dc...v0.0.1
21
+ [v0.0.2]: https://github.com/nbibler/sha_header/compare/v0.0.1...v0.0.2
22
+ [v0.0.3]: https://github.com/nbibler/sha_header/compare/v0.0.2...v0.0.3
23
+ [v0.0.4]: https://github.com/nbibler/sha_header/compare/v0.0.3...v0.0.4
24
+ [v1.0.0]: https://github.com/nbibler/sha_header/compare/v0.0.4...v1.0.0
25
+ [v1.1.0]: https://github.com/nbibler/sha_header/compare/v1.0.0...v1.1.0
26
+ [HEAD]: https://github.com/nbibler/sha_header/compare/v1.1.0...master
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in sha_header.gemspec
4
4
  gemspec
@@ -1,22 +1,21 @@
1
- Copyright (c) 2012 Nathaniel Bibler.
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2012 Nathaniel Bibler
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
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:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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 CHANGED
@@ -1,7 +1,15 @@
1
- [![Build Status](https://travis-ci.org/nbibler/sha_header.png?branch=master)](https://travis-ci.org/nbibler/sha_header)
1
+ :construction: This library has been replaced by [Rapporteur][]. :construction:
2
+
3
+ Rapporteur provides similar functionality, although rather than injecting the
4
+ revision information into every request as sha_header does, it provides a
5
+ status endpoint where you can provide multiple server data points (Git
6
+ revision, system time, uptime, whatever).
2
7
 
3
8
  # SHAHeader
4
9
 
10
+ [![Gem Version](http://img.shields.io/gem/v/sha_header.svg?style=flat)](http://rubygems.org/gems/sha_header)
11
+ [![Build Status](http://img.shields.io/travis/nbibler/sha_header/master.svg?style=flat)](https://travis-ci.org/nbibler/sha_header)
12
+
5
13
  SHAHeader is a simple Rack middleware gem for Rails 3. When required, it
6
14
  will instruct Rails to automatically insert its middleware into the Rack
7
15
  stack and inject your current git SHA hash into all of your dynamic
@@ -9,14 +17,16 @@ response headers.
9
17
 
10
18
  ## Compatibility
11
19
 
12
- The SHAHeader gem is both Ruby 1.8.7 and 1.9.2 compatible. Currently,
13
- it is compatible with Rails 3.x.
20
+ The SHAHeader gem is compatible with:
21
+
22
+ * Ruby 2.1 through 2.4, and
23
+ * Rails 3.2 through 5.0.
14
24
 
15
25
  ## Installation
16
26
 
17
- In Rails 3, modify your `Gemfile` to add the following line:
27
+ In Rails, modify your `Gemfile` to add the following line:
18
28
 
19
- gem 'sha_header'
29
+ gem 'sha_header', '~> 1.0'
20
30
 
21
31
  That's it. It is distributed with a `Railtie` to instruct Rails on how
22
32
  to set it up, so no other coding is required.
@@ -41,3 +51,5 @@ And, the following response is received:
41
51
  Connection: Keep-Alive
42
52
 
43
53
  (Notice the `X-Git-SHA` header)
54
+
55
+ [Rapporteur]: https://rubygems.org/gems/rapporteur
data/Rakefile CHANGED
@@ -1,12 +1,6 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
3
 
4
- require 'rake'
5
- require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
6
5
 
7
6
  task :default => :spec
8
-
9
- desc "Run all examples"
10
- RSpec::Core::RakeTask.new('spec') do |t|
11
- t.pattern = 'spec/**/*_spec.rb'
12
- end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sha_header"
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
@@ -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,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "railties", "~> 3.2"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "railties", "~> 4.0"
6
+
7
+ gemspec :path => "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "railties", "~> 5.0"
6
+
7
+ gemspec :path => "../"
@@ -1,3 +1,3 @@
1
1
  module SHAHeader
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0".freeze
3
3
  end
@@ -1,25 +1,31 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
4
  require 'sha_header/version'
4
5
 
5
- Gem::Specification.new do |s|
6
- s.name = 'sha_header'
7
- s.version = SHAHeader::VERSION
8
- s.license = 'MIT'
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ['Nathaniel Bibler']
11
- s.email = ['gem@nathanielbibler.com']
12
- s.homepage = 'https://github.com/nbibler/sha_header'
13
- s.summary = %q{Add a header to the response of your Rails 3 application containing the current commit SHA.}
14
- s.description = %q{This library adds a new, custom X-Git-SHA header to your Rails 3 application's response which contains the SHA hash that your application is currently running.}
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sha_header"
8
+ spec.version = SHAHeader::VERSION
9
+ spec.authors = ["Nathaniel Bibler"]
10
+ spec.email = ["gem@nathanielbibler.com"]
15
11
 
16
- s.add_dependency 'railties', '~>3.0'
12
+ spec.summary = %q{Add a header to the response of your Rails application containing the current commit SHA.}
13
+ spec.description = %q{This library adds a new, custom X-Git-SHA header to your Rails application's response which contains the SHA hash that your application is currently running.}
14
+ spec.homepage = "https://github.com/nbibler/sha_header"
15
+ spec.license = "MIT"
17
16
 
18
- s.add_development_dependency 'rspec', '~>2.5'
19
- s.add_development_dependency 'fakefs', '~>0.4'
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
20
23
 
21
- s.files = `git ls-files`.split("\n")
22
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
- s.require_paths = ['lib']
24
+ spec.add_dependency 'railties', '>= 3.2', '< 5.1'
25
+
26
+ spec.add_development_dependency "appraisal", "~> 2.0"
27
+ spec.add_development_dependency "bundler", "~> 1.13"
28
+ spec.add_development_dependency 'fakefs', '~>0.4', '>= 0.4.3'
29
+ spec.add_development_dependency "rake", "~> 12.0"
30
+ spec.add_development_dependency "rspec", "~> 3.0"
25
31
  end
metadata CHANGED
@@ -1,58 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sha_header
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathaniel Bibler
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2013-04-27 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '3.0'
29
+ version: '3.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.1'
27
33
  - !ruby/object:Gem::Dependency
28
- name: rspec
34
+ name: appraisal
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ~>
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '2.5'
39
+ version: '2.0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ~>
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '2.5'
46
+ version: '2.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.13'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.13'
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: fakefs
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
- - - ~>
65
+ - - "~>"
46
66
  - !ruby/object:Gem::Version
47
67
  version: '0.4'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.4.3
48
71
  type: :development
49
72
  prerelease: false
50
73
  version_requirements: !ruby/object:Gem::Requirement
51
74
  requirements:
52
- - - ~>
75
+ - - "~>"
53
76
  - !ruby/object:Gem::Version
54
77
  version: '0.4'
55
- description: This library adds a new, custom X-Git-SHA header to your Rails 3 application's
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.4.3
81
+ - !ruby/object:Gem::Dependency
82
+ name: rake
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '12.0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: '12.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rspec
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: '3.0'
109
+ description: This library adds a new, custom X-Git-SHA header to your Rails application's
56
110
  response which contains the SHA hash that your application is currently running.
57
111
  email:
58
112
  - gem@nathanielbibler.com
@@ -60,24 +114,25 @@ executables: []
60
114
  extensions: []
61
115
  extra_rdoc_files: []
62
116
  files:
63
- - .gitignore
64
- - .rspec
65
- - .travis.yml
117
+ - ".gitignore"
118
+ - ".rspec"
119
+ - ".travis.yml"
120
+ - Appraisals
66
121
  - CHANGELOG.md
67
122
  - Gemfile
68
123
  - LICENSE.txt
69
124
  - README.md
70
125
  - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - gemfiles/railties_3.2.gemfile
129
+ - gemfiles/railties_4.x.gemfile
130
+ - gemfiles/railties_5.x.gemfile
71
131
  - lib/sha_header.rb
72
132
  - lib/sha_header/middleware.rb
73
133
  - lib/sha_header/railtie.rb
74
134
  - lib/sha_header/version.rb
75
135
  - sha_header.gemspec
76
- - spec/models/middleware_spec.rb
77
- - spec/spec_helper.rb
78
- - spec/support/fakefs.rb
79
- - spec/support/rack.rb
80
- - spec/support/rails.rb
81
136
  homepage: https://github.com/nbibler/sha_header
82
137
  licenses:
83
138
  - MIT
@@ -88,24 +143,20 @@ require_paths:
88
143
  - lib
89
144
  required_ruby_version: !ruby/object:Gem::Requirement
90
145
  requirements:
91
- - - ! '>='
146
+ - - ">="
92
147
  - !ruby/object:Gem::Version
93
148
  version: '0'
94
149
  required_rubygems_version: !ruby/object:Gem::Requirement
95
150
  requirements:
96
- - - ! '>='
151
+ - - ">="
97
152
  - !ruby/object:Gem::Version
98
153
  version: '0'
99
154
  requirements: []
100
155
  rubyforge_project:
101
- rubygems_version: 2.0.3
156
+ rubygems_version: 2.5.2
102
157
  signing_key:
103
158
  specification_version: 4
104
- summary: Add a header to the response of your Rails 3 application containing the current
159
+ summary: Add a header to the response of your Rails application containing the current
105
160
  commit SHA.
106
- test_files:
107
- - spec/models/middleware_spec.rb
108
- - spec/spec_helper.rb
109
- - spec/support/fakefs.rb
110
- - spec/support/rack.rb
111
- - spec/support/rails.rb
161
+ test_files: []
162
+ has_rdoc:
@@ -1,47 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe SHAHeader::Middleware do
4
- let(:parent_app) {lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['Hello']] }}
5
- let(:middleware) { SHAHeader::Middleware.new(parent_app) }
6
- let(:env) { Rack::MockRequest.env_for('/hello') }
7
-
8
- context 'the X-Git-SHA response header' do
9
- subject { middleware.call(env)[1]['X-Git-SHA'] }
10
-
11
- it 'is added' do
12
- should be_present
13
- end
14
-
15
- context 'on Heroku' do
16
- before(:each) { ENV['COMMIT_HASH'] = 'ABCDEFG'; ENV['HEROKU_UPID'] = '1' }
17
- after(:each) { ENV['COMMIT_HASH'] = ENV['HEROKU_UPID'] = nil }
18
-
19
- it { should == 'ABCDEFG' }
20
- end
21
-
22
- context 'with a REVISION file', :fakefs do
23
- use_fakefs(self) do
24
- let(:path) { Rails.root.join('REVISION') }
25
- before(:each) { File.open(path, 'w') { |file| file.write 'HIJKLMNO' }}
26
- after(:each) { File.delete(path) }
27
-
28
- it { should == 'HIJKLMNO' }
29
- end
30
- end
31
-
32
- context 'when querying git' do
33
- it 'returns the current HEAD SHA' do
34
- middleware.should_receive(:`).
35
- with(%r{git rev-parse HEAD}).
36
- and_return('XYZ')
37
- should == 'XYZ'
38
- end
39
- end
40
- end
41
-
42
-
43
- it 'is Rack::Lint compliant' do
44
- app = Rack::Lint.new(middleware)
45
- app.call(env)
46
- end
47
- end
@@ -1,15 +0,0 @@
1
- require 'sha_header'
2
-
3
- RSpec.configure do |config|
4
- config.treat_symbols_as_metadata_keys_with_true_values = true
5
- config.run_all_when_everything_filtered = true
6
- config.filter_run :focus
7
-
8
- # Run specs in random order to surface order dependencies. If you find an
9
- # order dependency and want to debug it, you can fix the order by providing
10
- # the seed, which is printed after each run.
11
- # --seed 1234
12
- config.order = 'random'
13
- end
14
-
15
- Dir[File.expand_path("../support/*.rb", __FILE__)].each { |f| require f }
@@ -1,5 +0,0 @@
1
- require 'fakefs/spec_helpers'
2
-
3
- RSpec.configure do |config|
4
- config.include FakeFS::SpecHelpers, :fakefs
5
- end
@@ -1 +0,0 @@
1
- require 'rack'
@@ -1,7 +0,0 @@
1
- require 'pathname'
2
-
3
- module Rails
4
- def self.root
5
- Pathname.new(File.expand_path('../../../', __FILE__))
6
- end
7
- end