sasha 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in sasha.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Sasha
2
+
3
+ Add your current Git SHA to your Rails app
4
+ response headers.
5
+
6
+ ## Requirements
7
+
8
+ git? rails?
9
+
10
+ ## Usage
11
+
12
+ Add it to your Gemfile, you are using bundler, right?
13
+
14
+ gem 'sasha'
15
+
16
+ ## Test it
17
+
18
+ $ curl -I http://www.example.net | grep X-Git-SHA
19
+
20
+ # About the Author
21
+
22
+ [Crowd Interactive](http://www.crowdint.com) is an American web design and development company
23
+ that happens to work in Colima, Mexico.
24
+ We specialize in building and growing online retail stores.
25
+ We don’t work with everyone – just companies we believe in. Call us today to see if there’s a fit.
26
+ Find more info [here](http://www.crowdint.com)!
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+
6
+ task :default => :test
7
+
8
+ Rake::TestTask.new do |test|
9
+ test.libs << 'lib' << 'test'
10
+ test.pattern = 'test/**/test_*.rb'
11
+ test.verbose = true
12
+ end
data/lib/sasha.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'rails'
2
+
3
+ module Sasha
4
+ class Git
5
+ def self.current_sha
6
+ @current_sha ||= `git rev-parse HEAD`.chomp
7
+ end
8
+ end
9
+ end
10
+
11
+ class ActionController::Base
12
+ before_filter :set_git_sha_header
13
+
14
+ def set_git_sha_header
15
+ headers['X-Git-SHA'] = Sasha::Git.current_sha
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Sasha
2
+ VERSION = "0.0.1"
3
+ end
data/sasha.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "sasha/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sasha"
7
+ s.version = Sasha::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Padilla"]
10
+ s.email = ["david@crowdint.com"]
11
+ s.homepage = "http://www.github.com/crowdint/sasha"
12
+ s.summary = %q{Add your current Git SHA to your Rails app response headers.}
13
+ s.description = %q{Add your current Git SHA to your Rails app response headers.}
14
+
15
+ s.rubyforge_project = "sasha"
16
+
17
+ s.add_dependency 'rails', '~>3.0.0'
18
+
19
+ s.add_development_dependency 'minitest'
20
+ s.add_development_dependency 'mocha'
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+ end
@@ -0,0 +1,23 @@
1
+ require 'rubygems'
2
+ require 'minitest/autorun'
3
+
4
+ require 'rails/all'
5
+ require 'rails/test_help'
6
+
7
+ require 'sasha'
8
+
9
+ module Sasha
10
+ class Application < Rails::Application ; end
11
+ end
12
+
13
+ Sasha::Application.routes.draw do
14
+ match '/:controller(/:action(/:id))'
15
+ end
16
+
17
+ ActionController::Base.send :include, Sasha::Application.routes.url_helpers
18
+
19
+ class MyController < ActionController::Base
20
+ def index
21
+ render :text => 'ok'
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+
3
+ class TestController < ActionController::TestCase
4
+ def setup
5
+ @controller = MyController.new
6
+ end
7
+
8
+ def test_header_included_in_request
9
+ Sasha::Git.expects(:current_sha).returns('ABC123ABC123')
10
+ get 'index'
11
+ assert_equal 'ABC123ABC123', response.headers['X-Git-SHA']
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sasha
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - David Padilla
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-03-13 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: minitest
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: mocha
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ description: Add your current Git SHA to your Rails app response headers.
66
+ email:
67
+ - david@crowdint.com
68
+ executables: []
69
+
70
+ extensions: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ files:
75
+ - .gitignore
76
+ - Gemfile
77
+ - README.md
78
+ - Rakefile
79
+ - lib/sasha.rb
80
+ - lib/sasha/version.rb
81
+ - sasha.gemspec
82
+ - test/test_helper.rb
83
+ - test/unit/test_controller.rb
84
+ has_rdoc: true
85
+ homepage: http://www.github.com/crowdint/sasha
86
+ licenses: []
87
+
88
+ post_install_message:
89
+ rdoc_options: []
90
+
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ none: false
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ hash: 3
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project: sasha
114
+ rubygems_version: 1.3.7
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: Add your current Git SHA to your Rails app response headers.
118
+ test_files:
119
+ - test/test_helper.rb
120
+ - test/unit/test_controller.rb