git-worklog 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: d934dcc530ffbff17cda06dace3101bc2eaac8bc119fbf22606b45150e7da07d
4
- data.tar.gz: b39dbcf514f433ded331c495d9eeb2e79102cccc1770877597f9aba319353cb6
3
+ metadata.gz: 565dc93c42bf6ec2cea54912c53cec79478f3fafcce053ae151c9f58207b09f1
4
+ data.tar.gz: be26ed512c674db28322344d0b2df8c4152325ead9519101feeb2da9acb6190e
5
5
  SHA512:
6
- metadata.gz: ff153d7694810a705a11980bdebb866e0398c51248160f63cb7e8437a6ef3e4047ba1036901cb7b7eec2747a10c9e0094b6a4d864844c015dd9dc6fba35fbe3a
7
- data.tar.gz: 6088be38275c22d0472ff0bd19490bb43d15efdd10b36a0efef2dfc05174241ad46624aea47849b3037ca9956c479a7448c6ec46646d59ec7a97da0ba3a57dac
6
+ metadata.gz: 12fcd10b9f82b297eb8e421734febcedfbb76d25196cac9c9d61d1f6f153eb19851117ba6bef6530d120b110f3e2a9360533b1df516afb1dd86f954be3dacaaf
7
+ data.tar.gz: 65b3c3ead690701ff33f6230010f60e8edbc9173ce9fbe945277d3c0f38352c5af7ebde4bea9251829671d15794b6e9d604670de3545d9853a08e7691e49cb48
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Git
4
4
  module Worklog
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
data/lib/git/worklog.rb CHANGED
@@ -5,8 +5,28 @@ require "thor"
5
5
 
6
6
  module Utilities
7
7
 
8
+ def default_git_username
9
+ `git config user.name`.strip
10
+ end
11
+
12
+ def default_git_email
13
+ `git config user.email`.strip
14
+ end
15
+
8
16
  def default_git_user
9
- `git config user.name`
17
+ "#{default_git_username} <#{default_git_email}>"
18
+ end
19
+
20
+ def repos
21
+ `find ../ -type d -exec test -e '{}/.git' ';' -print -prune`.split("\n")
22
+ end
23
+
24
+ def pwd
25
+ `pwd`
26
+ end
27
+
28
+ def root_repository_name
29
+ pwd.split('/').last
10
30
  end
11
31
 
12
32
  def user(name)
@@ -16,6 +36,9 @@ module Utilities
16
36
  return default_git_user
17
37
  end
18
38
  end
39
+ end
40
+
41
+ module GitCLIParser
19
42
 
20
43
  end
21
44
 
@@ -25,12 +48,38 @@ module Worklog
25
48
  include Thor::Actions
26
49
  include Utilities
27
50
 
28
- desc "show", "Shows worklog from current repository/directory for past 7 days"
29
- method_option :days, :aliases => "-d", :desc => "Specify number of days"
30
- method_option :user, :aliases => "-y", :desc => "Specify user"
51
+ def self.exit_on_failure?
52
+ true
53
+ end
54
+
55
+ desc "show", "Shows worklog from current repository/directory (Default: Last 7 days)"
56
+ method_option :days, :aliases => "-d", :desc => "Specify number of days", default: 7
57
+ method_option :weeks, :aliases => "-w", :desc => "Specify number of weeks"
58
+ method_option :user, :aliases => "-u", :desc => "Specify Author name"
59
+ method_option :path, :aliases => "-p", :desc => "Specify path from where to check for the repos"
60
+ method_option :format, :aliases => "-f", :desc => "Oneline, short, medium, full, fuller and raw"
61
+ method_option :reverse, :aliases => "-r", :desc => "Show output of logs in reverse", default: true
62
+ method_option :type, :aliases => "-t", :desc => "Merge Commits, Branch Commits"
63
+ method_option :repositories, :aliases => "-repos", :desc => "Show commits only from these repositories", default: "all"
31
64
 
32
65
  def show
33
- system("git --no-pager log --pretty=format:\"%h %ad | %s%d [%an]\" --date=short --since=#{options[:days] || 7}.days --author='#{user(options[:user])}' --all")
66
+ commits = {}
67
+ git_command = "git --no-pager log --pretty=oneline --date=short --since=#{options[:days] || 7}.days --author=\"#{user(options[:user])}\" --all"
68
+ repos.each do |repo|
69
+ repo_name = repo.split("/").last
70
+ output = `cd #{repo} && #{git_command}`
71
+ commits[repo_name] = output
72
+ system("cd #{pwd}")
73
+ end
74
+ commits = commits.filter { |key, value| value != ""}
75
+ commits.map do |key, value|
76
+ if key == "."
77
+ puts "\n\n---------------- PROJECT: #{root_repository_name} -----------------\n\n"
78
+ else
79
+ puts "\n\n---------------- PROJECT: #{key} -----------------\n\n"
80
+ end
81
+ puts value
82
+ end
34
83
  end
35
84
  end
36
85
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-worklog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ghouse Mohamed
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-18 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor