rubygems-update 2.6.7 → 2.6.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +11 -0
  3. data/Manifest.txt +10 -5
  4. data/bundler/CHANGELOG.md +108 -0
  5. data/bundler/DEVELOPMENT.md +6 -4
  6. data/bundler/ISSUES.md +17 -0
  7. data/bundler/README.md +2 -0
  8. data/bundler/exe/bundle +4 -6
  9. data/bundler/exe/bundle_ruby +2 -4
  10. data/bundler/exe/bundler +1 -19
  11. data/bundler/lib/bundler.rb +114 -44
  12. data/bundler/lib/bundler/cli.rb +90 -17
  13. data/bundler/lib/bundler/cli/binstubs.rb +4 -3
  14. data/bundler/lib/bundler/cli/cache.rb +1 -1
  15. data/bundler/lib/bundler/cli/check.rb +1 -1
  16. data/bundler/lib/bundler/cli/clean.rb +1 -1
  17. data/bundler/lib/bundler/cli/common.rb +13 -0
  18. data/bundler/lib/bundler/cli/console.rb +3 -0
  19. data/bundler/lib/bundler/cli/doctor.rb +93 -0
  20. data/bundler/lib/bundler/cli/exec.rb +18 -2
  21. data/bundler/lib/bundler/cli/gem.rb +3 -2
  22. data/bundler/lib/bundler/cli/inject.rb +25 -7
  23. data/bundler/lib/bundler/cli/install.rb +25 -7
  24. data/bundler/lib/bundler/cli/lock.rb +20 -7
  25. data/bundler/lib/bundler/cli/outdated.rb +97 -38
  26. data/bundler/lib/bundler/cli/platform.rb +1 -1
  27. data/bundler/lib/bundler/cli/show.rb +1 -1
  28. data/bundler/lib/bundler/cli/update.rb +9 -6
  29. data/bundler/lib/bundler/compact_index_client.rb +102 -0
  30. data/bundler/lib/bundler/compact_index_client/cache.rb +119 -0
  31. data/bundler/lib/bundler/compact_index_client/updater.rb +88 -0
  32. data/bundler/lib/bundler/current_ruby.rb +3 -3
  33. data/bundler/lib/bundler/definition.rb +210 -46
  34. data/bundler/lib/bundler/dependency.rb +1 -1
  35. data/bundler/lib/bundler/deployment.rb +6 -0
  36. data/bundler/lib/bundler/deprecate.rb +16 -0
  37. data/bundler/lib/bundler/dsl.rb +70 -24
  38. data/bundler/lib/bundler/endpoint_specification.rb +2 -0
  39. data/bundler/lib/bundler/env.rb +5 -1
  40. data/bundler/lib/bundler/environment_preserver.rb +1 -1
  41. data/bundler/lib/bundler/errors.rb +12 -1
  42. data/bundler/lib/bundler/feature_flag.rb +32 -0
  43. data/bundler/lib/bundler/fetcher.rb +3 -2
  44. data/bundler/lib/bundler/fetcher/base.rb +10 -0
  45. data/bundler/lib/bundler/fetcher/compact_index.rb +33 -12
  46. data/bundler/lib/bundler/fetcher/dependency.rb +2 -13
  47. data/bundler/lib/bundler/fetcher/downloader.rb +12 -1
  48. data/bundler/lib/bundler/friendly_errors.rb +9 -2
  49. data/bundler/lib/bundler/gem_helper.rb +3 -3
  50. data/bundler/lib/bundler/gem_helpers.rb +69 -1
  51. data/bundler/lib/bundler/gem_version_promoter.rb +175 -0
  52. data/bundler/lib/bundler/gemdeps.rb +28 -0
  53. data/bundler/lib/bundler/graph.rb +4 -25
  54. data/bundler/lib/bundler/index.rb +11 -2
  55. data/bundler/lib/bundler/injector.rb +12 -5
  56. data/bundler/lib/bundler/inline.rb +4 -4
  57. data/bundler/lib/bundler/installer.rb +25 -9
  58. data/bundler/lib/bundler/installer/gem_installer.rb +13 -15
  59. data/bundler/lib/bundler/installer/parallel_installer.rb +121 -99
  60. data/bundler/lib/bundler/lazy_specification.rb +28 -3
  61. data/bundler/lib/bundler/lockfile_parser.rb +27 -17
  62. data/bundler/lib/bundler/match_platform.rb +2 -1
  63. data/bundler/lib/bundler/mirror.rb +2 -2
  64. data/bundler/lib/bundler/plugin.rb +156 -32
  65. data/bundler/lib/bundler/plugin/api.rb +29 -5
  66. data/bundler/lib/bundler/plugin/api/source.rb +293 -0
  67. data/bundler/lib/bundler/plugin/dsl.rb +25 -1
  68. data/bundler/lib/bundler/plugin/index.rb +80 -13
  69. data/bundler/lib/bundler/plugin/installer.rb +6 -10
  70. data/bundler/lib/bundler/plugin/source_list.rb +4 -0
  71. data/bundler/lib/bundler/postit_trampoline.rb +56 -40
  72. data/bundler/lib/bundler/remote_specification.rb +5 -0
  73. data/bundler/lib/bundler/resolver.rb +64 -47
  74. data/bundler/lib/bundler/retry.rb +2 -1
  75. data/bundler/lib/bundler/ruby_version.rb +11 -4
  76. data/bundler/lib/bundler/rubygems_ext.rb +25 -3
  77. data/bundler/lib/bundler/rubygems_gem_installer.rb +54 -0
  78. data/bundler/lib/bundler/rubygems_integration.rb +148 -70
  79. data/bundler/lib/bundler/runtime.rb +27 -3
  80. data/bundler/lib/bundler/settings.rb +80 -17
  81. data/bundler/lib/bundler/setup.rb +7 -4
  82. data/bundler/lib/bundler/shared_helpers.rb +45 -8
  83. data/bundler/lib/bundler/source.rb +2 -1
  84. data/bundler/lib/bundler/source/gemspec.rb +4 -0
  85. data/bundler/lib/bundler/source/git.rb +9 -6
  86. data/bundler/lib/bundler/source/git/git_proxy.rb +37 -4
  87. data/bundler/lib/bundler/source/path.rb +10 -27
  88. data/bundler/lib/bundler/source/path/installer.rb +39 -11
  89. data/bundler/lib/bundler/source/rubygems.rb +3 -2
  90. data/bundler/lib/bundler/source_list.rb +28 -8
  91. data/bundler/lib/bundler/spec_set.rb +30 -15
  92. data/bundler/lib/bundler/templates/Executable.standalone +4 -2
  93. data/bundler/lib/bundler/templates/Gemfile +0 -1
  94. data/bundler/lib/bundler/templates/newgem/README.md.tt +1 -1
  95. data/bundler/lib/bundler/templates/newgem/bin/console.tt +1 -1
  96. data/bundler/lib/bundler/ui/shell.rb +25 -9
  97. data/bundler/lib/bundler/ui/silent.rb +10 -0
  98. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  99. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +8 -2
  100. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +5 -5
  101. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +3 -3
  102. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +1 -1
  103. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +1 -1
  104. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +4 -4
  105. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +2 -2
  106. data/bundler/lib/bundler/version.rb +1 -1
  107. data/bundler/lib/bundler/yaml_serializer.rb +34 -11
  108. data/bundler/man/bundle-binstubs.ronn +29 -0
  109. data/bundler/man/bundle-config.ronn +33 -1
  110. data/bundler/man/bundle-exec.ronn +9 -0
  111. data/bundler/man/bundle-install.ronn +6 -41
  112. data/bundler/man/bundle-package.ronn +1 -1
  113. data/bundler/man/bundle.ronn +9 -8
  114. data/bundler/man/gemfile.5.ronn +1 -1
  115. data/lib/rubygems.rb +1 -1
  116. data/lib/rubygems/dependency.rb +7 -4
  117. data/lib/rubygems/request.rb +46 -0
  118. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +7 -0
  119. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
  120. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
  121. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
  122. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
  123. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
  124. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
  125. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
  126. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
  127. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  128. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +11 -3
  129. data/test/rubygems/test_gem_request.rb +132 -0
  130. data/test/rubygems/test_gem_specification.rb +7 -0
  131. metadata +34 -29
  132. data/bundler/lib/bundler/environment.rb +0 -42
  133. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
  134. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -98
  135. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
  136. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
@@ -2,11 +2,13 @@
2
2
  module Bundler
3
3
  class SourceList
4
4
  attr_reader :path_sources,
5
- :git_sources
5
+ :git_sources,
6
+ :plugin_sources
6
7
 
7
8
  def initialize
8
9
  @path_sources = []
9
10
  @git_sources = []
11
+ @plugin_sources = []
10
12
  @rubygems_aggregate = Source::Rubygems.new
11
13
  @rubygems_sources = []
12
14
  end
@@ -20,13 +22,19 @@ module Bundler
20
22
  end
21
23
 
22
24
  def add_git_source(options = {})
23
- add_source_to_list Source::Git.new(options), git_sources
25
+ add_source_to_list(Source::Git.new(options), git_sources).tap do |source|
26
+ warn_on_git_protocol(source)
27
+ end
24
28
  end
25
29
 
26
30
  def add_rubygems_source(options = {})
27
31
  add_source_to_list Source::Rubygems.new(options), @rubygems_sources
28
32
  end
29
33
 
34
+ def add_plugin_source(source, options = {})
35
+ add_source_to_list Plugin.source(source).new(options), @plugin_sources
36
+ end
37
+
30
38
  def add_rubygems_remote(uri)
31
39
  @rubygems_aggregate.add_remote(uri)
32
40
  @rubygems_aggregate
@@ -41,7 +49,7 @@ module Bundler
41
49
  end
42
50
 
43
51
  def all_sources
44
- path_sources + git_sources + rubygems_sources
52
+ path_sources + git_sources + plugin_sources + rubygems_sources
45
53
  end
46
54
 
47
55
  def get(source)
@@ -49,14 +57,14 @@ module Bundler
49
57
  end
50
58
 
51
59
  def lock_sources
52
- lock_sources = (path_sources + git_sources).sort_by(&:to_s)
60
+ lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
53
61
  lock_sources << combine_rubygems_sources
54
62
  end
55
63
 
56
64
  def replace_sources!(replacement_sources)
57
65
  return true if replacement_sources.empty?
58
66
 
59
- [path_sources, git_sources].each do |source_list|
67
+ [path_sources, git_sources, plugin_sources].each do |source_list|
60
68
  source_list.map! do |source|
61
69
  replacement_sources.find {|s| s == source } || source
62
70
  end
@@ -92,9 +100,10 @@ module Bundler
92
100
 
93
101
  def source_list_for(source)
94
102
  case source
95
- when Source::Git then git_sources
96
- when Source::Path then path_sources
97
- when Source::Rubygems then rubygems_sources
103
+ when Source::Git then git_sources
104
+ when Source::Path then path_sources
105
+ when Source::Rubygems then rubygems_sources
106
+ when Plugin::API::Source then plugin_sources
98
107
  else raise ArgumentError, "Invalid source: #{source.inspect}"
99
108
  end
100
109
  end
@@ -102,5 +111,16 @@ module Bundler
102
111
  def combine_rubygems_sources
103
112
  Source::Rubygems.new("remotes" => rubygems_remotes)
104
113
  end
114
+
115
+ def warn_on_git_protocol(source)
116
+ return if Bundler.settings["git.allow_insecure"]
117
+
118
+ if source.uri =~ /^git\:/
119
+ Bundler.ui.warn "The git source `#{source.uri}` uses the `git` protocol, " \
120
+ "which transmits data without encryption. Disable this warning with " \
121
+ "`bundle config git.allow_insecure true`, or switch to the `https` " \
122
+ "protocol to keep your data secure."
123
+ end
124
+ end
105
125
  end
106
126
  end
@@ -7,7 +7,7 @@ module Bundler
7
7
  extend Forwardable
8
8
  include TSort, Enumerable
9
9
 
10
- def_delegators :@specs, :<<, :length, :add, :remove, :size
10
+ def_delegators :@specs, :<<, :length, :add, :remove, :size, :empty?
11
11
  def_delegators :sorted, :each
12
12
 
13
13
  def initialize(specs)
@@ -18,23 +18,15 @@ module Bundler
18
18
  handled = {}
19
19
  deps = dependencies.dup
20
20
  specs = []
21
- skip << "bundler"
21
+ skip += ["bundler"]
22
22
 
23
23
  until deps.empty?
24
24
  dep = deps.shift
25
25
  next if handled[dep] || skip.include?(dep.name)
26
26
 
27
- spec = lookup[dep.name].find do |s|
28
- if match_current_platform
29
- Gem::Platform.match(s.platform)
30
- else
31
- s.match_platform(dep.__platform)
32
- end
33
- end
34
-
35
27
  handled[dep] = true
36
28
 
37
- if spec
29
+ if spec = spec_for_dependency(dep, match_current_platform)
38
30
  specs << spec
39
31
 
40
32
  spec.dependencies.each do |d|
@@ -99,6 +91,20 @@ module Bundler
99
91
  SpecSet.new(materialized.compact)
100
92
  end
101
93
 
94
+ # Materialize for all the specs in the spec set, regardless of what platform they're for
95
+ # This is in contrast to how for does platform filtering (and specifically different from how `materialize` calls `for` only for the current platform)
96
+ # @return [Array<Gem::Specification>]
97
+ def materialized_for_all_platforms
98
+ names = @specs.map(&:name).uniq
99
+ @specs.map do |s|
100
+ next s unless s.is_a?(LazySpecification)
101
+ s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
102
+ spec = s.__materialize__
103
+ raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
104
+ spec
105
+ end
106
+ end
107
+
102
108
  def merge(set)
103
109
  arr = sorted.dup
104
110
  set.each do |s|
@@ -133,10 +139,7 @@ module Bundler
133
139
  def lookup
134
140
  @lookup ||= begin
135
141
  lookup = Hash.new {|h, k| h[k] = [] }
136
- specs = @specs.sort_by do |s|
137
- s.platform.to_s == "ruby" ? "\0" : s.platform.to_s
138
- end
139
- specs.reverse_each do |s|
142
+ Index.sort_specs(@specs).reverse_each do |s|
140
143
  lookup[s.name] << s
141
144
  end
142
145
  lookup
@@ -147,6 +150,18 @@ module Bundler
147
150
  @specs.each {|s| yield s }
148
151
  end
149
152
 
153
+ def spec_for_dependency(dep, match_current_platform)
154
+ if match_current_platform
155
+ Bundler.rubygems.platforms.reverse_each do |pl|
156
+ match = GemHelpers.select_best_platform_match(lookup[dep.name], pl)
157
+ return match if match
158
+ end
159
+ nil
160
+ else
161
+ GemHelpers.select_best_platform_match(lookup[dep.name], dep.__platform)
162
+ end
163
+ end
164
+
150
165
  def tsort_each_child(s)
151
166
  s.dependencies.sort_by(&:name).each do |d|
152
167
  next if d.type == :development
@@ -6,7 +6,9 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- $:.unshift File.expand_path '../<%= standalone_path %>', __FILE__
9
+ require 'pathname'
10
+ path = Pathname.new(__FILE__)
11
+ $:.unshift File.expand_path '../<%= standalone_path %>', path.realpath
10
12
 
11
13
  require 'bundler/setup'
12
- load File.expand_path '../<%= executable_path %>', __FILE__
14
+ load File.expand_path '../<%= executable_path %>', path.realpath
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
- # A sample Gemfile
3
2
  source "https://rubygems.org"
4
3
 
5
4
  # gem "rails"
@@ -32,7 +32,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %>
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:git_user_name] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %>
36
36
  <% if config[:mit] %>
37
37
 
38
38
  ## License
@@ -11,4 +11,4 @@ require "<%= config[:namespaced_path] %>"
11
11
  # Pry.start
12
12
 
13
13
  require "irb"
14
- IRB.start
14
+ IRB.start(__FILE__)
@@ -17,8 +17,8 @@ module Bundler
17
17
  @warning_history = []
18
18
  end
19
19
 
20
- def add_color(string, color)
21
- @shell.set_color(string, color)
20
+ def add_color(string, *color)
21
+ @shell.set_color(string, *color)
22
22
  end
23
23
 
24
24
  def info(msg, newline = nil)
@@ -45,7 +45,7 @@ module Bundler
45
45
 
46
46
  def debug?
47
47
  # needs to be false instead of nil to be newline param to other methods
48
- level("debug")
48
+ level("debug") ? true : false
49
49
  end
50
50
 
51
51
  def quiet?
@@ -79,12 +79,12 @@ module Bundler
79
79
  tell_me(msg, nil, newline)
80
80
  end
81
81
 
82
- def silence
83
- old_level = @level
84
- @level = "silent"
85
- yield
86
- ensure
87
- @level = old_level
82
+ def silence(&blk)
83
+ with_level("silent", &blk)
84
+ end
85
+
86
+ def unprinted_warnings
87
+ []
88
88
  end
89
89
 
90
90
  private
@@ -99,6 +99,14 @@ module Bundler
99
99
  end
100
100
  end
101
101
 
102
+ def tell_err(message, color = nil, newline = nil)
103
+ buffer = @shell.send(:prepare_message, message, *color)
104
+ buffer << "\n" if newline && !message.to_s.end_with?("\n")
105
+
106
+ @shell.send(:stderr).print(buffer)
107
+ @shell.send(:stderr).flush
108
+ end
109
+
102
110
  def strip_leading_spaces(text)
103
111
  spaces = text[/\A\s+/, 0]
104
112
  spaces ? text.gsub(/#{spaces}/, "") : text
@@ -109,6 +117,14 @@ module Bundler
109
117
  line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line
110
118
  end * "\n"
111
119
  end
120
+
121
+ def with_level(level)
122
+ original = @level
123
+ @level = level
124
+ yield
125
+ ensure
126
+ @level = original
127
+ end
112
128
  end
113
129
  end
114
130
  end
@@ -2,7 +2,12 @@
2
2
  module Bundler
3
3
  module UI
4
4
  class Silent
5
+ def initialize
6
+ @warnings = []
7
+ end
8
+
5
9
  def add_color(string, color)
10
+ string
6
11
  end
7
12
 
8
13
  def info(message, newline = nil)
@@ -12,6 +17,7 @@ module Bundler
12
17
  end
13
18
 
14
19
  def warn(message, newline = nil)
20
+ @warnings |= [message]
15
21
  end
16
22
 
17
23
  def error(message, newline = nil)
@@ -43,6 +49,10 @@ module Bundler
43
49
  def silence
44
50
  yield
45
51
  end
52
+
53
+ def unprinted_warnings
54
+ @warnings
55
+ end
46
56
  end
47
57
  end
48
58
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Bundler::Molinillo
3
3
  # The version of Bundler::Molinillo.
4
- VERSION = '0.5.0'.freeze
4
+ VERSION = '0.5.1'.freeze
5
5
  end
@@ -184,6 +184,8 @@ module Bundler::Molinillo
184
184
  raise VersionConflict.new(c) unless state
185
185
  activated.rewind_to(sliced_states.first || :initial_state) if sliced_states
186
186
  state.conflicts = c
187
+ index = states.size - 1
188
+ @parent_of.reject! { |_, i| i >= index }
187
189
  end
188
190
  end
189
191
 
@@ -209,7 +211,10 @@ module Bundler::Molinillo
209
211
  # @return [Object] the requirement that led to `requirement` being added
210
212
  # to the list of requirements.
211
213
  def parent_of(requirement)
212
- @parent_of[requirement]
214
+ return unless requirement
215
+ return unless index = @parent_of[requirement]
216
+ return unless parent_state = @states[index]
217
+ parent_state.requirement
213
218
  end
214
219
 
215
220
  # @return [Object] the requirement that led to a version of a possibility
@@ -418,7 +423,8 @@ module Bundler::Molinillo
418
423
  debug(depth) { "Requiring nested dependencies (#{nested_dependencies.join(', ')})" }
419
424
  nested_dependencies.each do |d|
420
425
  activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d)
421
- @parent_of[d] = requirement
426
+ parent_index = states.size - 1
427
+ @parent_of[d] ||= parent_index
422
428
  end
423
429
 
424
430
  push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)
@@ -1,10 +1,10 @@
1
- require 'postit/environment'
2
- require 'postit/installer'
3
- require 'postit/parser'
4
- require 'postit/version'
1
+ require 'bundler/vendor/postit/lib/postit/environment'
2
+ require 'bundler/vendor/postit/lib/postit/installer'
3
+ require 'bundler/vendor/postit/lib/postit/parser'
4
+ require 'bundler/vendor/postit/lib/postit/version'
5
5
  require 'rubygems'
6
6
 
7
- module BundlerVendoredPostIt
7
+ module BundlerVendoredPostIt::PostIt
8
8
  def self.setup
9
9
  load File.expand_path('../postit/setup.rb', __FILE__)
10
10
  end
@@ -1,6 +1,6 @@
1
- require 'postit/parser'
1
+ require 'bundler/vendor/postit/lib/postit/parser'
2
2
 
3
- module BundlerVendoredPostIt
3
+ module BundlerVendoredPostIt::PostIt
4
4
  class Environment
5
5
  def initialize(argv)
6
6
  @argv = argv
@@ -31,7 +31,7 @@ module BundlerVendoredPostIt
31
31
  end
32
32
 
33
33
  def lockfile_version
34
- BundlerVendoredPostIt::Parser.new(lockfile).parse
34
+ BundlerVendoredPostIt::PostIt::Parser.new(lockfile).parse
35
35
  end
36
36
 
37
37
  def bundler_version
@@ -1,4 +1,4 @@
1
- module BundlerVendoredPostIt
1
+ module BundlerVendoredPostIt::PostIt
2
2
  class Installer
3
3
  def initialize(bundler_version)
4
4
  @bundler_version = bundler_version
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
- module BundlerVendoredPostIt
3
+ module BundlerVendoredPostIt::PostIt
4
4
  class Parser
5
5
  def initialize(file)
6
6
  @file = file
@@ -1,10 +1,10 @@
1
- require 'postit/environment'
2
- require 'postit/installer'
1
+ require 'bundler/vendor/postit/lib/postit/environment'
2
+ require 'bundler/vendor/postit/lib/postit/installer'
3
3
 
4
- environment = BundlerVendoredPostIt::Environment.new(ARGV)
4
+ environment = BundlerVendoredPostIt::PostIt::Environment.new(ARGV)
5
5
  version = environment.bundler_version
6
6
 
7
- installer = BundlerVendoredPostIt::Installer.new(version)
7
+ installer = BundlerVendoredPostIt::PostIt::Installer.new(version)
8
8
  installer.install!
9
9
 
10
10
  gem 'bundler', version
@@ -1,3 +1,3 @@
1
- module BundlerVendoredPostIt
2
- VERSION = '0.1.2'.freeze
1
+ module BundlerVendoredPostIt::PostIt
2
+ VERSION = '0.2.0'.freeze
3
3
  end
@@ -7,5 +7,5 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.13.0.pre.1" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.13.6" unless defined?(::Bundler::VERSION)
11
11
  end
@@ -16,6 +16,8 @@ module Bundler
16
16
  yaml << k << ":"
17
17
  if v.is_a?(Hash)
18
18
  yaml << dump_hash(v).gsub(/^(?!$)/, " ") # indent all non-empty lines
19
+ elsif v.is_a?(Array) # Expected to be array of strings
20
+ yaml << "\n- " << v.map {|s| s.to_s.gsub(/\s+/, " ").inspect }.join("\n- ") << "\n"
19
21
  else
20
22
  yaml << " " << v.to_s.gsub(/\s+/, " ").inspect << "\n"
21
23
  end
@@ -23,11 +25,20 @@ module Bundler
23
25
  yaml
24
26
  end
25
27
 
26
- SCAN_REGEX = /
28
+ ARRAY_REGEX = /
29
+ ^
30
+ (?:[ ]*-[ ]) # '- ' before array items
31
+ (['"]?) # optional opening quote
32
+ (.*) # value
33
+ \1 # matching closing quote
34
+ $
35
+ /xo
36
+
37
+ HASH_REGEX = /
27
38
  ^
28
39
  ([ ]*) # indentations
29
40
  (.*) # key
30
- (?::(?=\s)) # : (without the lookahead the #key includes this when : is present in value)
41
+ (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
31
42
  [ ]?
32
43
  (?: !\s)? # optional exclamation mark found with ruby 1.9.3
33
44
  (['"]?) # optional opening quote
@@ -39,15 +50,27 @@ module Bundler
39
50
  def load(str)
40
51
  res = {}
41
52
  stack = [res]
42
- str.scan(SCAN_REGEX).each do |(indent, key, _, val)|
43
- key = convert_to_backward_compatible_key(key)
44
- depth = indent.scan(/ /).length
45
- if val.empty?
46
- new_hash = {}
47
- stack[depth][key] = new_hash
48
- stack[depth + 1] = new_hash
49
- else
50
- stack[depth][key] = val
53
+ last_hash = nil
54
+ last_empty_key = nil
55
+ str.split(/\r?\n/).each do |line|
56
+ if match = HASH_REGEX.match(line)
57
+ indent, key, _, val = match.captures
58
+ key = convert_to_backward_compatible_key(key)
59
+ depth = indent.scan(/ /).length
60
+ if val.empty?
61
+ new_hash = {}
62
+ stack[depth][key] = new_hash
63
+ stack[depth + 1] = new_hash
64
+ last_empty_key = key
65
+ last_hash = stack[depth]
66
+ else
67
+ stack[depth][key] = val
68
+ end
69
+ elsif match = ARRAY_REGEX.match(line)
70
+ _, val = match.captures
71
+ last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
72
+
73
+ last_hash[last_empty_key].push(val)
51
74
  end
52
75
  end
53
76
  res