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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31691f77ee88a1ebf1fe38462cb264e9dd641176
4
- data.tar.gz: 24c0b32b2bd2c55a827ca4f13d24584165b77400
3
+ metadata.gz: 35580fa55a5927ca193da5cf166ff2d05805c066
4
+ data.tar.gz: 1036a5a5b1f327d2f64522cbb5cd846e3bd920e2
5
5
  SHA512:
6
- metadata.gz: 79e2b8465ace79a8225e876a7c39333ab0d65d4b3b8bf95c390e2a8bd82a8e94832417c4743dd9f3e9b022755707afc49a31e0b69e0e0474e15d3b078e4a641c
7
- data.tar.gz: 195a3115c7029d1af89fed4fca680a7f2d25e25df1ef5be8e6d37ecee93a38cad4d059efd8d4226570bb2075d35ab0c92835722b4b5ffbbe4c0f1872ca7f39ca
6
+ metadata.gz: 320996b645e229ec8077eac7b9b1d594ba9ba1c98f3fa5d44124fa38656ba7fdd9c63b3ee6c9378bd8f0ae14cb877771add5f91c49804474d123648e278186de
7
+ data.tar.gz: 4df772c88c521b64531f16c94b3f90c1877f0a4006ceeb8548c27c92c8099d209f60895bfa445761c240ee47f22144d2cd0c86a239c28608ba0a5e407a17815a
data/README.md CHANGED
@@ -1,2 +1,38 @@
1
1
  # git-amnesia
2
- A tool to help you recover from your post-weekend amnesia
2
+ [![Gem](https://img.shields.io/gem/v/git-amnesia.svg)](https://rubygems.org/gems/git-amnesia)
3
+ [![license](https://img.shields.io/github/license/x4121/git-amnesia.svg)](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
+ ![](http://s2.quickmeme.com/img/26/264476d2588c8a3a8c6db005251434f2c63c7eaf5402752918719efcb70924bf.jpg)
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
+ ![example output](https://raw.github.com/x4121/git-amnesia/master/git-amnesia.png)
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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'forgetful-git/amnesia'
3
+ require 'git-amnesia'
4
4
 
5
- Amnesia.run
5
+ GitAmnesia.run ARGV
@@ -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 'forgetful-git/common/string'
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`.split_dir.explode
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|
@@ -1,6 +1,6 @@
1
1
  require 'date'
2
- require 'forgetful-git/common/string'
3
- require 'forgetful-git/common/git'
2
+ require 'git-amnesia/string'
3
+ require 'git-amnesia/git'
4
4
 
5
5
  class Log
6
6
  include Comparable
@@ -7,7 +7,7 @@ class String
7
7
  self.split("\n")
8
8
  end
9
9
 
10
- def split_dir
10
+ def split_dirs
11
11
  self.sub(":", "\n")
12
12
  end
13
13
 
@@ -0,0 +1,3 @@
1
+ module GitAmnesia
2
+ VERSION = "0.0.2"
3
+ end
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.1
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-01-20 00:00:00.000000000 Z
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/forgetful-git/amnesia.rb
40
- - lib/forgetful-git/amnesia/version.rb
41
- - lib/forgetful-git/common/git.rb
42
- - lib/forgetful-git/common/log.rb
43
- - lib/forgetful-git/common/string.rb
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
@@ -1,3 +0,0 @@
1
- module Amnesia
2
- VERSION = "0.0.1"
3
- end