gistory 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +59 -5
- data/.travis.yml +3 -3
- data/README.md +11 -5
- data/bin/console +1 -1
- data/gistory.gemspec +7 -3
- data/lib/gistory/change_log.rb +4 -4
- data/lib/gistory/cli/arg_parser.rb +19 -17
- data/lib/gistory/cli/main.rb +22 -4
- data/lib/gistory/commit.rb +4 -0
- data/lib/gistory/configuration.rb +8 -2
- data/lib/gistory/git_repo.rb +12 -2
- data/lib/gistory/version.rb +1 -1
- data/lib/gistory/version_change.rb +4 -0
- metadata +67 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '09f3c9251a676aa3fe78d5487e7cb60ee6c8348de21ae7ad4d91ee7a16623f69'
|
4
|
+
data.tar.gz: bb6b913eb6a330dea5db7e8f8bdd4e1db87324ff72abdeb48c835c00c87ab0a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f0931cb9e7673d6e7d88e1eb80e892ae3f482b1c3c8e4feae59b1b28f20b45a37bb6c08d51e4d15ec0d7115b780c0cc2f4dc4c530739197c4e9c48975ef19db
|
7
|
+
data.tar.gz: 137c0bb24fa19cea60221ab8a57994bc7a4e46c99aa4666c6b3d35b133aeb0559541b26090c9d3f92f71d87daacc471b5fe283e0824433d98d1b8af30c3b3223
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
Enabled: false
|
1
|
+
require: rubocop-rspec
|
3
2
|
|
4
3
|
Metrics/AbcSize:
|
5
4
|
Max: 25
|
@@ -13,18 +12,73 @@ Metrics/BlockLength:
|
|
13
12
|
Metrics/MethodLength:
|
14
13
|
Max: 20
|
15
14
|
|
16
|
-
Metrics/LineLength:
|
17
|
-
Max: 120
|
18
|
-
|
19
15
|
Layout/EmptyLineAfterGuardClause:
|
20
16
|
Enabled: false
|
21
17
|
|
18
|
+
Layout/LineLength:
|
19
|
+
Max: 120
|
20
|
+
|
22
21
|
Style/BlockDelimiters:
|
23
22
|
Exclude:
|
24
23
|
- 'spec/**/*_spec.rb'
|
25
24
|
|
25
|
+
Style/Documentation:
|
26
|
+
Enabled: false
|
27
|
+
|
26
28
|
Style/IfUnlessModifier:
|
27
29
|
Enabled: false
|
28
30
|
|
29
31
|
Style/FrozenStringLiteralComment:
|
30
32
|
EnforcedStyle: always
|
33
|
+
|
34
|
+
# rubocop-rspec
|
35
|
+
|
36
|
+
RSpec/MultipleExpectations:
|
37
|
+
Max: 15
|
38
|
+
|
39
|
+
RSpec/ExampleLength:
|
40
|
+
Max: 15
|
41
|
+
|
42
|
+
# starting rubocop 0.80 newly added cops need to be explicitly enabled:
|
43
|
+
|
44
|
+
Lint/DeprecatedOpenSSLConstant:
|
45
|
+
Enabled: true
|
46
|
+
|
47
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Lint/MixedRegexpCaptureTypes:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Lint/RaiseException:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
Layout/SpaceAroundMethodCallOperator:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Lint/StructNewOverride:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Style/ExponentialNotation:
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Style/HashEachMethods:
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Style/HashTransformKeys:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Style/HashTransformValues:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Style/RedundantFetchBlock:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
Style/RedundantRegexpCharacterClass:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Style/RedundantRegexpEscape:
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Style/SlicingWithRange:
|
84
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[![Build Status](https://travis-ci.org/serch/gistory.svg?branch=master)](https://travis-ci.org/serch/gistory)
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/github/serch/gistory/badge.svg?branch=master)](https://coveralls.io/github/serch/gistory?branch=master)
|
7
7
|
|
8
|
-
If you use bundler and git
|
8
|
+
If you use bundler and git and you want to know when a gem was updated, `gistory` comes to the rescue, simply:
|
9
9
|
|
10
10
|
```shell
|
11
11
|
gem install gistory
|
@@ -14,6 +14,7 @@ gistory sidekiq
|
|
14
14
|
```
|
15
15
|
|
16
16
|
and you'll see something like:
|
17
|
+
|
17
18
|
```
|
18
19
|
Gem: sidekiq
|
19
20
|
Current version: 4.2.7
|
@@ -25,11 +26,17 @@ Change history:
|
|
25
26
|
4.1.4 on Wed, 9 Nov 2016 14:31 +01:00 (commit 05a3c549)
|
26
27
|
```
|
27
28
|
|
28
|
-
By default `gistory` only looks at the last 100
|
29
|
-
|
29
|
+
By default `gistory` only looks at the last 100 commits made to the current branch.
|
30
|
+
If you want to see farther back in the past run:
|
31
|
+
|
32
|
+
```shell
|
33
|
+
gistory sidekiq -m1000
|
34
|
+
```
|
35
|
+
|
36
|
+
If you want to look at all changes to Gemfile.lock in all branches, use the `-a` switch:
|
30
37
|
|
31
38
|
```shell
|
32
|
-
gistory sidekiq -
|
39
|
+
gistory sidekiq -a
|
33
40
|
```
|
34
41
|
|
35
42
|
Note that if the gem was added, then removed, and then added again, `gistory` will
|
@@ -44,4 +51,3 @@ only show the latest version changes up until it was removed.
|
|
44
51
|
- remove bundler dep
|
45
52
|
- add yard doc
|
46
53
|
- do not print the warning text if there were no more changes in the lock file
|
47
|
-
- find version with the longest length and pad all others to match it (f.i. rails has 4.2.8 and 4.2.7.1)
|
data/bin/console
CHANGED
@@ -8,7 +8,7 @@ require 'pry'
|
|
8
8
|
root_path = "#{File.dirname(__FILE__)}/.."
|
9
9
|
|
10
10
|
# require all files in lib for quick access to them in the console
|
11
|
-
Dir["#{root_path}/lib/**/*.rb"].each { |file| require file }
|
11
|
+
Dir["#{root_path}/lib/**/*.rb"].sort.each { |file| require file }
|
12
12
|
|
13
13
|
def reload!
|
14
14
|
verbosity = $VERBOSE
|
data/gistory.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'gistory'
|
9
9
|
spec.version = Gistory::VERSION
|
10
10
|
spec.platform = Gem::Platform::RUBY
|
11
|
-
spec.required_ruby_version = '>= 2.
|
11
|
+
spec.required_ruby_version = '>= 2.4'
|
12
12
|
spec.authors = ['Sergio Medina']
|
13
13
|
spec.email = ['medinasergio@gmail.com']
|
14
14
|
|
@@ -27,6 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'bundler', '~> 1.0'
|
28
28
|
spec.add_dependency 'colorize'
|
29
29
|
|
30
|
-
spec.add_development_dependency '
|
31
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'pry'
|
31
|
+
spec.add_development_dependency 'pry-byebug'
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
34
|
+
spec.add_development_dependency 'rubocop'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec'
|
32
36
|
end
|
data/lib/gistory/change_log.rb
CHANGED
@@ -10,17 +10,17 @@ module Gistory
|
|
10
10
|
|
11
11
|
def changelog_for_gem(gem_name)
|
12
12
|
version_changes = []
|
13
|
-
|
13
|
+
commits_with_changes = @repo.changes_to_file(LOCKFILE)
|
14
14
|
|
15
15
|
# no lockfile found or no changes to the lockfile found
|
16
|
-
return [] if
|
16
|
+
return [] if commits_with_changes.empty?
|
17
17
|
|
18
|
-
previous_commit =
|
18
|
+
previous_commit = commits_with_changes.shift
|
19
19
|
previous_gem_spec = gem_version_at_commit_hash(previous_commit.short_hash, gem_name)
|
20
20
|
# only one change to the lockfile was found and the gem was not there
|
21
21
|
return [] if previous_gem_spec.nil?
|
22
22
|
|
23
|
-
|
23
|
+
commits_with_changes.each do |current_commit|
|
24
24
|
current_gem_spec = gem_version_at_commit_hash(current_commit.short_hash, gem_name)
|
25
25
|
|
26
26
|
# we reached the end, the gem didn't exist back then
|
@@ -38,33 +38,35 @@ module Gistory
|
|
38
38
|
parser = OptionParser.new
|
39
39
|
parser.banner = 'Usage: gistory <gem_name> [options]'
|
40
40
|
|
41
|
-
|
42
|
-
add_common_options(parser)
|
41
|
+
add_options(parser, config)
|
43
42
|
|
44
43
|
parser
|
45
44
|
end
|
46
45
|
|
47
|
-
def
|
46
|
+
def add_options(parser, config)
|
48
47
|
parser.separator ''
|
49
|
-
parser.separator '
|
50
|
-
|
51
|
-
add_max_lockfile_changes(parser, config)
|
52
|
-
end
|
53
|
-
|
54
|
-
def add_common_options(parser)
|
55
|
-
parser.separator ''
|
56
|
-
parser.separator 'Common options:'
|
48
|
+
parser.separator 'Options:'
|
57
49
|
|
50
|
+
add_max_fetched_commits(parser, config)
|
51
|
+
add_use_commits_from_all_branches(parser, config)
|
58
52
|
add_help(parser)
|
59
53
|
add_version(parser)
|
60
54
|
end
|
61
55
|
|
62
|
-
def
|
63
|
-
default = config.
|
64
|
-
description = "max number of
|
65
|
-
parser.on('-m', '--max-
|
66
|
-
raise(Gistory::ParserError, 'argument --max-
|
67
|
-
config.
|
56
|
+
def add_max_fetched_commits(parser, config)
|
57
|
+
default = config.max_fetched_commits
|
58
|
+
description = "max number of commits to be fetched (default #{default})"
|
59
|
+
parser.on('-m', '--max-fetched-commits [Integer]', Integer, description) do |m|
|
60
|
+
raise(Gistory::ParserError, 'argument --max-fetched-commits must be an integer') if m.nil?
|
61
|
+
config.max_fetched_commits = m
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_use_commits_from_all_branches(parser, config)
|
66
|
+
description = 'use commits from all branches ' \
|
67
|
+
'(by default it uses only commits made to the current branch)'
|
68
|
+
parser.on('-a', '--all-branches', description) do |a|
|
69
|
+
config.all_branches = a
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
data/lib/gistory/cli/main.rb
CHANGED
@@ -34,14 +34,32 @@ module Gistory
|
|
34
34
|
@io.puts "Current version: #{changes.first.version}"
|
35
35
|
@io.puts ''
|
36
36
|
|
37
|
+
print_change_history(changes)
|
38
|
+
|
39
|
+
@io.puts ''
|
40
|
+
|
41
|
+
print_configuration_info
|
42
|
+
end
|
43
|
+
|
44
|
+
def print_change_history(changes)
|
37
45
|
@io.puts 'Change history:'
|
46
|
+
max_length = changes.map { |c| c.version.length }.max
|
47
|
+
|
38
48
|
changes.each do |change|
|
39
|
-
@io.puts "#{change.version} on #{change.date.strftime('%a, %e %b %Y %H:%M %Z')}
|
49
|
+
@io.puts "#{change.version.ljust(max_length)} on #{change.date.strftime('%a, %e %b %Y %H:%M %Z')} " \
|
50
|
+
"(commit #{change.short_hash})"
|
40
51
|
end
|
52
|
+
end
|
41
53
|
|
42
|
-
|
43
|
-
max = Gistory.config.
|
44
|
-
|
54
|
+
def print_configuration_info
|
55
|
+
max = Gistory.config.max_fetched_commits
|
56
|
+
if Gistory.config.all_branches?
|
57
|
+
@io.puts "The last #{max} changes to the lock file were fetched."
|
58
|
+
else
|
59
|
+
@io.puts "The last #{max} commits made to the current branch were fetched."
|
60
|
+
end
|
61
|
+
|
62
|
+
@io.puts 'To see farther in the past use the -m switch'
|
45
63
|
end
|
46
64
|
end
|
47
65
|
end
|
data/lib/gistory/commit.rb
CHANGED
@@ -2,10 +2,16 @@
|
|
2
2
|
|
3
3
|
module Gistory
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :gem_name, :
|
5
|
+
attr_accessor :gem_name, :max_fetched_commits
|
6
|
+
attr_writer :all_branches
|
6
7
|
|
7
8
|
def initialize
|
8
|
-
@
|
9
|
+
@max_fetched_commits = 100
|
10
|
+
@all_branches = false
|
11
|
+
end
|
12
|
+
|
13
|
+
def all_branches?
|
14
|
+
@all_branches
|
9
15
|
end
|
10
16
|
end
|
11
17
|
end
|
data/lib/gistory/git_repo.rb
CHANGED
@@ -10,8 +10,9 @@ module Gistory
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def changes_to_file(filename)
|
13
|
-
max_count = Gistory.config.
|
14
|
-
|
13
|
+
max_count = Gistory.config.max_fetched_commits
|
14
|
+
strategy = git_log_strategy(filename)
|
15
|
+
hashes_and_dates = git("log --pretty=format:'%h|%cD' --max-count=#{max_count} #{strategy}")
|
15
16
|
to_commits(hashes_and_dates.split("\n"))
|
16
17
|
end
|
17
18
|
|
@@ -21,6 +22,15 @@ module Gistory
|
|
21
22
|
|
22
23
|
private
|
23
24
|
|
25
|
+
def git_log_strategy(filename)
|
26
|
+
if Gistory.config.all_branches?
|
27
|
+
"--follow #{filename}"
|
28
|
+
else
|
29
|
+
# TODO: filter out commits that did not introduce changes to the lock file
|
30
|
+
'--first-parent'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
24
34
|
def git_cli_available?
|
25
35
|
system('which git > /dev/null 2>&1')
|
26
36
|
end
|
data/lib/gistory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gistory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Medina
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,34 +38,90 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
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'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: rake
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '13.0'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '13.0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rspec
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
87
|
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
89
|
+
version: '3.9'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
94
|
- - "~>"
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
96
|
+
version: '3.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
69
125
|
description: 'Gistory: Know exactly when a gem was updated in your Gemfile.lock'
|
70
126
|
email:
|
71
127
|
- medinasergio@gmail.com
|
@@ -104,7 +160,7 @@ homepage: https://www.github.com/serch/gistory
|
|
104
160
|
licenses:
|
105
161
|
- MIT
|
106
162
|
metadata: {}
|
107
|
-
post_install_message:
|
163
|
+
post_install_message:
|
108
164
|
rdoc_options: []
|
109
165
|
require_paths:
|
110
166
|
- lib
|
@@ -112,16 +168,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
168
|
requirements:
|
113
169
|
- - ">="
|
114
170
|
- !ruby/object:Gem::Version
|
115
|
-
version: '2.
|
171
|
+
version: '2.4'
|
116
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
173
|
requirements:
|
118
174
|
- - ">="
|
119
175
|
- !ruby/object:Gem::Version
|
120
176
|
version: '0'
|
121
177
|
requirements: []
|
122
|
-
|
123
|
-
|
124
|
-
signing_key:
|
178
|
+
rubygems_version: 3.0.3
|
179
|
+
signing_key:
|
125
180
|
specification_version: 4
|
126
181
|
summary: 'Gistory: Know exactly when a gem was updated in your Gemfile.lock'
|
127
182
|
test_files: []
|