git-feats 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +11 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +106 -0
- data/Rakefile +11 -0
- data/bin/git-feats +5 -0
- data/contributing.md +20 -0
- data/git-feats.gemspec +47 -0
- data/lib/git-feats/api.rb +41 -0
- data/lib/git-feats/args.rb +40 -0
- data/lib/git-feats/checker.rb +48 -0
- data/lib/git-feats/completed.rb +32 -0
- data/lib/git-feats/config.rb +30 -0
- data/lib/git-feats/feats/feats.yml +251 -0
- data/lib/git-feats/feats.rb +14 -0
- data/lib/git-feats/history.rb +34 -0
- data/lib/git-feats/reporter.rb +16 -0
- data/lib/git-feats/runner.rb +23 -0
- data/lib/git-feats/serializer.rb +39 -0
- data/lib/git-feats/version.rb +3 -0
- data/lib/git-feats.rb +11 -0
- metadata +120 -0
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Chris Knadler
|
2
|
+
|
3
|
+
MIT License
|
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
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# git-feats [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/cknadler/git-feats) [![Dependency Status](https://gemnasium.com/cknadler/git-feats.png)](https://gemnasium.com/cknadler/git-feats)
|
2
|
+
|
3
|
+
`git-feats` is a command line wrapper for `git` that allows you to complete feats based on your `git` usage.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install git-feats
|
8
|
+
|
9
|
+
`git-feats` is is best aliased as `git`, so you can type `$ git <command>` as you normally would and complete feats.
|
10
|
+
|
11
|
+
See [alias](#alias) for instructions.
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
#### With Alias
|
16
|
+
|
17
|
+
If you alias `git-feats`, just keep using `git` like you always have. Occasionally, you will complete feats and it will look like this:
|
18
|
+
|
19
|
+
```
|
20
|
+
$ git status
|
21
|
+
|
22
|
+
********************************************************************************
|
23
|
+
Feat Completed!
|
24
|
+
Status Report
|
25
|
+
Viewed the working tree status with git status
|
26
|
+
********************************************************************************
|
27
|
+
|
28
|
+
# On branch master
|
29
|
+
# Changes not staged for commit:
|
30
|
+
# (use "git add <file>..." to update what will be committed)
|
31
|
+
# (use "git checkout -- <file>..." to discard changes in working directory)
|
32
|
+
#
|
33
|
+
# modified: README.md
|
34
|
+
#
|
35
|
+
no changes added to commit (use "git add" and/or "git commit -a")
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
#### Without Alias
|
40
|
+
|
41
|
+
If you don't alias `git` to `git-feats` you can still use `git-feats` in place of `git`:
|
42
|
+
|
43
|
+
```
|
44
|
+
$ git-feats status
|
45
|
+
```
|
46
|
+
|
47
|
+
## Alias
|
48
|
+
|
49
|
+
Add the following to your `.bash_profile` or other startup script:
|
50
|
+
|
51
|
+
```
|
52
|
+
alias git=git-feats
|
53
|
+
```
|
54
|
+
|
55
|
+
## .com
|
56
|
+
|
57
|
+
`git-feats` has a sweet web frontend at [gitfeats.com](http://gitfeats.com).
|
58
|
+
|
59
|
+
Linking your account is as easy as:
|
60
|
+
|
61
|
+
```
|
62
|
+
git config --global feats.key <your api key>
|
63
|
+
```
|
64
|
+
|
65
|
+
## Credits
|
66
|
+
|
67
|
+
git-feats was lovingly developed by:
|
68
|
+
|
69
|
+
* [Chris Knadler](https://github.com/cknadler)
|
70
|
+
* [Jennifer Coryell](https://github.com/dasmoose)
|
71
|
+
* [Ian Eckert](https://github.com/ieckert)
|
72
|
+
|
73
|
+
git-feats was inspired by [git-achievements](https://github.com/icefox/git-achievements).
|
74
|
+
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
`git-feats` has a dead simple interface for making feats.
|
79
|
+
|
80
|
+
Simply add a feat to the [feats file][feats-file] and it will work in the gem.
|
81
|
+
|
82
|
+
If you are looking to contribute, that is a great place to start.
|
83
|
+
|
84
|
+
Also, git-feats needs the following:
|
85
|
+
|
86
|
+
* Tests (probably RSpec)
|
87
|
+
* Code Cleanup
|
88
|
+
|
89
|
+
Any suggestions are also welcomed with open arms. Please fork, send pull requests and make issues.
|
90
|
+
|
91
|
+
#### How to contribute
|
92
|
+
|
93
|
+
1. Fork it
|
94
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
95
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
97
|
+
5. Create new Pull Request
|
98
|
+
|
99
|
+
|
100
|
+
## Copyright
|
101
|
+
|
102
|
+
Copyright (c) 2012 Chris Knadler, Jennifer Coryell and Ian Eckert.
|
103
|
+
|
104
|
+
See LICENSE for details.
|
105
|
+
|
106
|
+
[feats-file]: https://github.com/cknadler/git-feats/blob/master/lib/git-feats/feats/feats.yml
|
data/Rakefile
ADDED
data/bin/git-feats
ADDED
data/contributing.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
`git-feats` has a dead simple interface for making feats.
|
2
|
+
|
3
|
+
Simply add a feat to the [feats file][feats-file] and it will work in the gem.
|
4
|
+
|
5
|
+
If you are looking to contribute, that is a great place to start.
|
6
|
+
|
7
|
+
Also, git-feats needs the following:
|
8
|
+
|
9
|
+
* Tests (probably RSpec)
|
10
|
+
* Code Cleanup
|
11
|
+
|
12
|
+
Any suggestions are also welcomed with open arms. Please fork, send pull requests and make issues.
|
13
|
+
|
14
|
+
#### How to contribute
|
15
|
+
|
16
|
+
1. Fork it
|
17
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
18
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
19
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
20
|
+
5. Create new Pull Request
|
data/git-feats.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'git-feats/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "git-feats"
|
8
|
+
s.version = GitFeats::VERSION
|
9
|
+
s.authors = ["Chris Knadler"]
|
10
|
+
s.email = ["takeshi91k@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/cknadler/git-feats"
|
12
|
+
s.license = "MIT"
|
13
|
+
|
14
|
+
s.summary = "git achievements from the command line"
|
15
|
+
s.description = <<desc
|
16
|
+
`git-feats` is a command line utility which adds achievements to git.
|
17
|
+
|
18
|
+
Based on your `git` usage, you will complete feats.
|
19
|
+
|
20
|
+
It can used on its own or as a `git` wrapper.
|
21
|
+
|
22
|
+
Wrapping `git`:
|
23
|
+
|
24
|
+
Use `git` as you normally would.
|
25
|
+
|
26
|
+
$ git status
|
27
|
+
|
28
|
+
Without wrapping `git`:
|
29
|
+
|
30
|
+
Use `git-feats` in place of `git`.
|
31
|
+
|
32
|
+
$ git-feats status
|
33
|
+
desc
|
34
|
+
|
35
|
+
s.required_ruby_version = ">= 1.9.3"
|
36
|
+
|
37
|
+
s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/}
|
38
|
+
s.test_files = `git ls-files -- features/*`.split("\n")
|
39
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
40
|
+
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
|
43
|
+
s.add_runtime_dependency "json"
|
44
|
+
s.add_runtime_dependency "faraday", "~> 0.8.4"
|
45
|
+
|
46
|
+
s.add_development_dependency "rake", "~> 10.0.2"
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module GitFeats
|
5
|
+
module API
|
6
|
+
|
7
|
+
extend self
|
8
|
+
|
9
|
+
URL = 'http://localhost:3000'
|
10
|
+
|
11
|
+
def upload_feats
|
12
|
+
# Post json to git-feats
|
13
|
+
conn.post do |req|
|
14
|
+
req.url '/api/post_feats'
|
15
|
+
req.headers['Content-Type'] = 'application/json'
|
16
|
+
req.body = upload_feats_body.to_json
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# Return the faraday connection or load a new one
|
23
|
+
def conn
|
24
|
+
@conn ||= new_connection
|
25
|
+
end
|
26
|
+
|
27
|
+
def new_connection
|
28
|
+
# Create git-feats connection
|
29
|
+
Faraday.new(:url => URL)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Construct the body for the upload feats post
|
33
|
+
def upload_feats_body
|
34
|
+
{
|
35
|
+
:username => Config.username,
|
36
|
+
:key => Config.api_key,
|
37
|
+
:history => History.data
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module GitFeats
|
2
|
+
class Args < Array
|
3
|
+
|
4
|
+
# Makes a new Args object
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
@executable = ENV["GIT"] || "git"
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns an executable command
|
11
|
+
# that can be called with exec
|
12
|
+
#
|
13
|
+
# args - The args of the command
|
14
|
+
#
|
15
|
+
# Returns an array of args prepended with an executable
|
16
|
+
def to_exec(args = self)
|
17
|
+
Array(@executable) + args
|
18
|
+
end
|
19
|
+
|
20
|
+
# Checks if a pattern (string of args)
|
21
|
+
# matches the first arguments in an Args object
|
22
|
+
#
|
23
|
+
# Examples:
|
24
|
+
#
|
25
|
+
# Args('init').match?('init') #=> true
|
26
|
+
# Args('add', '.').match?('add .') #=> true
|
27
|
+
# Args('commit', '-a', '-m').match?('commit -a') #=> true
|
28
|
+
#
|
29
|
+
# Args('commit').match?('init') #=> false
|
30
|
+
# Args('commit').match?('commit -a') #=> false
|
31
|
+
#
|
32
|
+
# Returns a boolean
|
33
|
+
def match?(pattern)
|
34
|
+
pattern.split.each_with_index do |arg, index|
|
35
|
+
return false unless arg == self[index]
|
36
|
+
end
|
37
|
+
return true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module GitFeats
|
2
|
+
module Checker
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
# Main interface for checking feats
|
7
|
+
def check(args)
|
8
|
+
|
9
|
+
# Load history and completed
|
10
|
+
Completed.unserialize
|
11
|
+
History.unserialize
|
12
|
+
|
13
|
+
# request flag
|
14
|
+
upload = false
|
15
|
+
|
16
|
+
# Check for feats and update history
|
17
|
+
Feats.all.each do |pattern, feats|
|
18
|
+
if args.match?(pattern)
|
19
|
+
History.add(pattern)
|
20
|
+
|
21
|
+
feats.each do |feat, value|
|
22
|
+
if History.count(pattern) >= value[:count]
|
23
|
+
unless Completed.exists?(feat)
|
24
|
+
Completed.add(feat)
|
25
|
+
Reporter.report(value)
|
26
|
+
upload = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# upload feats if the request flag is set
|
34
|
+
upload_feats if upload
|
35
|
+
|
36
|
+
# Write out history and completed feats
|
37
|
+
Completed.serialize
|
38
|
+
History.serialize
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# call upload feats from API if config values exist
|
44
|
+
def upload_feats
|
45
|
+
API.upload_feats if Config.exists?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GitFeats
|
2
|
+
module Completed
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
PATH = Dir.home + '/.git_feats/completed'
|
7
|
+
|
8
|
+
# load data from file
|
9
|
+
def unserialize
|
10
|
+
@completed = Serializer.unserialize(PATH) || []
|
11
|
+
end
|
12
|
+
|
13
|
+
# write data to file
|
14
|
+
def serialize
|
15
|
+
Serializer.serialize(PATH, @completed)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Add a feat to the list of completed feats
|
19
|
+
def add(feat)
|
20
|
+
@completed << feat
|
21
|
+
end
|
22
|
+
|
23
|
+
# check of a user has already completed a feat
|
24
|
+
def exists?(feat)
|
25
|
+
@completed.include?(feat.to_s)
|
26
|
+
end
|
27
|
+
|
28
|
+
def data
|
29
|
+
@completed
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module GitFeats
|
2
|
+
module Config
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
CONFIG_CMD = "git config --global feats.key"
|
7
|
+
|
8
|
+
# Returns the config value for username
|
9
|
+
def username
|
10
|
+
@username ||= config_value.split('-')[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns the config value for api key
|
14
|
+
def api_key
|
15
|
+
@api_key ||= config_value.split('-')[1].chomp
|
16
|
+
end
|
17
|
+
|
18
|
+
# Check if config exists and is configured properly
|
19
|
+
def exists?
|
20
|
+
username && api_key
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# loads the config value from the global git config file
|
26
|
+
def config_value
|
27
|
+
@config_value ||= `#{CONFIG_CMD}`
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,251 @@
|
|
1
|
+
---
|
2
|
+
"add":
|
3
|
+
:bricks_and_mortar:
|
4
|
+
:name: "Bricks and Mortar"
|
5
|
+
:desc: "Added files to the index area for inclusion in the next commit with git add"
|
6
|
+
:count: 1
|
7
|
+
|
8
|
+
"am":
|
9
|
+
:delivery:
|
10
|
+
:name: "Delivery"
|
11
|
+
:desc: "Applied a patch using git am"
|
12
|
+
:count: 1
|
13
|
+
|
14
|
+
"bisect":
|
15
|
+
:bug_hunter:
|
16
|
+
:name: "Bug Hunter"
|
17
|
+
:desc: "Performed a binary search to find which change introduced a bug with git bisect"
|
18
|
+
:count: 1
|
19
|
+
|
20
|
+
"blame":
|
21
|
+
:blame_game:
|
22
|
+
:name: "Blame Game"
|
23
|
+
:desc: "Used git blame to annotate a file with information about changes"
|
24
|
+
:count: 1
|
25
|
+
|
26
|
+
"bundle":
|
27
|
+
:cold_transfer:
|
28
|
+
:name: "Cold Transfer"
|
29
|
+
:desc: "Bundled git objects and refs with git bundle"
|
30
|
+
:count: 1
|
31
|
+
|
32
|
+
"cherry-pick":
|
33
|
+
:fine_grain:
|
34
|
+
:name: "Fine Grain"
|
35
|
+
:desc: "Applied a commit from one branch to another with git cherry-pick"
|
36
|
+
:count: 1
|
37
|
+
|
38
|
+
"checkout":
|
39
|
+
:shopping_spree:
|
40
|
+
:name: "Shopping Spree"
|
41
|
+
:desc: "Changed branches with git checkout"
|
42
|
+
:count: 1
|
43
|
+
|
44
|
+
"checout -b":
|
45
|
+
:impulse_buy:
|
46
|
+
:name: "Impulse Buy"
|
47
|
+
:desc: "Created a new branch with git checkout -b"
|
48
|
+
:count: 1
|
49
|
+
|
50
|
+
"clean":
|
51
|
+
:mr_clean:
|
52
|
+
:name: "Mr. Clean"
|
53
|
+
:desc: "Used git clean to remove untracked files from the working tree"
|
54
|
+
:count: 1
|
55
|
+
|
56
|
+
"clone":
|
57
|
+
:replicator:
|
58
|
+
:name: "Replicator"
|
59
|
+
:desc: "Used git clone to copy a repository into a new directory"
|
60
|
+
:count: 1
|
61
|
+
|
62
|
+
"commit":
|
63
|
+
:author:
|
64
|
+
:name: "Author"
|
65
|
+
:desc: "Made a commit using git commit"
|
66
|
+
:count: 1
|
67
|
+
:bestseller:
|
68
|
+
:name: "Bestseller"
|
69
|
+
:desc: "Made 100 commits using git commit"
|
70
|
+
:count: 100
|
71
|
+
|
72
|
+
"config":
|
73
|
+
:tinkerer:
|
74
|
+
:name: "Tinkerer"
|
75
|
+
:desc: "Used git config to set configuration options"
|
76
|
+
:count: 1
|
77
|
+
|
78
|
+
"diff":
|
79
|
+
:foreshadowing:
|
80
|
+
:name: "Foreshadowing"
|
81
|
+
:desc: "Used git diff to see a diff of changes"
|
82
|
+
:count: 1
|
83
|
+
|
84
|
+
"fetch":
|
85
|
+
:expansion:
|
86
|
+
:name: "Expansion"
|
87
|
+
:desc: "Downloaded objects and refs from another repository with git fetch"
|
88
|
+
:count: 1
|
89
|
+
|
90
|
+
"filter-branch":
|
91
|
+
:hedge_trimming:
|
92
|
+
:name: "Hedge Trimming"
|
93
|
+
:desc: "Rewrote a branch with git filter-branch"
|
94
|
+
:count: 1
|
95
|
+
|
96
|
+
"format-patch":
|
97
|
+
:mail_clerk:
|
98
|
+
:name: "Mail Clerk"
|
99
|
+
:desc: "Prepared patches for email submission with git format-patch"
|
100
|
+
:count: 1
|
101
|
+
|
102
|
+
"gc":
|
103
|
+
:housekeeping:
|
104
|
+
:name: "Housekeeping"
|
105
|
+
:desc: "Optimized a local repository with git gc"
|
106
|
+
:count: 1
|
107
|
+
|
108
|
+
"grep":
|
109
|
+
:private_investigator:
|
110
|
+
:name: "Private Investigator"
|
111
|
+
:desc: "Searched tracked files using git grep"
|
112
|
+
:count: 1
|
113
|
+
|
114
|
+
"imap-send":
|
115
|
+
:mailman:
|
116
|
+
:name: "Mailman"
|
117
|
+
:desc: "Sent patches to an IMAP folder using git imap-send"
|
118
|
+
:count: 1
|
119
|
+
|
120
|
+
"init":
|
121
|
+
:empty_lot:
|
122
|
+
:name: "Empty Lot"
|
123
|
+
:desc: "Initialize a git repository with git init"
|
124
|
+
:count: 1
|
125
|
+
|
126
|
+
"instaweb":
|
127
|
+
:pixels_everywhere:
|
128
|
+
:name: "Pixels Everywhere"
|
129
|
+
:desc: "Browse your working repository on gitweb with git instaweb"
|
130
|
+
:count: 1
|
131
|
+
|
132
|
+
"log":
|
133
|
+
:historian:
|
134
|
+
:name: "Historian"
|
135
|
+
:desc: "Read the commit history with git log"
|
136
|
+
:count: 1
|
137
|
+
|
138
|
+
"merge":
|
139
|
+
:unification:
|
140
|
+
:name: "Unification"
|
141
|
+
:desc: "Joined two or more commit histories with git merge"
|
142
|
+
:count: 1
|
143
|
+
|
144
|
+
"mv":
|
145
|
+
:moving_day:
|
146
|
+
:name: "Moving Day"
|
147
|
+
:desc: "Moved something with git mv"
|
148
|
+
:count: 1
|
149
|
+
|
150
|
+
"pull":
|
151
|
+
:assimilation:
|
152
|
+
:name: "Assimilation"
|
153
|
+
:desc: "Fetched from and merged with another repository with git pull"
|
154
|
+
:count: 1
|
155
|
+
|
156
|
+
"push":
|
157
|
+
:social_butterfly:
|
158
|
+
:name: "Social Butterfly"
|
159
|
+
:desc: "Pushed a branch to a remote repository using git push"
|
160
|
+
:count: 1
|
161
|
+
|
162
|
+
"rebase":
|
163
|
+
:slice_and_dice:
|
164
|
+
:name: "Slice and Dice"
|
165
|
+
:desc: "Rebased local commits to updated upstream head with git rebase"
|
166
|
+
:count: 1
|
167
|
+
|
168
|
+
"reflog":
|
169
|
+
:seamstress:
|
170
|
+
:name: "Seamstress"
|
171
|
+
:desc: "Investigated old branches using git reflog"
|
172
|
+
:count: 1
|
173
|
+
|
174
|
+
"remote add":
|
175
|
+
:connected:
|
176
|
+
:name: "Connected"
|
177
|
+
:desc: "Added an external repository with git remote add"
|
178
|
+
:count: 1
|
179
|
+
|
180
|
+
"reset":
|
181
|
+
:second_guess:
|
182
|
+
:name: "Second Guess"
|
183
|
+
:desc: "Changed the current HEAD state with git reset"
|
184
|
+
:count: 1
|
185
|
+
|
186
|
+
"rm":
|
187
|
+
:fireball:
|
188
|
+
:name: "Fireball"
|
189
|
+
:desc: "Removed something with git rm"
|
190
|
+
:count: 1
|
191
|
+
|
192
|
+
"shell":
|
193
|
+
:annex:
|
194
|
+
:name: "Annex"
|
195
|
+
:desc: "Loaded a restricted login shell for Git-only SSH access with git shell"
|
196
|
+
:count: 1
|
197
|
+
|
198
|
+
"show":
|
199
|
+
:showoff:
|
200
|
+
:name: "Showoff"
|
201
|
+
:desc: "Displayed one or more objects (blobs trees tags and commits) with git show"
|
202
|
+
:count: 1
|
203
|
+
|
204
|
+
"show-branch":
|
205
|
+
:forest_cartography:
|
206
|
+
:name: "Forest Cartography"
|
207
|
+
:desc: "Displayed a branch graph with git show-branch"
|
208
|
+
:count: 1
|
209
|
+
|
210
|
+
"stash":
|
211
|
+
:hoarder:
|
212
|
+
:name: "Hoarder"
|
213
|
+
:desc: "Stashed local changes using git stash"
|
214
|
+
:count: 1
|
215
|
+
|
216
|
+
"status":
|
217
|
+
:status_report:
|
218
|
+
:name: "Status Report"
|
219
|
+
:desc: "Viewed the working tree status with git status"
|
220
|
+
:count: 1
|
221
|
+
|
222
|
+
"submodule add":
|
223
|
+
:sublet:
|
224
|
+
:name: "Sublet"
|
225
|
+
:desc: "Added a submodule with git submodule add"
|
226
|
+
:count: 1
|
227
|
+
|
228
|
+
"submodule update":
|
229
|
+
:renovations:
|
230
|
+
:name: "Renovations"
|
231
|
+
:desc: "Updated one or more submodules with git submodule update"
|
232
|
+
:count: 1
|
233
|
+
|
234
|
+
"svn":
|
235
|
+
:dinosaur:
|
236
|
+
:name: "Dinosaur"
|
237
|
+
:desc: "Streamed changes to svn with git svn"
|
238
|
+
:count: 1
|
239
|
+
|
240
|
+
"tag":
|
241
|
+
:label_wizard:
|
242
|
+
:name: "Label Wizard"
|
243
|
+
:desc: "Created deleted or listed one or more tags with git tag"
|
244
|
+
:count: 1
|
245
|
+
|
246
|
+
"whatchanged":
|
247
|
+
:historian:
|
248
|
+
:name: "Historian"
|
249
|
+
:desc: "Showed the difference each commit introduced with git whatchanged"
|
250
|
+
:count: 1
|
251
|
+
---
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module GitFeats
|
2
|
+
module History
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
PATH = Dir.home + '/.git_feats/history'
|
7
|
+
|
8
|
+
# load data from file
|
9
|
+
def unserialize
|
10
|
+
@history = Serializer.unserialize(PATH) || {}
|
11
|
+
end
|
12
|
+
|
13
|
+
# write data to file
|
14
|
+
def serialize
|
15
|
+
Serializer.serialize(PATH, @history)
|
16
|
+
end
|
17
|
+
|
18
|
+
def add(pattern)
|
19
|
+
if @history[pattern]
|
20
|
+
@history[pattern] += 1
|
21
|
+
else
|
22
|
+
@history[pattern] = 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def count(pattern)
|
27
|
+
@history[pattern]
|
28
|
+
end
|
29
|
+
|
30
|
+
def data
|
31
|
+
@history
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module GitFeats
|
2
|
+
module Reporter
|
3
|
+
|
4
|
+
extend self
|
5
|
+
|
6
|
+
COLUMNS = 80
|
7
|
+
|
8
|
+
def report(feat)
|
9
|
+
puts "\n" + '*' * COLUMNS
|
10
|
+
puts "Feat Completed!".center(COLUMNS)
|
11
|
+
puts feat[:name].center(COLUMNS)
|
12
|
+
puts feat[:desc].center(COLUMNS)
|
13
|
+
puts '*' * COLUMNS + "\n\n"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GitFeats
|
2
|
+
class Runner
|
3
|
+
|
4
|
+
# Creates a new Runner
|
5
|
+
#
|
6
|
+
# args - The args to be run with git
|
7
|
+
def initialize(*args)
|
8
|
+
@args = Args.new(args)
|
9
|
+
# parse args for feats
|
10
|
+
Checker.check(@args)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Run shortcut
|
14
|
+
def self.run(args)
|
15
|
+
Runner.new(args).run
|
16
|
+
end
|
17
|
+
|
18
|
+
# Execute git command
|
19
|
+
def run
|
20
|
+
exec(*@args.to_exec)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module GitFeats
|
4
|
+
module Serializer
|
5
|
+
|
6
|
+
extend self
|
7
|
+
|
8
|
+
# serialize a ruby object to a file in json
|
9
|
+
#
|
10
|
+
# path - file path
|
11
|
+
# data - data to be serialized
|
12
|
+
#
|
13
|
+
# Returns nothing
|
14
|
+
def serialize(path, data)
|
15
|
+
# Make a path to the data file if one doesn't already exist
|
16
|
+
dir = File.dirname path
|
17
|
+
FileUtils.mkpath(dir) unless File.directory?(dir)
|
18
|
+
|
19
|
+
File.open(path, "w") do |f|
|
20
|
+
f.puts data.to_json
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# unserialize a json file to a ruby object
|
25
|
+
#
|
26
|
+
# path - file path
|
27
|
+
#
|
28
|
+
# Returns a ruby object or nil
|
29
|
+
def unserialize(path)
|
30
|
+
if File.exists?(path) && !File.zero?(path)
|
31
|
+
begin
|
32
|
+
return JSON.parse(IO.binread(path))
|
33
|
+
rescue JSON::ParserError => e
|
34
|
+
puts e
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/git-feats.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'git-feats/serializer'
|
2
|
+
require 'git-feats/args'
|
3
|
+
require 'git-feats/api'
|
4
|
+
require 'git-feats/config'
|
5
|
+
require 'git-feats/checker'
|
6
|
+
require 'git-feats/completed'
|
7
|
+
require 'git-feats/feats'
|
8
|
+
require 'git-feats/history'
|
9
|
+
require 'git-feats/reporter'
|
10
|
+
require 'git-feats/runner'
|
11
|
+
require 'git-feats/version'
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-feats
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Knadler
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: json
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: faraday
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.8.4
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.8.4
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 10.0.2
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.0.2
|
62
|
+
description: ! " `git-feats` is a command line utility which adds achievements to
|
63
|
+
git.\n\n Based on your `git` usage, you will complete feats.\n\n It can used on
|
64
|
+
its own or as a `git` wrapper.\n\n Wrapping `git`:\n\n Use `git` as you normally
|
65
|
+
would.\n\n $ git status\n\n Without wrapping `git`:\n\n Use `git-feats` in
|
66
|
+
place of `git`.\n\n $ git-feats status\n"
|
67
|
+
email:
|
68
|
+
- takeshi91k@gmail.com
|
69
|
+
executables:
|
70
|
+
- git-feats
|
71
|
+
extensions: []
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- .travis.yml
|
75
|
+
- Gemfile
|
76
|
+
- LICENSE.txt
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- bin/git-feats
|
80
|
+
- contributing.md
|
81
|
+
- git-feats.gemspec
|
82
|
+
- lib/git-feats.rb
|
83
|
+
- lib/git-feats/api.rb
|
84
|
+
- lib/git-feats/args.rb
|
85
|
+
- lib/git-feats/checker.rb
|
86
|
+
- lib/git-feats/completed.rb
|
87
|
+
- lib/git-feats/config.rb
|
88
|
+
- lib/git-feats/feats.rb
|
89
|
+
- lib/git-feats/feats/feats.yml
|
90
|
+
- lib/git-feats/history.rb
|
91
|
+
- lib/git-feats/reporter.rb
|
92
|
+
- lib/git-feats/runner.rb
|
93
|
+
- lib/git-feats/serializer.rb
|
94
|
+
- lib/git-feats/version.rb
|
95
|
+
homepage: https://github.com/cknadler/git-feats
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 1.9.3
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
requirements: []
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.8.24
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: git achievements from the command line
|
120
|
+
test_files: []
|