bundler-patch 1.1.0.pre2 → 1.1.0.pre3

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
  SHA1:
3
- metadata.gz: 7e15e29ba6d792404c4675f7f0a9feb02675cdea
4
- data.tar.gz: ea0d23abcdc4859e441ed3a378bde6858187bf75
3
+ metadata.gz: 67617245f2ccb603b4e769123cfeca8c1651b7ed
4
+ data.tar.gz: '0318430c3f11b8a769bba339aeebb869e94fe3e2'
5
5
  SHA512:
6
- metadata.gz: e9ff099ef9e01ef481be0b67ca8eb4e0e9d78a7d9cbfd7d907fa063122428e5050c53684d8a9b4856efad5c2271d74e8a6e75155007ecdd91c45d18576094409
7
- data.tar.gz: a2399d339c85e883ed238eea4fb741daa97a7b7da0fdbac578d3e1761264543c7383e5d59cf1ae1aed0e1eba0cf84cbce1816f0c10687e5cba6d4136b0ebaf6c
6
+ metadata.gz: 47a5029a627739791d69d9e5ea8b4098ed7339b44501c438158d7402ff40e8a972e07578d5182b9fc30b16a3db9dd8d0f6c4cb11d0c3963492546189ab846d2f
7
+ data.tar.gz: a1f27bc6462f64e0d7ba846e507e0bf24212b3f5180ed78ada81af96a98613d479ed1b7b8a76e627631d850b343f98ab825af84f77a23b836c3777b0f0a74368
@@ -13,5 +13,6 @@ require 'bundler/patch/advisory_consolidator'
13
13
  require 'bundler/patch/conservative_definition'
14
14
  require 'bundler/patch/conservative_resolver'
15
15
  require 'bundler/patch/gems_to_patch_reconciler'
16
+ require 'bundler/patch/cli_options'
16
17
  require 'bundler/patch/cli'
17
18
  require 'bundler/patch/version'
@@ -63,9 +63,7 @@ module Bundler::Patch
63
63
  def patch(options={})
64
64
  Bundler.ui = Bundler::UI::Shell.new
65
65
 
66
- normalize_options(options)
67
-
68
- process_gemfile_option(options)
66
+ options = Bundler::Patch::CLI::Options.new.normalize_options(options)
69
67
 
70
68
  if options[:use_target_ruby] # TODO: && different_ruby_found
71
69
  tb = options[:target]
@@ -84,32 +82,8 @@ module Bundler::Patch
84
82
  end
85
83
  end
86
84
 
87
- def normalize_options(options)
88
- map = {:prefer_minimal => :minimal, :strict_updates => :strict, :minor_preferred => :minor}
89
- {}.tap do |target|
90
- options.each_pair do |k, v|
91
- new_key = k.to_s.gsub('-', '_').to_sym
92
- new_key = map[new_key] || new_key
93
- target[new_key] = v
94
- end
95
- end
96
- end
97
-
98
85
  private
99
86
 
100
- def process_gemfile_option(options)
101
- # copy/pasta from Bundler
102
- custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
103
- if custom_gemfile && !custom_gemfile.empty?
104
- ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile)
105
- dir, gemfile = [File.dirname(custom_gemfile), File.basename(custom_gemfile)]
106
- target_bundle = TargetBundle.new(dir: dir, gemfile: gemfile)
107
- options[:target] = target_bundle
108
- else
109
- options[:target] = TargetBundle.new
110
- end
111
- end
112
-
113
87
  def list(options)
114
88
  gem_patches = AdvisoryConsolidator.new(options).vulnerable_gems
115
89
 
@@ -0,0 +1,33 @@
1
+ module Bundler::Patch
2
+ class CLI
3
+ class Options
4
+ def normalize_options(options)
5
+ map = {:prefer_minimal => :minimal, :strict_updates => :strict, :minor_preferred => :minor}
6
+ {}.tap do |target|
7
+ options.each_pair do |k, v|
8
+ new_key = k.to_s.gsub('-', '_').to_sym
9
+ new_key = map[new_key] || new_key
10
+ target[new_key] = v
11
+ end
12
+ process_gemfile_option(target)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def process_gemfile_option(options)
19
+ # copy/pasta from Bundler
20
+ custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
21
+ if custom_gemfile && !custom_gemfile.empty?
22
+ custom_gemfile = File.join(custom_gemfile, TargetBundle.default_gemfile) if File.directory?(custom_gemfile)
23
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile)
24
+ dir, gemfile = [File.dirname(custom_gemfile), File.basename(custom_gemfile)]
25
+ target_bundle = TargetBundle.new(dir: dir, gemfile: gemfile)
26
+ options[:target] = target_bundle
27
+ else
28
+ options[:target] = TargetBundle.new
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -9,8 +9,12 @@ class TargetBundle
9
9
  Gem::Version.new(a) >= Gem::Version.new(b)
10
10
  end
11
11
 
12
- # TODO: Make gems.rb default in Bundler 2.0.
13
- def initialize(dir: Dir.pwd, gemfile: 'Gemfile')
12
+ def self.default_gemfile
13
+ # TODO: Make gems.rb default in Bundler 2.0.
14
+ 'Gemfile'
15
+ end
16
+
17
+ def initialize(dir: Dir.pwd, gemfile: TargetBundle.default_gemfile)
14
18
  @dir = dir
15
19
  @gemfile = gemfile
16
20
  end
@@ -28,7 +32,7 @@ class TargetBundle
28
32
  end
29
33
 
30
34
  result ||= if File.exist?(ruby_version_filename)
31
- File.read('.ruby-version').chomp
35
+ File.read(File.join(@dir, '.ruby-version')).chomp
32
36
  else
33
37
  Bundler::Definition.build(gemfile_name, lockfile_name, nil).ruby_version
34
38
  end
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Patch
3
- VERSION = '1.1.0.pre2'
3
+ VERSION = '1.1.0.pre3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.pre2
4
+ version: 1.1.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrismo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-advise
@@ -137,6 +137,7 @@ files:
137
137
  - lib/bundler/patch.rb
138
138
  - lib/bundler/patch/advisory_consolidator.rb
139
139
  - lib/bundler/patch/cli.rb
140
+ - lib/bundler/patch/cli_options.rb
140
141
  - lib/bundler/patch/conservative_definition.rb
141
142
  - lib/bundler/patch/conservative_resolver.rb
142
143
  - lib/bundler/patch/gem_version_patch_promoter.rb