sasha 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Sasha
2
2
 
3
- Add your current Git SHA to your Rails app
3
+ Add your current Git SHA to your Rails or Sinatra app
4
4
  response headers.
5
5
 
6
6
  ## Requirements
7
7
 
8
- git? rails?
8
+ That you use git to track your source code
9
9
 
10
10
  ## Usage
11
11
 
@@ -34,7 +34,11 @@ Require it on *config.ru* after sinatra/base
34
34
 
35
35
  ## Test it
36
36
 
37
- $ curl -I http://www.example.net | grep X-Git-SHA
37
+ $ curl -I http://www.example.net | grep X-Git-Sha
38
+
39
+ Your should see something like
40
+
41
+ X-Git-Sha: ae4822ddfdfbb27cddcc30b718d6f9bc99138044
38
42
 
39
43
  # About the Author
40
44
 
@@ -1,5 +1,6 @@
1
1
  module Sasha
2
2
  autoload :Git, 'sasha/git'
3
+ HEADER_NAME = 'X-Git-Sha'
3
4
  end
4
5
 
5
6
  require 'sasha/rails' if defined?(ActionController)
@@ -4,7 +4,7 @@ module ActionController
4
4
 
5
5
  def set_git_sha_header
6
6
  warn "No git found for current project" unless Sasha::Git.current_sha
7
- headers['X-Git-SHA'] = Sasha::Git.current_sha
7
+ headers[Sasha::HEADER_NAME] = Sasha::Git.current_sha
8
8
  end
9
9
  end
10
10
  end
@@ -1,7 +1,7 @@
1
1
  module Sinatra
2
2
  class Base
3
3
  before do
4
- headers "X-Git-SHA" => Sasha::Git.current_sha
4
+ headers Sasha::HEADER_NAME => Sasha::Git.current_sha
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Sasha
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -8,13 +8,13 @@ class TestController < ActionController::TestCase
8
8
  def test_header_included_in_request
9
9
  Sasha::Git.expects(:current_sha).twice.returns('ABC123ABC123')
10
10
  get 'index'
11
- assert_equal 'ABC123ABC123', response.headers['X-Git-SHA']
11
+ assert_equal 'ABC123ABC123', response.headers[Sasha::HEADER_NAME]
12
12
  end
13
13
 
14
14
  def test_warning
15
15
  Sasha::Git.expects(:current_sha).twice.returns(nil)
16
16
  @controller.expects(:warn).once.with(instance_of(String))
17
17
  get 'index'
18
- assert_equal nil, response.headers['X-Git-SHA']
18
+ assert_equal nil, response.headers[Sasha::HEADER_NAME]
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sasha
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Padilla