git-feats 0.0.5 → 0.0.6
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/HISTORY.md +9 -0
- data/README.md +21 -2
- data/lib/git-feats/api.rb +4 -0
- data/lib/git-feats/config.rb +1 -1
- data/lib/git-feats/runner.rb +39 -6
- data/lib/git-feats/serializer.rb +10 -2
- data/lib/git-feats/version.rb +1 -1
- metadata +1 -1
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -12,7 +12,7 @@ See [alias](#alias) for instructions.
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
#### With
|
15
|
+
#### With alias
|
16
16
|
|
17
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
18
|
|
@@ -36,7 +36,7 @@ no changes added to commit (use "git add" and/or "git commit -a")
|
|
36
36
|
|
37
37
|
```
|
38
38
|
|
39
|
-
#### Without
|
39
|
+
#### Without alias
|
40
40
|
|
41
41
|
If you don't alias `git` to `git-feats` you can still use `git-feats` in place of `git`:
|
42
42
|
|
@@ -44,6 +44,21 @@ If you don't alias `git` to `git-feats` you can still use `git-feats` in place o
|
|
44
44
|
$ git-feats status
|
45
45
|
```
|
46
46
|
|
47
|
+
#### git-feats commands
|
48
|
+
|
49
|
+
git-feats also has commands that git-feats specific and don't mess with git.
|
50
|
+
|
51
|
+
|
52
|
+
```
|
53
|
+
$ git feats
|
54
|
+
|
55
|
+
usage: git feats <command>
|
56
|
+
|
57
|
+
commands:
|
58
|
+
update Update your feats and command history on gitfeats.com
|
59
|
+
help Display git-feats specific help
|
60
|
+
```
|
61
|
+
|
47
62
|
## Alias
|
48
63
|
|
49
64
|
Add the following to your `.bash_profile` or other startup script:
|
@@ -58,6 +73,10 @@ alias git=git-feats
|
|
58
73
|
|
59
74
|
Linking your account is as easy as:
|
60
75
|
|
76
|
+
```
|
77
|
+
git config --global github.user <your github username>
|
78
|
+
```
|
79
|
+
|
61
80
|
```
|
62
81
|
git config --global feats.key <your api key>
|
63
82
|
```
|
data/lib/git-feats/api.rb
CHANGED
@@ -11,12 +11,16 @@ module GitFeats
|
|
11
11
|
def upload_feats
|
12
12
|
# Post json to git-feats
|
13
13
|
begin
|
14
|
+
puts "Updating feats on gitfeats.com..."
|
15
|
+
# Attempt to update feats
|
14
16
|
conn.post do |req|
|
15
17
|
req.url '/api/post_feats'
|
16
18
|
req.headers['Content-Type'] = 'application/json'
|
17
19
|
req.body = upload_feats_body.to_json
|
18
20
|
end
|
21
|
+
puts
|
19
22
|
rescue
|
23
|
+
puts "Connection failed!\n\n"
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
data/lib/git-feats/config.rb
CHANGED
data/lib/git-feats/runner.rb
CHANGED
@@ -15,15 +15,21 @@ module GitFeats
|
|
15
15
|
new(*args).run
|
16
16
|
end
|
17
17
|
|
18
|
-
#
|
18
|
+
# Run the args as one of the following:
|
19
|
+
# - Pure git-feats command
|
20
|
+
# - Overridden git command
|
21
|
+
# - Pure git command
|
19
22
|
def run
|
20
|
-
|
21
|
-
# Check for git-feats commands
|
23
|
+
# Pure git-feats command
|
22
24
|
case @args[0]
|
23
|
-
when "
|
24
|
-
|
25
|
+
when "feats"
|
26
|
+
run_feats_cmd
|
27
|
+
|
28
|
+
# Overriden git command
|
25
29
|
when "version" || "--version"
|
26
30
|
version
|
31
|
+
|
32
|
+
# Pure git command
|
27
33
|
else
|
28
34
|
exec_args
|
29
35
|
end
|
@@ -31,17 +37,44 @@ module GitFeats
|
|
31
37
|
|
32
38
|
private
|
33
39
|
|
34
|
-
|
40
|
+
# Run git-feats specific update command
|
41
|
+
def feats_update
|
35
42
|
if Config.exists?
|
36
43
|
API.upload_feats
|
37
44
|
end
|
38
45
|
end
|
39
46
|
|
47
|
+
# Run git-feats specific help command
|
48
|
+
def feats_help
|
49
|
+
puts <<help
|
50
|
+
usage: git feats <command>
|
51
|
+
|
52
|
+
commands:
|
53
|
+
update Update your feats and command history on gitfeats.com
|
54
|
+
help Display git-feats specific help
|
55
|
+
help
|
56
|
+
end
|
57
|
+
|
58
|
+
# Override `git version` to output the git-feats version
|
40
59
|
def version
|
41
60
|
puts "git-feats version #{GitFeats::VERSION}"
|
42
61
|
exec_args
|
43
62
|
end
|
44
63
|
|
64
|
+
# Run a git-feats specific command
|
65
|
+
#
|
66
|
+
# Precondition: The first argument is 'feats'
|
67
|
+
# ex: 'git feats update'
|
68
|
+
def run_feats_cmd
|
69
|
+
case @args[1]
|
70
|
+
when "update"
|
71
|
+
feats_update
|
72
|
+
else
|
73
|
+
feats_help
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Exec the args as a git command
|
45
78
|
def exec_args
|
46
79
|
exec(*@args.to_exec)
|
47
80
|
end
|
data/lib/git-feats/serializer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
module GitFeats
|
4
5
|
module Serializer
|
@@ -13,8 +14,7 @@ module GitFeats
|
|
13
14
|
# Returns nothing
|
14
15
|
def serialize(path, data)
|
15
16
|
# Make a path to the data file if one doesn't already exist
|
16
|
-
|
17
|
-
FileUtils.mkdir(dir) unless File.directory?(dir)
|
17
|
+
mkpath_to path
|
18
18
|
|
19
19
|
File.open(path, "w") do |f|
|
20
20
|
f.puts data.to_json
|
@@ -35,5 +35,13 @@ module GitFeats
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def mkpath_to(path)
|
42
|
+
unless File.exists? path
|
43
|
+
FileUtils.mkpath File.dirname(path)
|
44
|
+
end
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
data/lib/git-feats/version.rb
CHANGED