weekly_commits 1.0.0 → 1.2.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
- SHA1:
3
- metadata.gz: 032be9fd7bb56b8cd2f6480be35b329a60da4fb1
4
- data.tar.gz: 6a73cc53bbe888c084950d2ac06215cf33ddf750
2
+ SHA256:
3
+ metadata.gz: 6e16a3a3bea3a46f70db3d6fb703337e2e7cd44a059ffade96a165bd9b4b09b1
4
+ data.tar.gz: d84c4e05262b03db95692a961011aebf4cc4a792d61b650b8c3ad8ee28af97fc
5
5
  SHA512:
6
- metadata.gz: b305fe4c67db86e642c70abbedfe1bd011b4ed9e4a13e06f2ee3c166bda86648b921026c8f279f4942d18f64761cc653be3947be90e433201736dc9fe6d81de7
7
- data.tar.gz: 61640142bca5fff7a0ceb520d60258799673efbe2611f7fb0101cf0d5b23079f712bf144439e8d257edb448b161ac7584f822ccc30135b54d41f6fee83acd0e5
6
+ metadata.gz: b8ec98a825d7f6efeac3b0e15384b306b6eb2fc3b3b658c1a675d501d219624d0b1781de67dc913f87960392ccfdb4c49d3143051d6c86238dbc1a3a648bed89
7
+ data.tar.gz: e520fea50c79ed696b04ccf876f852c4b5185469b1ff41d691040892a972727363e72d3ab2cb6ff183958ca9439b943072fe51123c18f691b2b02feb7e2f63d0
data/README.md CHANGED
@@ -1,12 +1,14 @@
1
- # WeeklyCommits
1
+ ![WeeklyCommits](weekly_commits.png)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/weekly_commits`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Build Status](https://travis-ci.org/dkarter/weekly_commits.svg?branch=master)](https://travis-ci.org/dkarter/weekly_commits)
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ WeeklyCommits is a command line tool for getting a bird's eye view of your
6
+ commits on a branch for a specific week.
6
7
 
7
- ## Installation
8
+ It is particularly helpful for stand ups, filling up detailed time sheets and
9
+ for recap when starting up again after a long weekend.
8
10
 
9
- Add this line to your application's Gemfile:
11
+ ## Installation
10
12
 
11
13
  ```ruby
12
14
  gem 'weekly_commits'
@@ -22,20 +24,73 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ For help type:
28
+
29
+ ```sh
30
+ wcomm help
31
+ # or
32
+ wcomm help weekly_commits
33
+ ```
34
+
35
+ Usage documentation from command-line:
36
+
37
+ ```
38
+ Usage:
39
+ wcomm
40
+
41
+ Options:
42
+ -w, [--week=N] # Relative week number. e.g. -w=1 for last week. 0 = current week.
43
+ # Default: 0
44
+ [--show-author], [--no-show-author] # Display author(s) with each commit message. e.g. Did stuff (Ghost Ninja)
45
+ [--no-merge] # Omit merge commit messages
46
+ [--sort=SORT] # Show commits in ascending/descending order. Default: older commits on top, newer on bottom.
47
+ # Default: desc
48
+ # Possible values: asc, desc
49
+ ```
50
+
51
+ To use the gem, navigate to a repo and make sure you have the WeeklyCommits gem
52
+ installed for that version of ruby in that directory.
53
+
54
+ Make sure you are on the correct branch.
55
+
56
+ By default WeeklyCommits will only show commits on the current branch.
57
+
58
+ ### Example
59
+
60
+ Show me this week's commits:
61
+
62
+ ```sh
63
+ wcomm
64
+ ```
65
+
66
+ Show me last week's commits:
67
+
68
+ ```sh
69
+ wcomm -w=1
70
+ ```
71
+
72
+ Show me commits from two weeks ago including author
73
+
74
+ ```sh
75
+ wcomm -w=2 --show-author
76
+ ```
77
+
78
+ ### Screenshots
26
79
 
27
- ## Development
80
+ ![tilex](screenshots/tilex.png)
28
81
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
82
+ ## TODO
30
83
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
84
+ - [ ] Add support for specifying a branch explicitly
32
85
 
33
86
  ## Contributing
34
87
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/weekly_commits.
88
+ Bug reports and pull requests are welcome on GitHub at
89
+ https://github.com/dkarter/weekly_commits.
36
90
 
37
91
 
38
92
  ## License
39
93
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
94
+ The gem is available as open source under the terms of the [MIT
95
+ License](http://opensource.org/licenses/MIT).
41
96
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "weekly_commits"
3
+ require 'bundler/setup'
4
+ require 'weekly_commits'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "weekly_commits"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
@@ -2,5 +2,4 @@ require 'weekly_commits/version'
2
2
  require 'weekly_commits/cli'
3
3
 
4
4
  module WeeklyCommits
5
-
6
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
  require 'colorize'
3
5
  require 'active_support/all'
@@ -7,13 +9,29 @@ module WeeklyCommits
7
9
  package_name 'Weekly Commits'
8
10
  default_task :weekly_commits
9
11
 
10
- desc 'weekly_commits', 'Lists commits for a specified week'
11
- method_option :week, {
12
- type: :numeric,
13
- desc: 'Relative week number. e.g. -w=1 for last week. 0 = current week.',
14
- aliases: '-w',
15
- default: 0
16
- }
12
+ desc 'weekly_commits', '[DEFAULT] Lists commits for a specified week'
13
+ method_option :week,
14
+ type: :numeric,
15
+ desc: 'Relative week number. e.g. -w=1 for last week. 0 = current week.',
16
+ aliases: '-w',
17
+ default: 0
18
+
19
+ method_option :show_author,
20
+ type: :boolean,
21
+ desc: 'Display author(s) with each commit message. e.g. Did stuff (Ghost Ninja)',
22
+ default: false
23
+
24
+ method_option :sort,
25
+ type: :string,
26
+ desc: 'Show commits in ascending/descending order. Default: older commits on top, newer on bottom.',
27
+ default: 'asc',
28
+ enum: %w[asc desc]
29
+
30
+ method_option :no_merge,
31
+ type: :boolean,
32
+ desc: 'Exclude merge commits',
33
+ default: false
34
+
17
35
  def weekly_commits
18
36
  relative_week = options[:week]
19
37
  beg_week = relative_week.week.ago.beginning_of_week
@@ -21,9 +39,14 @@ module WeeklyCommits
21
39
  5.times do |day_count|
22
40
  date = beg_week + day_count.days
23
41
  week_title = date.strftime('%a, %e %b %Y')
24
- git_date_format = date.strftime('%Y-%m-%e')
42
+ git_date_format = date.strftime('%Y-%m-%d')
43
+ committer = options[:show_author] ? ' (%cn)'.magenta : ''
44
+
45
+ git_log_command = "git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s#{committer}'"
46
+ git_log_command += ' --no-merges' if options[:no_merge]
25
47
 
26
- commits = `git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s'`
48
+ commits = `#{git_log_command}`
49
+ commits = commits.lines.reverse if options[:sort].casecmp('asc').zero?
27
50
 
28
51
  puts week_title.yellow
29
52
  puts commits
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WeeklyCommits
2
- VERSION = "1.0.0"
4
+ VERSION = '1.2.2'
3
5
  end
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'weekly_commits/version'
5
6
 
@@ -9,21 +10,22 @@ Gem::Specification.new do |spec|
9
10
  spec.authors = ['Dorian Karter']
10
11
  spec.email = ['jobs@doriankarter.com']
11
12
 
12
- spec.summary = %q{List your commits on a project for every day of a specified week}
13
+ spec.summary = 'List your commits on a project for every day of a specified week'
13
14
  spec.homepage = 'http://doriankarter.com'
14
15
  spec.license = 'MIT'
15
16
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|screenshots)/}) }
17
18
  spec.bindir = 'bin'
18
19
  spec.executables = ['wcomm']
19
20
  spec.require_paths = ['lib']
20
21
 
21
- spec.add_development_dependency 'bundler', "~> 1.11"
22
- spec.add_development_dependency 'rake', "~> 10.0"
23
- spec.add_development_dependency 'rspec', "~> 3.0"
22
+ spec.add_development_dependency 'bundler', '~> 2.1'
23
+ spec.add_development_dependency 'pry'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
24
26
 
25
27
  # runtime dependencies
26
- spec.add_runtime_dependency 'activesupport'
27
- spec.add_runtime_dependency 'thor'
28
- spec.add_runtime_dependency 'colorize'
28
+ spec.add_runtime_dependency 'activesupport', '~> 6.0'
29
+ spec.add_runtime_dependency 'colorize', '~> 0.8'
30
+ spec.add_runtime_dependency 'thor', '~> 1.0'
29
31
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weekly_commits
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Karter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-28 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
26
+ version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,45 +70,45 @@ dependencies:
56
70
  name: activesupport
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0'
75
+ version: '6.0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ">="
80
+ - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0'
82
+ version: '6.0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: thor
84
+ name: colorize
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0'
89
+ version: '0.8'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '0.8'
83
97
  - !ruby/object:Gem::Dependency
84
- name: colorize
98
+ name: thor
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '0'
103
+ version: '1.0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '0'
97
- description:
110
+ version: '1.0'
111
+ description:
98
112
  email:
99
113
  - jobs@doriankarter.com
100
114
  executables:
@@ -116,11 +130,12 @@ files:
116
130
  - lib/weekly_commits/cli.rb
117
131
  - lib/weekly_commits/version.rb
118
132
  - weekly_commits.gemspec
133
+ - weekly_commits.png
119
134
  homepage: http://doriankarter.com
120
135
  licenses:
121
136
  - MIT
122
137
  metadata: {}
123
- post_install_message:
138
+ post_install_message:
124
139
  rdoc_options: []
125
140
  require_paths:
126
141
  - lib
@@ -135,9 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
150
  - !ruby/object:Gem::Version
136
151
  version: '0'
137
152
  requirements: []
138
- rubyforge_project:
139
- rubygems_version: 2.5.1
140
- signing_key:
153
+ rubygems_version: 3.1.2
154
+ signing_key:
141
155
  specification_version: 4
142
156
  summary: List your commits on a project for every day of a specified week
143
157
  test_files: []