git-version 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/config/routes.rb +1 -1
- data/lib/git-version/version.rb +1 -1
- metadata +7 -5
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2012 Darrin Holst
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
GitVersion
|
2
|
+
==========
|
3
|
+
A rails engine that will add a `/version` route to your app to show the current git commit hash
|
4
|
+
|
5
|
+
Why
|
6
|
+
---
|
7
|
+
Almost every web application that I've been a part of has had the need for a version url which doesn't need to be as semantic as something like a gem.
|
8
|
+
|
9
|
+
I also wanted to play around with rails engines.
|
10
|
+
|
11
|
+
Prerequisites
|
12
|
+
-------------
|
13
|
+
- Rails 3
|
14
|
+
- Using git for deployment
|
15
|
+
|
16
|
+
Installation
|
17
|
+
------------
|
18
|
+
Add the gem to your `Gemfile`:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'git-version'
|
22
|
+
```
|
23
|
+
|
24
|
+
Usage
|
25
|
+
-----
|
26
|
+
visit the version resource of your app
|
27
|
+
|
28
|
+
```
|
29
|
+
http://localhost:3000/version
|
30
|
+
```
|
31
|
+
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'grit'
|
2
2
|
|
3
3
|
GitVersion::Engine.routes.draw do
|
4
|
-
root :to => proc {|env| [200, {}, [Grit::Repo.new(Rails.root + '.git').commits.first.id[0...
|
4
|
+
root :to => proc {|env| [200, {}, [ENV['COMMIT_HASH'] || Grit::Repo.new(Rails.root + '.git').commits.first.id[0...7]]]}
|
5
5
|
end
|
6
6
|
|
7
7
|
Rails.application.routes.draw do
|
data/lib/git-version/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-version
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-04 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: grit
|
16
|
-
requirement: &
|
16
|
+
requirement: &70345732445180 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70345732445180
|
25
25
|
description: Add current git commit hash as a rails endpoint bound to /version
|
26
26
|
email:
|
27
27
|
- darrinholst@gmail.com
|
@@ -31,6 +31,8 @@ extra_rdoc_files: []
|
|
31
31
|
files:
|
32
32
|
- .gitignore
|
33
33
|
- Gemfile
|
34
|
+
- LICENSE
|
35
|
+
- README.md
|
34
36
|
- Rakefile
|
35
37
|
- config/routes.rb
|
36
38
|
- git-version.gemspec
|
@@ -51,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
53
|
version: '0'
|
52
54
|
segments:
|
53
55
|
- 0
|
54
|
-
hash:
|
56
|
+
hash: 55499764461789626
|
55
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
58
|
none: false
|
57
59
|
requirements:
|
@@ -60,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
62
|
version: '0'
|
61
63
|
segments:
|
62
64
|
- 0
|
63
|
-
hash:
|
65
|
+
hash: 55499764461789626
|
64
66
|
requirements: []
|
65
67
|
rubyforge_project: git-version
|
66
68
|
rubygems_version: 1.8.10
|