gemdiff 3.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -12
- data/bin/gemdiff +1 -1
- data/lib/gemdiff/bundle_inspector.rb +5 -14
- data/lib/gemdiff/cli.rb +7 -6
- data/lib/gemdiff/gem_updater.rb +1 -1
- data/lib/gemdiff/outdated_gem.rb +3 -3
- data/lib/gemdiff/repo_finder.rb +15 -1
- data/lib/gemdiff/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8561d98525b5af6630489157667b734a6246b043f1b61aad0eb5520b59fa2151
|
4
|
+
data.tar.gz: d9ba487fb07a322ec4a00cbde23c3b85d9409131b47089008c7e8045f6260f64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b864867a77e56dd1a5980bd3e8f915679d92b26ec409a0b49b5b3036ad1f661928a3e3f25a281faae8e97c34e6a395d4a3dfad1b5f768141c31d65882ec84dfb
|
7
|
+
data.tar.gz: 5eb7e674d4d49b38e0bbb7f90ae5636ff645bf273daba23e31ec5894e3b33ef6975722bb8ecf59b76f8f9e369952af5a5a98c1482c1629ab01cce33156cd64da
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# gemdiff
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/gemdiff.svg)](http://rubygems.org/gems/gemdiff)
|
4
|
-
[![
|
4
|
+
[![CI](https://github.com/teeparham/gemdiff/actions/workflows/test.yml/badge.svg)](https://github.com/teeparham/gemdiff/actions/workflows/test.yml)
|
5
5
|
|
6
6
|
`gemdiff` is a command-line tool to find source code for ruby gems.
|
7
7
|
It connects gem version management (rubygems + bundler) with source code (GitHub).
|
8
8
|
|
9
|
-
`gemdiff` provides commands to
|
9
|
+
`gemdiff` provides commands to
|
10
10
|
* Find GitHub repositories for gems
|
11
11
|
* Open the compare view for two gem versions
|
12
12
|
* Inspect your bundle and list all the available updates
|
@@ -146,8 +146,8 @@ to run with the `open` command with a URL argument):
|
|
146
146
|
$ gemdiff open pundit
|
147
147
|
```
|
148
148
|
|
149
|
-
You may also use `.` as a shortcut for the current directory name.
|
150
|
-
This is helpful if you would like to quickly open the gem you are developing, for example:
|
149
|
+
You may also use `.` as a shortcut for the current directory name.
|
150
|
+
This is helpful if you would like to quickly open the gem you are developing, for example:
|
151
151
|
|
152
152
|
```sh
|
153
153
|
$ pwd
|
@@ -175,7 +175,7 @@ $ gemdiff compare pundit 1.0.0 0.3.0
|
|
175
175
|
You can compare a version with a branch name:
|
176
176
|
|
177
177
|
```sh
|
178
|
-
$ gemdiff compare arel 6.0.0
|
178
|
+
$ gemdiff compare arel 6.0.0 main
|
179
179
|
```
|
180
180
|
|
181
181
|
### `gemdiff releases [gem]`
|
@@ -186,12 +186,12 @@ Open the repository's release history page:
|
|
186
186
|
$ gemdiff releases haml
|
187
187
|
```
|
188
188
|
|
189
|
-
### `gemdiff
|
189
|
+
### `gemdiff main [gem]`
|
190
190
|
|
191
|
-
Open the repository's
|
191
|
+
Open the repository's main branch commit history page:
|
192
192
|
|
193
193
|
```sh
|
194
|
-
$ gemdiff
|
194
|
+
$ gemdiff main haml
|
195
195
|
```
|
196
196
|
|
197
197
|
### `gemdiff help`
|
@@ -220,8 +220,8 @@ pwd
|
|
220
220
|
/Users/you/ruby/somegem
|
221
221
|
gemdiff find .
|
222
222
|
gemdiff open .
|
223
|
-
gemdiff
|
224
|
-
gemdiff compare . 1.2.3
|
223
|
+
gemdiff main .
|
224
|
+
gemdiff compare . 1.2.3 main
|
225
225
|
```
|
226
226
|
|
227
227
|
### Authenticated GitHub API requests
|
@@ -245,11 +245,11 @@ releases, submit an issue to the gem maintainer to tag their releases.
|
|
245
245
|
|
246
246
|
3. The versions must be tagged using the standard format of `v1.2.3`. If you find gems that follow
|
247
247
|
a non-standard format (such as `1.2.3`), please open an issue or submit a pull request.
|
248
|
-
See [`lib/gemdiff/outdated_gem.rb`](https://github.com/teeparham/gemdiff/blob/
|
248
|
+
See [`lib/gemdiff/outdated_gem.rb`](https://github.com/teeparham/gemdiff/blob/main/lib/gemdiff/outdated_gem.rb).
|
249
249
|
|
250
250
|
4. Encourage gem maintainers to enter the GitHub repository URL in the `homepage` field of their gemspec
|
251
251
|
or anywhere in the description. If you find exceptions, open an issue or submit a pull request.
|
252
|
-
See [`lib/gemdiff/repo_finder.rb`](https://github.com/teeparham/gemdiff/blob/
|
252
|
+
See [`lib/gemdiff/repo_finder.rb`](https://github.com/teeparham/gemdiff/blob/main/lib/gemdiff/repo_finder.rb).
|
253
253
|
|
254
254
|
### More Info
|
255
255
|
|
data/bin/gemdiff
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Gemdiff
|
4
4
|
class BundleInspector
|
5
|
+
BUNDLE_OUTDATED_PARSE_REGEX = /\A([^\s]+)\s\(newest\s([^,]+),\sinstalled\s([^,\)]+).*\z/.freeze
|
6
|
+
|
5
7
|
def list
|
6
8
|
@list ||=
|
7
9
|
outdated
|
@@ -21,24 +23,13 @@ module Gemdiff
|
|
21
23
|
private
|
22
24
|
|
23
25
|
def bundle_outdated_strict
|
24
|
-
`bundle outdated --strict`
|
26
|
+
`bundle outdated --strict --parseable`
|
25
27
|
end
|
26
28
|
|
27
29
|
def new_outdated_gem(line)
|
28
|
-
return unless
|
29
|
-
|
30
|
-
# clean & convert new & old output to same format
|
31
|
-
items = line.delete("*")
|
32
|
-
.gsub("(newest", "")
|
33
|
-
.gsub(", installed", " >")
|
34
|
-
.gsub(/([(),])/, "")
|
35
|
-
.split(" ")
|
36
|
-
|
37
|
-
# ["haml", "4.0.5", ">", "4.0.4"]
|
38
|
-
# ["a_forked_gem", "0.7.0", "99ddbc9", ">", "0.7.0", "1da2295"]
|
30
|
+
return unless match = BUNDLE_OUTDATED_PARSE_REGEX.match(line)
|
39
31
|
|
40
|
-
|
41
|
-
OutdatedGem.new(items[0], items[3], items[1])
|
32
|
+
OutdatedGem.new(match[1], match[2], match[3])
|
42
33
|
end
|
43
34
|
end
|
44
35
|
end
|
data/lib/gemdiff/cli.rb
CHANGED
@@ -34,9 +34,9 @@ module Gemdiff
|
|
34
34
|
find(gem_name).releases
|
35
35
|
end
|
36
36
|
|
37
|
-
desc "
|
38
|
-
def
|
39
|
-
find(gem_name).
|
37
|
+
desc "main <gem>", "Open the github main branch commits page for a gem"
|
38
|
+
def main(gem_name)
|
39
|
+
find(gem_name).main
|
40
40
|
end
|
41
41
|
|
42
42
|
desc "compare <gem> [<old> <new>]", <<~DESC
|
@@ -102,10 +102,11 @@ module Gemdiff
|
|
102
102
|
return
|
103
103
|
end
|
104
104
|
response = ask("\nCommit? (c to commit, r to reset, else do nothing)")
|
105
|
-
|
105
|
+
case response
|
106
|
+
when "c"
|
106
107
|
gem_updater.commit
|
107
|
-
puts "\n
|
108
|
-
|
108
|
+
puts "\n#{colorize_git_output(gem_updater.show)}"
|
109
|
+
when "r"
|
109
110
|
puts gem_updater.reset
|
110
111
|
end
|
111
112
|
end
|
data/lib/gemdiff/gem_updater.rb
CHANGED
data/lib/gemdiff/outdated_gem.rb
CHANGED
@@ -68,7 +68,7 @@ module Gemdiff
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def commits_url
|
71
|
-
clean_url "#{repo}/commits/
|
71
|
+
clean_url "#{repo}/commits/main"
|
72
72
|
end
|
73
73
|
|
74
74
|
def compare_message
|
@@ -79,7 +79,7 @@ module Gemdiff
|
|
79
79
|
clean_url "#{repo}/compare/#{compare_part}"
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def main
|
83
83
|
open_url(commits_url) if repo?
|
84
84
|
end
|
85
85
|
|
@@ -137,7 +137,7 @@ module Gemdiff
|
|
137
137
|
# swap versions if needed
|
138
138
|
def old_new(v_old, v_new)
|
139
139
|
return [v_old, v_new] unless v_old && v_new
|
140
|
-
if v_old == "
|
140
|
+
if v_old == "main" || (Gem::Version.new(v_old) > Gem::Version.new(v_new))
|
141
141
|
[v_new, v_old]
|
142
142
|
else
|
143
143
|
[v_old, v_new]
|
data/lib/gemdiff/repo_finder.rb
CHANGED
@@ -89,6 +89,16 @@ module Gemdiff
|
|
89
89
|
zeus: "burke/zeus",
|
90
90
|
}.freeze
|
91
91
|
|
92
|
+
PERMITTED_GEMSPEC_CLASSES =
|
93
|
+
%w[
|
94
|
+
Gem::Dependency
|
95
|
+
Gem::Requirement
|
96
|
+
Gem::Specification
|
97
|
+
Gem::Version
|
98
|
+
Symbol
|
99
|
+
Time
|
100
|
+
].freeze
|
101
|
+
|
92
102
|
class << self
|
93
103
|
# Try to get the homepage from the gemspec
|
94
104
|
# If not found, search github
|
@@ -104,7 +114,11 @@ module Gemdiff
|
|
104
114
|
end
|
105
115
|
yaml = gemspec(gem_name)
|
106
116
|
return if yaml.to_s.empty?
|
107
|
-
spec =
|
117
|
+
spec = if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0')
|
118
|
+
YAML.safe_load(yaml, permitted_classes: PERMITTED_GEMSPEC_CLASSES)
|
119
|
+
else
|
120
|
+
YAML.load(yaml)
|
121
|
+
end
|
108
122
|
return clean_url(spec.homepage) if spec.homepage =~ GITHUB_REPO_REGEX
|
109
123
|
match = spec.description.to_s.match(GITHUB_REPO_REGEX)
|
110
124
|
match && clean_url(match[0])
|
data/lib/gemdiff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tee Parham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '13.0'
|
97
97
|
description: Command-line utility to find source repositories for ruby gems, open
|
98
98
|
common GitHub pages, compare gem versions, and simplify gem update workflow in git.
|
99
99
|
email:
|
@@ -126,14 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 2.
|
129
|
+
version: 2.5.0
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - ">="
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.2.4
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Find source repositories for ruby gems. Open, compare, and update outdated
|