bundle-diff 1.0.0 → 1.1.0

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
2
  SHA256:
3
- metadata.gz: 7af036f2cd4684f51799698e381f5f9ff5d40fd76d47172b9bac1fd4ca4339de
4
- data.tar.gz: 50b58b894e8267b5337d30b6df8691eabd290736ebaa355321f6aaf69f3665a4
3
+ metadata.gz: 4ed4c76ee646c06c88b5bde31765fa22f76addd88db752b1dd7decfed3488658
4
+ data.tar.gz: 2137ebd6d32389f7359bf9866b1b5e172443d8d351c91fa91f1ed40b11de7e7d
5
5
  SHA512:
6
- metadata.gz: b4d5c9b321092b62643aa55b29b6e99da4a3cc4753aa86feb360a054288f5cd2c00bc035c6b559174238e7c267e401e20ea531c247e13dc99f5764b95d55592e
7
- data.tar.gz: c5415194316520f3163c51e6f9c5f308e70d501bccdbe500ba393b5c4f6d033c641256397440a6c1d593a3ddd95b9991259307b1abdc779df23378f0df39b40a
6
+ metadata.gz: adb81ab85d860f01b9d0b6d930343d0c619142d32c93e1b89ade252d49c05a4a223ef5d5f46aa840c13b499f7dc5afd958164b675337d736408e01a9d8cdb4d3
7
+ data.tar.gz: 589a6ebdd77a1922a2d130143c5f45bb275528c75189c55d621418e645556a9abf6870bf3552d5c7daa725937786cff3965e589c7104e0128b4a141b27c2e55e
@@ -0,0 +1,18 @@
1
+ # 1.1.0
2
+
3
+ * Added version option
4
+
5
+ Use the version option to diff against a specific gem version. For example:
6
+
7
+ $ bundle diff GEMNAME --version 1.2.3
8
+
9
+ The option accepts RubyGem version requirements. For example:
10
+
11
+ $ bundle diff GEMNAME --version '~> 2'
12
+
13
+ * Added help option
14
+
15
+
16
+ # 1.0.0
17
+
18
+ * First version!
data/README.md CHANGED
@@ -10,6 +10,6 @@ Bundler plugin for showing diffs of bundled gems against latest versions.
10
10
 
11
11
  ## Usage
12
12
 
13
- $ bundle diff GEM_NAME
13
+ $ bundle diff GEMNAME
14
14
 
15
15
  Tip: use `bundle outdated` to list installed gems with with newer versions available.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'bundle-diff'
3
- s.version = '1.0.0'
3
+ s.version = '1.1.0'
4
4
  s.license = 'GPL-3.0'
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.authors = ['Tim Craft']
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.homepage = 'https://github.com/readysteady/bundle-diff'
9
9
  s.description = 'Bundler plugin for showing diffs of bundled gems against latest versions'
10
10
  s.summary = 'See description'
11
- s.files = Dir.glob('lib/**/*.rb') + %w[LICENSE.txt README.md bundle-diff.gemspec]
11
+ s.files = Dir.glob('lib/**/*.rb') + %w[CHANGES.md LICENSE.txt README.md bundle-diff.gemspec]
12
12
  s.required_ruby_version = '>= 2.3.0'
13
13
  s.add_dependency('bundler', '>= 1.0', '< 3.0')
14
14
  s.require_path = 'lib'
@@ -1,6 +1,7 @@
1
1
  require 'bundler'
2
2
  require 'rubygems'
3
3
  require 'rubygems/package'
4
+ require 'optparse'
4
5
  require 'pathname'
5
6
  require 'tmpdir'
6
7
 
@@ -10,6 +11,8 @@ module Bundler::Diff::CLI
10
11
  def run(args=ARGV)
11
12
  Bundler.ui = Bundler::UI::Shell.new
12
13
 
14
+ args = option_parser.parse(args) unless args.empty?
15
+
13
16
  gem_name = args.first
14
17
 
15
18
  error('gem name required') unless gem_name
@@ -34,6 +37,28 @@ module Bundler::Diff::CLI
34
37
 
35
38
  private
36
39
 
40
+ def options
41
+ @options ||= {
42
+ version: Gem::Requirement.default
43
+ }
44
+ end
45
+
46
+ def option_parser
47
+ OptionParser.new do |opts|
48
+ opts.banner = 'Usage: bundle diff GEMNAME [options]'
49
+
50
+ opts.on '-h', '--help' do
51
+ puts "#{opts}\n"
52
+
53
+ Kernel::exit
54
+ end
55
+
56
+ opts.on '-v', '--version VERSION', 'Specify version of gem to diff against' do |value|
57
+ options[:version] = Gem::Requirement.new(value)
58
+ end
59
+ end
60
+ end
61
+
37
62
  def installed_specs
38
63
  @installed_specs ||= Bundler.load.specs.each_with_object({}) do |spec, hash|
39
64
  next if ignore?(spec)
@@ -51,8 +76,8 @@ module Bundler::Diff::CLI
51
76
  end
52
77
  end
53
78
 
54
- def fetch(name, target_dir, version: Gem::Requirement.default)
55
- dependency = Gem::Dependency.new(name, version)
79
+ def fetch(name, target_dir)
80
+ dependency = Gem::Dependency.new(name, options[:version])
56
81
 
57
82
  specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency(dependency)
58
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Craft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,7 @@ executables:
38
38
  extensions: []
39
39
  extra_rdoc_files: []
40
40
  files:
41
+ - CHANGES.md
41
42
  - LICENSE.txt
42
43
  - README.md
43
44
  - bin/bundler-diff