git-amnesia 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/README.md +37 -1
- data/bin/git-amnesia +2 -2
- data/lib/git-amnesia.rb +57 -0
- data/lib/{forgetful-git/common → git-amnesia}/git.rb +2 -18
- data/lib/{forgetful-git/common → git-amnesia}/log.rb +2 -2
- data/lib/{forgetful-git/common → git-amnesia}/string.rb +1 -1
- data/lib/git-amnesia/version.rb +3 -0
- metadata +7 -7
- data/lib/forgetful-git/amnesia.rb +0 -20
- data/lib/forgetful-git/amnesia/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35580fa55a5927ca193da5cf166ff2d05805c066
|
4
|
+
data.tar.gz: 1036a5a5b1f327d2f64522cbb5cd846e3bd920e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 320996b645e229ec8077eac7b9b1d594ba9ba1c98f3fa5d44124fa38656ba7fdd9c63b3ee6c9378bd8f0ae14cb877771add5f91c49804474d123648e278186de
|
7
|
+
data.tar.gz: 4df772c88c521b64531f16c94b3f90c1877f0a4006ceeb8548c27c92c8099d209f60895bfa445761c240ee47f22144d2cd0c86a239c28608ba0a5e407a17815a
|
data/README.md
CHANGED
@@ -1,2 +1,38 @@
|
|
1
1
|
# git-amnesia
|
2
|
-
|
2
|
+
[](https://rubygems.org/gems/git-amnesia)
|
3
|
+
[](https://github.com/x4121/git-amnesia)
|
4
|
+
|
5
|
+
Did you ever come back from your weekend, or worse holiday, looking at your repositories like:
|
6
|
+
|
7
|
+

|
8
|
+
|
9
|
+
Worry no more! Pass out on the weekends and let git-amnesia remember what you committed.
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
Set your workspace (or whatever you call the folder you put your repos) with
|
13
|
+
```sh
|
14
|
+
$ git config dir.workspace /path/to/my/workspace
|
15
|
+
```
|
16
|
+
and add any additional repositories you keep scattered around your file system
|
17
|
+
```sh
|
18
|
+
$ git config dir.others $HOME/.dotfiles:/some/other/repo
|
19
|
+
```
|
20
|
+
Now, typing `git amnesia` will present you with a nicely formatted and colored\* history of your commits.
|
21
|
+

|
22
|
+
|
23
|
+
\* you may still need to install a half decent colorscheme.
|
24
|
+
|
25
|
+
## Config
|
26
|
+
- `dir.workspace`: This will track changes in all direct subdirectories of
|
27
|
+
specified directory.
|
28
|
+
- `dir.others`: Additional folders to track.
|
29
|
+
- `amnesia.count`: Limit for commit messages to print. Default is 20.
|
30
|
+
|
31
|
+
## Requirements
|
32
|
+
- git (you probably have this if you're here)
|
33
|
+
- ruby >= 1.9.3
|
34
|
+
|
35
|
+
## Installation
|
36
|
+
```sh
|
37
|
+
$ gem install git-amnesia
|
38
|
+
```
|
data/bin/git-amnesia
CHANGED
data/lib/git-amnesia.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'git-amnesia/version'
|
2
|
+
require 'git-amnesia/git'
|
3
|
+
require 'git-amnesia/log'
|
4
|
+
|
5
|
+
module GitAmnesia
|
6
|
+
def self.run(args)
|
7
|
+
command = args.shift
|
8
|
+
|
9
|
+
case command
|
10
|
+
when 'help'
|
11
|
+
usage
|
12
|
+
when 'version'
|
13
|
+
version
|
14
|
+
when nil
|
15
|
+
amnesia
|
16
|
+
when '*'
|
17
|
+
error_usage(command)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.usage
|
23
|
+
puts "usage: git amnesia [<command>]"
|
24
|
+
puts " print git log of all git repositories combined"
|
25
|
+
puts ""
|
26
|
+
puts "These are the available commands:"
|
27
|
+
puts " help print this message"
|
28
|
+
puts " version print the current version"
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.version
|
32
|
+
puts "git-amnesia version #{GitAmnesia::VERSION}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.amnesia
|
36
|
+
repos = Git.repos
|
37
|
+
if repos.empty?
|
38
|
+
error_no_repos
|
39
|
+
end
|
40
|
+
Log.pretty_print(Git.logs(repos))
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def self.error_usage(command)
|
45
|
+
puts "unknown command #{command}"
|
46
|
+
puts ""
|
47
|
+
usage
|
48
|
+
exit 1
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.error_no_repos
|
52
|
+
puts "error: no git repositories found. please configure your repositories."
|
53
|
+
puts " git config dir.workspace /path/to/your/workspace"
|
54
|
+
puts " git config dir.others /repo:/other/repo"
|
55
|
+
exit 1
|
56
|
+
end
|
57
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'git-amnesia/string'
|
2
2
|
|
3
3
|
class Git
|
4
4
|
@amnesia_count_default = 20
|
@@ -8,7 +8,7 @@ class Git
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.other_dirs
|
11
|
-
`git config dir.others | envsubst`.
|
11
|
+
`git config dir.others | envsubst`.split_dirs.explode
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.amnesia_max
|
@@ -35,22 +35,6 @@ class Git
|
|
35
35
|
repos
|
36
36
|
end
|
37
37
|
|
38
|
-
def self.update(repo)
|
39
|
-
`cd "#{repo}" && git fetch >/dev/null 2>/dev/null`
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.status(repo)
|
43
|
-
`cd "#{repo}" && git status -s 2>/dev/null`.explode
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.compared_to_origin(status)
|
47
|
-
if status[0].include? "[behind"
|
48
|
-
"behind"
|
49
|
-
elsif status[0].include? "[ahead"
|
50
|
-
"ahead"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
38
|
def self.logs(repos)
|
55
39
|
logs = []
|
56
40
|
repos.each do |repo|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-amnesia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armin Grodon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -36,11 +36,11 @@ files:
|
|
36
36
|
- LICENSE
|
37
37
|
- README.md
|
38
38
|
- bin/git-amnesia
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/
|
43
|
-
- lib/
|
39
|
+
- lib/git-amnesia.rb
|
40
|
+
- lib/git-amnesia/git.rb
|
41
|
+
- lib/git-amnesia/log.rb
|
42
|
+
- lib/git-amnesia/string.rb
|
43
|
+
- lib/git-amnesia/version.rb
|
44
44
|
homepage: https://github.com/x4121/git-amnesia
|
45
45
|
licenses:
|
46
46
|
- MIT
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'forgetful-git/common/git'
|
2
|
-
require 'forgetful-git/common/log'
|
3
|
-
|
4
|
-
class Amnesia
|
5
|
-
def self.run
|
6
|
-
repos = Git.repos
|
7
|
-
if repos.empty?
|
8
|
-
error_no_repos
|
9
|
-
end
|
10
|
-
Log.pretty_print(Git.logs(repos))
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
def self.error_no_repos
|
15
|
-
puts "error: no git repositories found. please configure your repositories."
|
16
|
-
puts " git config dir.workspace /path/to/your/workspace"
|
17
|
-
puts " git config dir.others /repo:/other/repo"
|
18
|
-
exit 1
|
19
|
-
end
|
20
|
-
end
|