Module: GitAmnesia

Defined in:
lib/git-amnesia.rb,
lib/git-amnesia/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.amnesiaObject



35
36
37
38
39
40
41
# File 'lib/git-amnesia.rb', line 35

def self.amnesia
    repos = Git.repos
    if repos.empty?
        error_no_repos
    end
    Log.pretty_print(Git.logs(repos))
end

.error_no_reposObject



51
52
53
54
55
56
# File 'lib/git-amnesia.rb', line 51

def self.error_no_repos
    puts "error: no git repositories found. please configure your repositories."
    puts " git config dir.workspace /path/to/your/workspace"
    puts " git config dir.others /repo:/other/repo"
    exit 1
end

.error_usage(command) ⇒ Object



44
45
46
47
48
49
# File 'lib/git-amnesia.rb', line 44

def self.error_usage(command)
    puts "unknown command #{command}"
    puts ""
    usage
    exit 1
end

.run(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/git-amnesia.rb', line 6

def self.run(args)
    command = args.shift

    case command
    when 'help'
        usage
    when 'version'
        version
    when nil
        amnesia
    when '*'
        error_usage(command)
    end

end

.usageObject



22
23
24
25
26
27
28
29
# File 'lib/git-amnesia.rb', line 22

def self.usage
    puts "usage: git amnesia [<command>]"
    puts " print git log of all git repositories combined"
    puts ""
    puts "These are the available commands:"
    puts " help     print this message"
    puts " version  print the current version"
end

.versionObject



31
32
33
# File 'lib/git-amnesia.rb', line 31

def self.version
    puts "git-amnesia version #{GitAmnesia::VERSION}"
end