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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 276426b5d60d524b3a4d4f9ed9336611b27d7f0f62aad51e1fda70890e0a3986
4
- data.tar.gz: 81914e3e3450d20cb22b0e7c92998c28223771a7d8d28c7f566bb5eceb4e948a
3
+ metadata.gz: 8561d98525b5af6630489157667b734a6246b043f1b61aad0eb5520b59fa2151
4
+ data.tar.gz: d9ba487fb07a322ec4a00cbde23c3b85d9409131b47089008c7e8045f6260f64
5
5
  SHA512:
6
- metadata.gz: 978a8d3a447982f3c9cd41927ef61a86502bd7eec2fc9c22e4ab7866cca79c42924c10d87323e60e02cc9de066ed8737ee79eced4d8c696c5ffc9ac7757e4149
7
- data.tar.gz: a651dd788880067ca9607b0c71aa7c6b105b2095b2b350bd169f9b19fa88df2f62386bdd1514b20a306be470c100a3ad90c4b24cd4a1fba401c4afb85a0c9bbe
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
- [![Build Status](https://travis-ci.org/teeparham/gemdiff.svg?branch=master)](https://travis-ci.org/teeparham/gemdiff)
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 master
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 master [gem]`
189
+ ### `gemdiff main [gem]`
190
190
 
191
- Open the repository's master branch commit history page:
191
+ Open the repository's main branch commit history page:
192
192
 
193
193
  ```sh
194
- $ gemdiff master haml
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 master .
224
- gemdiff compare . 1.2.3 master
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/master/lib/gemdiff/outdated_gem.rb).
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/master/lib/gemdiff/repo_finder.rb).
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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
4
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
5
5
 
6
6
  # Exit cleanly from an early interrupt
7
7
  Signal.trap("INT") { exit 1 }
@@ -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 line.start_with?(" * ")
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
- return if items[3] == ">" # skip non-gems for now
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 "master <gem>", "Open the github master branch commits page for a gem"
38
- def master(gem_name)
39
- find(gem_name).master
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
- if response == "c"
105
+ case response
106
+ when "c"
106
107
  gem_updater.commit
107
- puts "\n" + colorize_git_output(gem_updater.show)
108
- elsif response == "r"
108
+ puts "\n#{colorize_git_output(gem_updater.show)}"
109
+ when "r"
109
110
  puts gem_updater.reset
110
111
  end
111
112
  end
@@ -49,7 +49,7 @@ module Gemdiff
49
49
  end
50
50
 
51
51
  def version(changed_line)
52
- changed_line.split("\n").first.split(" ").last.gsub(/[()]/, "")
52
+ changed_line.split("\n").first.split.last.gsub(/[()]/, "")
53
53
  end
54
54
 
55
55
  # example returns:
@@ -68,7 +68,7 @@ module Gemdiff
68
68
  end
69
69
 
70
70
  def commits_url
71
- clean_url "#{repo}/commits/master"
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 master
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 == "master" || (Gem::Version.new(v_old) > Gem::Version.new(v_new))
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]
@@ -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 = YAML.load(yaml)
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])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gemdiff
4
- VERSION = "3.0.0"
4
+ VERSION = "4.1.0"
5
5
  end
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: 3.0.0
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: 2019-05-24 00:00:00.000000000 Z
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.19'
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.19'
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: '12.0'
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: '12.0'
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.4.0
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.0.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