Skip to content

Commit 7f85b75

Browse files
committed
first commit
0 parents  commit 7f85b75

File tree

6 files changed

+188
-0
lines changed

6 files changed

+188
-0
lines changed

.gitignore

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Numerous always-ignore extensions
2+
*.diff
3+
*.err
4+
*.orig
5+
*.log
6+
*.rej
7+
*.swo
8+
*.swp
9+
*.vi
10+
*~
11+
12+
# OS or Editor folders
13+
.DS_Store
14+
.cache
15+
.project
16+
.settings
17+
nbproject
18+
thumbs.db
19+
20+
# Logs
21+
.log
22+
.pid
23+
.sock
24+
.monitor
25+
26+
# Dreamweaver added files
27+
_notes
28+
dwsync.xml
29+
30+
# Komodo
31+
*.komodoproject
32+
.komodotools
33+
34+
# Folders to ignore
35+
node_modules
36+
.hg
37+
.svn
38+
publish
39+
.idea
40+
_dev
41+
42+
# build script local files
43+
build/buildinfo.properties
44+
build/config/buildinfo.properties

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(The MIT License)
2+
3+
Copyright (c) 2012 Thomas Blobaum <[email protected]>
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:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
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 NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# git-rev
2+
3+
[![Build Status](https://secure.travis-ci.org/tblobaum/git-rev.png)](http://travis-ci.org/tblobaum/git-rev)
4+
5+
# Example
6+
7+
``` js
8+
var revision = require('git-rev')
9+
10+
revision.short(function (str) {
11+
console.log('revision short', str)
12+
})
13+
14+
revision.long(function (str) {
15+
console.log('revision long', str)
16+
})
17+
18+
revision.branch(function (str) {
19+
console.log('revision branch', str)
20+
})
21+
22+
revision.tag(function (str) {
23+
console.log('revision tag', str)
24+
})
25+
26+
```
27+
28+
# Install
29+
30+
`npm install git-rev`
31+
32+
# License
33+
34+
(The MIT License)
35+
36+
Copyright (c) 2012 Thomas Blobaum <[email protected]>
37+
38+
Permission is hereby granted, free of charge, to any person obtaining
39+
a copy of this software and associated documentation files (the
40+
'Software'), to deal in the Software without restriction, including
41+
without limitation the rights to use, copy, modify, merge, publish,
42+
distribute, sublicense, and/or sell copies of the Software, and to
43+
permit persons to whom the Software is furnished to do so, subject to
44+
the following conditions:
45+
46+
The above copyright notice and this permission notice shall be
47+
included in all copies or substantial portions of the Software.
48+
49+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
50+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
51+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
52+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
53+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
54+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
55+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

example/simple.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var revision = require('../')
2+
3+
revision.short(function (str) {
4+
console.log('revision short', str)
5+
})
6+
7+
revision.long(function (str) {
8+
console.log('revision long', str)
9+
})
10+
11+
revision.branch(function (str) {
12+
console.log('revision branch', str)
13+
})
14+
15+
revision.tag(function (str) {
16+
console.log('revision tag', str)
17+
})

index.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
var exec = require('child_process').exec
2+
3+
function _command (cmd, cb) {
4+
exec(cmd, function (err, stdout, stderr) {
5+
cb(stdout.split('\n')[0])
6+
})
7+
}
8+
9+
function short (cb) {
10+
_command('git rev-parse --short HEAD', cb)
11+
}
12+
13+
function long (cb) {
14+
_command('git rev-parse HEAD', cb)
15+
}
16+
17+
function branch (cb) {
18+
_command('git rev-parse --abbrev-ref HEAD', cb)
19+
}
20+
21+
function tag (cb) {
22+
_command('git describe --always --tag', cb)
23+
}
24+
25+
module.exports = { short : short, long : long, branch : branch, tag : tag }

package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name" : "git-rev",
3+
"version" : "0.1.0",
4+
"description" : "description",
5+
"main" : "index.js",
6+
"bin" : {},
7+
"directories" : {
8+
"example" : "example"
9+
},
10+
"dependencies" : {},
11+
"devDependencies" : {},
12+
"scripts" : {},
13+
"repository" : {
14+
"type" : "git",
15+
"url" : "git://github.com/tblobaum/git-rev.git"
16+
},
17+
"homepage" : "https://github.com/tblobaum/git-rev",
18+
"keywords" : [ ],
19+
"author" : {
20+
"name" : "Thomas Blobaum",
21+
"email" : "[email protected]",
22+
"url" : "https://github.com/tblobaum/"
23+
},
24+
"license" : "MIT"
25+
}

0 commit comments

Comments
 (0)