weekly_commits 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +65 -9
- data/lib/weekly_commits/cli.rb +20 -3
- data/lib/weekly_commits/version.rb +1 -1
- data/weekly_commits.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0955dfe06bad6f30979c30a6661a34b82ed329fb
|
4
|
+
data.tar.gz: adf8ec863ffa1c29c0459797406f468f277a9af6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f032558c8483599a78b08bb0a1791cfbea39849699d6995910d481a65908c66eb3d921220fb4284f6b341b4977c8fdd61b07f5abd5568090b1c8ccfbb2c2b7d3
|
7
|
+
data.tar.gz: 5952f50f68669a6ff9a3c32f918660da1fd104ca6b486c5a94f9b4aa5ab2730f09124dca7625e96651a9712bd3c4f8e6753cb4738a0df6cd1f7df59348d7d201
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# WeeklyCommits
|
2
2
|
|
3
|
-
|
3
|
+
WeeklyCommits is a command line tool for getting a bird's eye view of your
|
4
|
+
commits on a branch for a specific week.
|
4
5
|
|
5
|
-
|
6
|
+
It is particularly helpful for stand ups, filling up detailed time sheets and
|
7
|
+
for recap when starting up again after a long weekend.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
11
|
```ruby
|
12
12
|
gem 'weekly_commits'
|
13
13
|
```
|
@@ -22,20 +22,76 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
For help type:
|
26
|
+
|
27
|
+
```sh
|
28
|
+
wcomm help
|
29
|
+
# or
|
30
|
+
wcomm help weekly_commits
|
31
|
+
```
|
32
|
+
|
33
|
+
Usage documentation from command-line:
|
34
|
+
|
35
|
+
```
|
36
|
+
Usage:
|
37
|
+
wcomm
|
38
|
+
|
39
|
+
Options:
|
40
|
+
-w, [--week=N] # Relative week number. e.g. -w=1 for last week. 0 = current week.
|
41
|
+
# Default: 0
|
42
|
+
[--show-committer], [--no-show-committer] # Display committer with each commit message. e.g. Did stuff (Dorian Karter)
|
43
|
+
[--sort=SORT] # Show commits in ascending/descending order. Default: older commits on top, newer on bottom.
|
44
|
+
# Default: desc
|
45
|
+
# Possible values: asc, desc
|
46
|
+
```
|
47
|
+
|
48
|
+
### Example
|
49
|
+
|
50
|
+
First navigate to a repo and make sure you have the WeeklyCommits gem installed
|
51
|
+
for that version of ruby in that directory.
|
52
|
+
|
53
|
+
Show me this week's commits:
|
54
|
+
|
55
|
+
```sh
|
56
|
+
wcomm
|
57
|
+
```
|
58
|
+
|
59
|
+
Show me last weeks commits:
|
60
|
+
|
61
|
+
```sh
|
62
|
+
wcomm -w=1
|
63
|
+
```
|
64
|
+
|
65
|
+
Show me commits from two weeks ago including committer
|
66
|
+
|
67
|
+
```sh
|
68
|
+
wcomm -w=2 --show-committer
|
69
|
+
```
|
26
70
|
|
27
71
|
## Development
|
28
72
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
73
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
74
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
75
|
+
prompt that will allow you to experiment.
|
76
|
+
|
77
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
78
|
+
release a new version, update the version number in `version.rb`, and then run
|
79
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
80
|
+
git commits and tags, and push the `.gem` file to
|
81
|
+
[rubygems.org](https://rubygems.org).
|
82
|
+
|
83
|
+
## TODO
|
30
84
|
|
31
|
-
|
85
|
+
- [ ] Add support for multiple branches
|
32
86
|
|
33
87
|
## Contributing
|
34
88
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at
|
89
|
+
Bug reports and pull requests are welcome on GitHub at
|
90
|
+
https://github.com/dkarter/weekly_commits.
|
36
91
|
|
37
92
|
|
38
93
|
## License
|
39
94
|
|
40
|
-
The gem is available as open source under the terms of the [MIT
|
95
|
+
The gem is available as open source under the terms of the [MIT
|
96
|
+
License](http://opensource.org/licenses/MIT).
|
41
97
|
|
data/lib/weekly_commits/cli.rb
CHANGED
@@ -7,13 +7,27 @@ module WeeklyCommits
|
|
7
7
|
package_name 'Weekly Commits'
|
8
8
|
default_task :weekly_commits
|
9
9
|
|
10
|
-
desc 'weekly_commits', 'Lists commits for a specified week'
|
10
|
+
desc 'weekly_commits', '[DEFAULT] Lists commits for a specified week'
|
11
11
|
method_option :week, {
|
12
12
|
type: :numeric,
|
13
13
|
desc: 'Relative week number. e.g. -w=1 for last week. 0 = current week.',
|
14
14
|
aliases: '-w',
|
15
|
-
default: 0
|
15
|
+
default: 0,
|
16
16
|
}
|
17
|
+
|
18
|
+
method_option :show_committer, {
|
19
|
+
type: :boolean,
|
20
|
+
desc: 'Display committer with each commit message. e.g. Did stuff (Dorian Karter)',
|
21
|
+
default: false,
|
22
|
+
}
|
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: ['asc','desc'],
|
29
|
+
}
|
30
|
+
|
17
31
|
def weekly_commits
|
18
32
|
relative_week = options[:week]
|
19
33
|
beg_week = relative_week.week.ago.beginning_of_week
|
@@ -22,8 +36,11 @@ module WeeklyCommits
|
|
22
36
|
date = beg_week + day_count.days
|
23
37
|
week_title = date.strftime('%a, %e %b %Y')
|
24
38
|
git_date_format = date.strftime('%Y-%m-%e')
|
39
|
+
committer = options[:show_committer] ? ' (%cn)' : ''
|
40
|
+
|
41
|
+
commits = `git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s#{committer}'`
|
25
42
|
|
26
|
-
commits =
|
43
|
+
commits = commits.lines.reverse if options[:sort].downcase == 'asc'
|
27
44
|
|
28
45
|
puts week_title.yellow
|
29
46
|
puts commits
|
data/weekly_commits.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', "~> 1.11"
|
22
22
|
spec.add_development_dependency 'rake', "~> 10.0"
|
23
23
|
spec.add_development_dependency 'rspec', "~> 3.0"
|
24
|
+
spec.add_development_dependency 'pry'
|
24
25
|
|
25
26
|
# runtime dependencies
|
26
27
|
spec.add_runtime_dependency 'activesupport'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weekly_commits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Karter
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|