gitmarshal 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58f04fc58c3d7a48cf23ce5ff62c5ee72475ff93cb1538e717640016840a8081
4
- data.tar.gz: bf7b01d53cdcf1de0a0098d40aadf2c48f551cb096d3c466428b1458ea4a09da
3
+ metadata.gz: 116a3bb7f3fc2a050c6439fe041ad34a02ffb89384242030c88fecdaa0f77486
4
+ data.tar.gz: a7090cbb5415fd13fe92ecd8adb8e7c01184d5a74051190f9c070e89a96aa598
5
5
  SHA512:
6
- metadata.gz: fea58a7ac125590e814c30a5a15f7f54754edbf2a20ec2fe8c50c5d233d748b41099c3ac72b8447d16005e2d3796bbb1f56e5fd01d34fdc3c7a09bbe00c057e3
7
- data.tar.gz: 908c4b1cb14993295df313d32fa4dd4e0de006184891728555317a7dc6b9ef2b4021d4209504572fdd991c44cc504073dd7090bf3b48e2e83b2069520cdbbc0f
6
+ metadata.gz: cf19e969571d28aa8e5eeb465303b8ce204030d0ed97096efd835eb9b0e39d510aea014e35303474718a964f75ab08994237839f435776bc782d705879017634
7
+ data.tar.gz: 8308a3a065f85bf09b8de85c3321a30875d16af35f7f9c6cf6caf101b65aed94299f50c33bda82f6c2ed8d71f06f69e08afbd5d3fc31b10191a40aa800945d70
data/README.md CHANGED
@@ -16,9 +16,6 @@ Whether you're a developer interested in the activity of a repository or a manag
16
16
  </p>
17
17
 
18
18
 
19
-
20
-
21
-
22
19
  ## :sparkles: Features
23
20
 
24
21
  :octocat: Fetch and display a summary of your GitHub repositories.
@@ -89,6 +86,20 @@ gem install gitmarshal
89
86
 
90
87
  This command will download and install the GitMarshal gem onto your system.
91
88
 
89
+ To check the installed version of GitMarshal, use the command:
90
+
91
+ ```bash
92
+ gitmarshal --version
93
+ ```
94
+
95
+ This will display the currently installed version of GitMarshal. If you need to update GitMarshal to the latest version, run the following command:
96
+
97
+ ```bash
98
+ gem update gitmarshal
99
+ ```
100
+
101
+ This will fetch the latest version of GitMarshal from RubyGems and install it on your system.
102
+
92
103
  ## Configuration
93
104
 
94
105
  To use GitMarshal, an environment variable with your GitHub access token needs to be set up. You can do this by adding the following line to your shell profile file (such as `.bashrc`, `.bash_profile`, or `.zshrc`):
@@ -3,15 +3,21 @@ require "terminal-table"
3
3
  require "colorize"
4
4
  require "unicode_plot"
5
5
  require_relative "github_fetcher"
6
+ require_relative "version.rb"
6
7
 
7
8
  module GitMarshal
8
9
  class CLI < Thor
9
10
  class_option :help, type: :boolean, aliases: "-h", desc: "Display usage information"
10
11
  class_option :today, type: :boolean, aliases: "-t", desc: 'Display today\'s repository metrics instead of overall metrics'
11
12
  class_option :commit_history, type: :boolean, aliases: "-ch", desc: "Display the commit history of the repository"
13
+ map %w[--version -v] => :version
12
14
 
13
- desc "repos", "Prints a summary of the authenticated user's GitHub repositories"
15
+ desc "version", "Display the version number of GitMarshal."
16
+ def version
17
+ puts "GitMarshal Version #{Gitmarshal::VERSION}"
18
+ end
14
19
 
20
+ desc "repos", "Prints a summary of the authenticated user's GitHub repositories"
15
21
  def repos
16
22
  begin
17
23
  fetcher = GithubFetcher.new
@@ -55,50 +61,65 @@ module GitMarshal
55
61
  end
56
62
 
57
63
  private
58
-
59
64
  def metrics(repo_name, today_option = false, commit_history_option = false)
60
65
  fetcher = GithubFetcher.new
61
66
  user = fetcher.fetch_user
62
-
63
- repo = today_option ? fetcher.fetch_today_repo_metrics(user, repo_name) : fetcher.fetch_repo_metrics(user, repo_name)
64
-
67
+
65
68
  if today_option
66
- rows = prepare_table_rows_for_today(repo)
67
- # Display latest commit
68
- latest_commit = fetcher.fetch_latest_commit(user, repo_name)
69
- if latest_commit
70
- rows << ["Latest Commit Date", latest_commit["commit"]["committer"]["date"]]
71
- rows << ["Latest Commit Message", wrap_text(latest_commit["commit"]["message"])]
72
- end
73
- # Display today's metrics in a table
74
- display_table("Today's Repository Metrics", rows)
69
+ display_today_metrics(fetcher, user, repo_name)
75
70
  elsif commit_history_option
76
- commit_history = fetcher.fetch_commit_history(user, repo_name)
77
-
78
- # Prepare table rows for commit history
79
- rows = commit_history.map do |date, commit_count|
80
- [date, commit_count]
81
- end
82
-
83
- # Sort rows by date in descending order
84
- rows.sort_by! { |row| -Date.parse(row.first).to_time.to_i }
85
-
86
- # Display commit history in a table
87
- display_commit_history_table(rows)
71
+ display_commit_history(fetcher, user, repo_name)
88
72
  else
89
- rows = prepare_table_rows(repo)
90
- # Display latest commit
91
- latest_commit = fetcher.fetch_latest_commit(user, repo_name)
92
- if latest_commit
93
- rows << ["Latest Commit Date", latest_commit["commit"]["committer"]["date"]]
94
- rows << ["Latest Commit Message", wrap_text(latest_commit["commit"]["message"])]
95
- end
96
- # Display overall metrics in a table
97
- display_table("Repository Metrics", rows)
73
+ display_overall_metrics(fetcher, user, repo_name)
98
74
  end
99
75
  end
100
76
 
101
- private
77
+ def display_today_metrics(fetcher, user, repo_name)
78
+ repo = fetcher.fetch_today_repo_metrics(user, repo_name)
79
+
80
+ rows = prepare_table_rows_for_today(repo)
81
+
82
+ # Display latest commit
83
+ latest_commit = fetcher.fetch_latest_commit(user, repo_name)
84
+ if latest_commit
85
+ rows << ["Latest Commit Date", latest_commit["commit"]["committer"]["date"]]
86
+ rows << ["Latest Commit Message", wrap_text(latest_commit["commit"]["message"])]
87
+ end
88
+
89
+ # Display today's metrics in a table
90
+ display_table("Today's Repository Metrics", rows)
91
+ end
92
+
93
+ def display_commit_history(fetcher, user, repo_name)
94
+ commit_history = fetcher.fetch_commit_history(user, repo_name)
95
+
96
+ # Prepare table rows for commit history
97
+ rows = commit_history.map do |date, commit_count|
98
+ [date, commit_count]
99
+ end
100
+
101
+ # Sort rows by date in descending order
102
+ rows.sort_by! { |row| -Date.parse(row.first).to_time.to_i }
103
+
104
+ # Display commit history in a table
105
+ display_commit_history_table(rows)
106
+ end
107
+
108
+ def display_overall_metrics(fetcher, user, repo_name)
109
+ repo = fetcher.fetch_repo_metrics(user, repo_name)
110
+
111
+ rows = prepare_table_rows(repo)
112
+
113
+ # Display latest commit
114
+ latest_commit = fetcher.fetch_latest_commit(user, repo_name)
115
+ if latest_commit
116
+ rows << ["Latest Commit Date", latest_commit["commit"]["committer"]["date"]]
117
+ rows << ["Latest Commit Message", wrap_text(latest_commit["commit"]["message"])]
118
+ end
119
+
120
+ # Display overall metrics in a table
121
+ display_table("Repository Metrics", rows)
122
+ end
102
123
 
103
124
  def wrap_text(text, max_width = 50)
104
125
  text.gsub(/(.{1,#{max_width}})(\s+|\Z)/, "\\1\n")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitmarshal
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitmarshal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nagendra Dhanakeerthi