rubygems-update 2.6.4 → 2.6.5

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 (288) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +18 -24
  3. data/CODE_OF_CONDUCT.md +2 -2
  4. data/CONTRIBUTING.rdoc +1 -1
  5. data/History.txt +30 -1
  6. data/Manifest.txt +233 -3
  7. data/Rakefile +30 -1
  8. data/appveyor.yml +0 -2
  9. data/bundler/CHANGELOG.md +2407 -0
  10. data/bundler/CODE_OF_CONDUCT.md +42 -0
  11. data/bundler/CONTRIBUTING.md +36 -0
  12. data/bundler/DEVELOPMENT.md +148 -0
  13. data/bundler/ISSUES.md +100 -0
  14. data/bundler/LICENSE.md +23 -0
  15. data/bundler/README.md +40 -0
  16. data/bundler/exe/bundle +35 -0
  17. data/bundler/exe/bundle_ruby +61 -0
  18. data/bundler/exe/bundler +22 -0
  19. data/bundler/lib/bundler.rb +455 -0
  20. data/bundler/lib/bundler/capistrano.rb +17 -0
  21. data/bundler/lib/bundler/cli.rb +497 -0
  22. data/bundler/lib/bundler/cli/binstubs.rb +40 -0
  23. data/bundler/lib/bundler/cli/cache.rb +35 -0
  24. data/bundler/lib/bundler/cli/check.rb +40 -0
  25. data/bundler/lib/bundler/cli/clean.rb +26 -0
  26. data/bundler/lib/bundler/cli/common.rb +56 -0
  27. data/bundler/lib/bundler/cli/config.rb +100 -0
  28. data/bundler/lib/bundler/cli/console.rb +39 -0
  29. data/bundler/lib/bundler/cli/exec.rb +82 -0
  30. data/bundler/lib/bundler/cli/gem.rb +214 -0
  31. data/bundler/lib/bundler/cli/init.rb +33 -0
  32. data/bundler/lib/bundler/cli/inject.rb +33 -0
  33. data/bundler/lib/bundler/cli/install.rb +225 -0
  34. data/bundler/lib/bundler/cli/lock.rb +48 -0
  35. data/bundler/lib/bundler/cli/open.rb +25 -0
  36. data/bundler/lib/bundler/cli/outdated.rb +151 -0
  37. data/bundler/lib/bundler/cli/package.rb +46 -0
  38. data/bundler/lib/bundler/cli/platform.rb +45 -0
  39. data/bundler/lib/bundler/cli/plugin.rb +23 -0
  40. data/bundler/lib/bundler/cli/show.rb +75 -0
  41. data/bundler/lib/bundler/cli/update.rb +72 -0
  42. data/bundler/lib/bundler/cli/viz.rb +27 -0
  43. data/bundler/lib/bundler/constants.rb +6 -0
  44. data/bundler/lib/bundler/current_ruby.rb +84 -0
  45. data/bundler/lib/bundler/definition.rb +744 -0
  46. data/bundler/lib/bundler/dep_proxy.rb +46 -0
  47. data/bundler/lib/bundler/dependency.rb +127 -0
  48. data/bundler/lib/bundler/deployment.rb +63 -0
  49. data/bundler/lib/bundler/deprecate.rb +16 -0
  50. data/bundler/lib/bundler/dsl.rb +512 -0
  51. data/bundler/lib/bundler/endpoint_specification.rb +129 -0
  52. data/bundler/lib/bundler/env.rb +83 -0
  53. data/bundler/lib/bundler/environment.rb +42 -0
  54. data/bundler/lib/bundler/environment_preserver.rb +38 -0
  55. data/bundler/lib/bundler/errors.rb +124 -0
  56. data/bundler/lib/bundler/fetcher.rb +304 -0
  57. data/bundler/lib/bundler/fetcher/base.rb +41 -0
  58. data/bundler/lib/bundler/fetcher/compact_index.rb +103 -0
  59. data/bundler/lib/bundler/fetcher/dependency.rb +92 -0
  60. data/bundler/lib/bundler/fetcher/downloader.rb +66 -0
  61. data/bundler/lib/bundler/fetcher/index.rb +51 -0
  62. data/bundler/lib/bundler/friendly_errors.rb +103 -0
  63. data/bundler/lib/bundler/gem_helper.rb +188 -0
  64. data/bundler/lib/bundler/gem_helpers.rb +32 -0
  65. data/bundler/lib/bundler/gem_remote_fetcher.rb +42 -0
  66. data/bundler/lib/bundler/gem_tasks.rb +6 -0
  67. data/bundler/lib/bundler/graph.rb +172 -0
  68. data/bundler/lib/bundler/index.rb +191 -0
  69. data/bundler/lib/bundler/injector.rb +63 -0
  70. data/bundler/lib/bundler/inline.rb +74 -0
  71. data/bundler/lib/bundler/installer.rb +217 -0
  72. data/bundler/lib/bundler/installer/gem_installer.rb +77 -0
  73. data/bundler/lib/bundler/installer/parallel_installer.rb +126 -0
  74. data/bundler/lib/bundler/installer/standalone.rb +52 -0
  75. data/bundler/lib/bundler/lazy_specification.rb +85 -0
  76. data/bundler/lib/bundler/lockfile_parser.rb +233 -0
  77. data/bundler/lib/bundler/match_platform.rb +14 -0
  78. data/bundler/lib/bundler/mirror.rb +218 -0
  79. data/bundler/lib/bundler/plugin.rb +156 -0
  80. data/bundler/lib/bundler/plugin/api.rb +56 -0
  81. data/bundler/lib/bundler/plugin/dsl.rb +29 -0
  82. data/bundler/lib/bundler/plugin/index.rb +88 -0
  83. data/bundler/lib/bundler/plugin/installer.rb +99 -0
  84. data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
  85. data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
  86. data/bundler/lib/bundler/plugin/source_list.rb +24 -0
  87. data/bundler/lib/bundler/postit_trampoline.rb +57 -0
  88. data/bundler/lib/bundler/psyched_yaml.rb +27 -0
  89. data/bundler/lib/bundler/remote_specification.rb +85 -0
  90. data/bundler/lib/bundler/resolver.rb +368 -0
  91. data/bundler/lib/bundler/retry.rb +61 -0
  92. data/bundler/lib/bundler/ruby_dsl.rb +17 -0
  93. data/bundler/lib/bundler/ruby_version.rb +140 -0
  94. data/bundler/lib/bundler/rubygems_ext.rb +178 -0
  95. data/bundler/lib/bundler/rubygems_gem_installer.rb +10 -0
  96. data/bundler/lib/bundler/rubygems_integration.rb +710 -0
  97. data/bundler/lib/bundler/runtime.rb +282 -0
  98. data/bundler/lib/bundler/settings.rb +259 -0
  99. data/bundler/lib/bundler/setup.rb +28 -0
  100. data/bundler/lib/bundler/shared_helpers.rb +212 -0
  101. data/bundler/lib/bundler/similarity_detector.rb +62 -0
  102. data/bundler/lib/bundler/source.rb +37 -0
  103. data/bundler/lib/bundler/source/gemspec.rb +13 -0
  104. data/bundler/lib/bundler/source/git.rb +297 -0
  105. data/bundler/lib/bundler/source/git/git_proxy.rb +218 -0
  106. data/bundler/lib/bundler/source/path.rb +245 -0
  107. data/bundler/lib/bundler/source/path/installer.rb +44 -0
  108. data/bundler/lib/bundler/source/rubygems.rb +450 -0
  109. data/bundler/lib/bundler/source/rubygems/remote.rb +59 -0
  110. data/bundler/lib/bundler/source_list.rb +106 -0
  111. data/bundler/lib/bundler/spec_set.rb +157 -0
  112. data/bundler/lib/bundler/ssl_certs/.document +1 -0
  113. data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +65 -0
  114. data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  115. data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
  116. data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
  117. data/bundler/lib/bundler/stub_specification.rb +24 -0
  118. data/bundler/lib/bundler/templates/Executable +17 -0
  119. data/bundler/lib/bundler/templates/Executable.standalone +12 -0
  120. data/bundler/lib/bundler/templates/Gemfile +5 -0
  121. data/bundler/lib/bundler/templates/newgem/.travis.yml.tt +5 -0
  122. data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
  123. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  124. data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  125. data/bundler/lib/bundler/templates/newgem/README.md.tt +41 -0
  126. data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
  127. data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
  128. data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  129. data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  130. data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  131. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  132. data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  133. data/bundler/lib/bundler/templates/newgem/gitignore.tt +16 -0
  134. data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  135. data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  136. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +46 -0
  137. data/bundler/lib/bundler/templates/newgem/rspec.tt +2 -0
  138. data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  139. data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  140. data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
  141. data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
  142. data/bundler/lib/bundler/ui.rb +8 -0
  143. data/bundler/lib/bundler/ui/rg_proxy.rb +18 -0
  144. data/bundler/lib/bundler/ui/shell.rb +114 -0
  145. data/bundler/lib/bundler/ui/silent.rb +48 -0
  146. data/bundler/lib/bundler/uri_credentials_filter.rb +36 -0
  147. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +79 -0
  148. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +98 -0
  149. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +80 -0
  150. data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +4 -0
  151. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +10 -0
  152. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  153. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  154. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +203 -0
  155. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  156. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  157. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  158. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  159. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  160. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  161. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  162. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  163. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -0
  164. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +5 -0
  165. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +100 -0
  166. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +65 -0
  167. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +460 -0
  168. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +45 -0
  169. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +54 -0
  170. data/bundler/lib/bundler/vendor/net/http/faster.rb +26 -0
  171. data/bundler/lib/bundler/vendor/net/http/persistent.rb +1230 -0
  172. data/bundler/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
  173. data/bundler/lib/bundler/vendor/postit/lib/postit.rb +15 -0
  174. data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
  175. data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
  176. data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
  177. data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
  178. data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
  179. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +484 -0
  180. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
  181. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  182. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  183. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
  184. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  185. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
  186. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
  187. data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
  188. data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
  189. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  190. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
  191. data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
  192. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
  193. data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  194. data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
  195. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  196. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  197. data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  198. data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  199. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
  200. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  201. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
  202. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
  203. data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
  204. data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
  205. data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  206. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
  207. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
  208. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
  209. data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
  210. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  211. data/bundler/lib/bundler/vendored_molinillo.rb +3 -0
  212. data/bundler/lib/bundler/vendored_persistent.rb +12 -0
  213. data/bundler/lib/bundler/vendored_thor.rb +4 -0
  214. data/bundler/lib/bundler/version.rb +11 -0
  215. data/bundler/lib/bundler/vlad.rb +12 -0
  216. data/bundler/lib/bundler/worker.rb +82 -0
  217. data/bundler/lib/bundler/yaml_serializer.rb +67 -0
  218. data/bundler/man/bundle-config.ronn +193 -0
  219. data/bundler/man/bundle-exec.ronn +136 -0
  220. data/bundler/man/bundle-gem.ronn +77 -0
  221. data/bundler/man/bundle-install.ronn +404 -0
  222. data/bundler/man/bundle-lock.ronn +47 -0
  223. data/bundler/man/bundle-package.ronn +67 -0
  224. data/bundler/man/bundle-platform.ronn +42 -0
  225. data/bundler/man/bundle-update.ronn +194 -0
  226. data/bundler/man/bundle.ronn +98 -0
  227. data/bundler/man/gemfile.5.ronn +499 -0
  228. data/bundler/man/index.txt +8 -0
  229. data/lib/rubygems.rb +42 -2
  230. data/lib/rubygems/config_file.rb +1 -1
  231. data/lib/rubygems/defaults.rb +18 -0
  232. data/lib/rubygems/installer.rb +1 -0
  233. data/lib/rubygems/package.rb +3 -1
  234. data/lib/rubygems/package/tar_writer.rb +10 -16
  235. data/lib/rubygems/remote_fetcher.rb +1 -15
  236. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  237. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  238. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +57 -145
  239. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  240. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  241. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  242. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  243. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  244. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  245. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  246. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  247. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
  248. data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  249. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +55 -54
  250. data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
  251. data/lib/rubygems/security/signer.rb +2 -0
  252. data/lib/rubygems/specification.rb +4 -4
  253. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  254. data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
  255. data/test/rubygems/alternate_cert.pem +10 -9
  256. data/test/rubygems/alternate_cert_32.pem +10 -9
  257. data/test/rubygems/child_cert.pem +11 -9
  258. data/test/rubygems/child_cert_32.pem +11 -9
  259. data/test/rubygems/encrypted_private_key.pem +26 -26
  260. data/test/rubygems/expired_cert.pem +9 -8
  261. data/test/rubygems/future_cert.pem +9 -8
  262. data/test/rubygems/future_cert_32.pem +9 -8
  263. data/test/rubygems/grandchild_cert.pem +11 -9
  264. data/test/rubygems/grandchild_cert_32.pem +11 -9
  265. data/test/rubygems/invalid_issuer_cert.pem +11 -9
  266. data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
  267. data/test/rubygems/invalid_signer_cert.pem +10 -9
  268. data/test/rubygems/invalid_signer_cert_32.pem +10 -9
  269. data/test/rubygems/invalidchild_cert.pem +11 -9
  270. data/test/rubygems/invalidchild_cert_32.pem +11 -9
  271. data/test/rubygems/public_cert.pem +11 -9
  272. data/test/rubygems/public_cert_32.pem +10 -9
  273. data/test/rubygems/test_bundled_ca.rb +1 -1
  274. data/test/rubygems/test_gem.rb +7 -0
  275. data/test/rubygems/test_gem_installer.rb +119 -0
  276. data/test/rubygems/test_gem_package.rb +9 -3
  277. data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
  278. data/test/rubygems/test_gem_remote_fetcher.rb +0 -12
  279. data/test/rubygems/test_gem_security_signer.rb +8 -0
  280. data/test/rubygems/test_gem_specification.rb +1 -1
  281. data/test/rubygems/wrong_key_cert.pem +10 -9
  282. data/test/rubygems/wrong_key_cert_32.pem +10 -9
  283. data/util/ci +73 -0
  284. data/util/create_certs.rb +64 -49
  285. data/util/update_bundled_ca_certificates.rb +23 -2
  286. metadata +257 -19
  287. data/lib/gauntlet_rubygems.rb +0 -51
  288. data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Init
4
+ attr_reader :options
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ if File.exist?("Gemfile")
11
+ Bundler.ui.error "Gemfile already exists at #{SharedHelpers.pwd}/Gemfile"
12
+ exit 1
13
+ end
14
+
15
+ if options[:gemspec]
16
+ gemspec = File.expand_path(options[:gemspec])
17
+ unless File.exist?(gemspec)
18
+ Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
19
+ exit 1
20
+ end
21
+ spec = Gem::Specification.load(gemspec)
22
+ puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
23
+ File.open("Gemfile", "wb") do |file|
24
+ file << "# Generated from #{gemspec}\n"
25
+ file << spec.to_gemfile
26
+ end
27
+ else
28
+ puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
29
+ FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile")
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Inject
4
+ attr_reader :options, :name, :version, :gems
5
+ def initialize(options, name, version, gems)
6
+ @options = options
7
+ @name = name
8
+ @version = version
9
+ @gems = gems
10
+ end
11
+
12
+ def run
13
+ # The required arguments allow Thor to give useful feedback when the arguments
14
+ # are incorrect. This adds those first two arguments onto the list as a whole.
15
+ gems.unshift(version).unshift(name)
16
+
17
+ # Build an array of Dependency objects out of the arguments
18
+ deps = []
19
+ gems.each_slice(2) do |gem_name, gem_version|
20
+ deps << Bundler::Dependency.new(gem_name, gem_version)
21
+ end
22
+
23
+ added = Injector.inject(deps)
24
+
25
+ if added.any?
26
+ Bundler.ui.confirm "Added to Gemfile:"
27
+ Bundler.ui.confirm added.map {|g| " #{g}" }.join("\n")
28
+ else
29
+ Bundler.ui.confirm "All injected gems were already present in the Gemfile"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,225 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Install
4
+ attr_reader :options
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ Bundler.ui.level = "error" if options[:quiet]
11
+
12
+ warn_if_root
13
+
14
+ [:with, :without].each do |option|
15
+ if options[option]
16
+ options[option] = options[option].join(":").tr(" ", ":").split(":")
17
+ end
18
+ end
19
+
20
+ check_for_group_conflicts
21
+
22
+ normalize_groups
23
+
24
+ ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD
25
+
26
+ # Disable color in deployment mode
27
+ Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
28
+
29
+ check_for_options_conflicts
30
+
31
+ check_trust_policy
32
+
33
+ if options[:deployment] || options[:frozen]
34
+ unless Bundler.default_lockfile.exist?
35
+ flag = options[:deployment] ? "--deployment" : "--frozen"
36
+ raise ProductionError, "The #{flag} flag requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \
37
+ "sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \
38
+ "before deploying."
39
+ end
40
+
41
+ options[:local] = true if Bundler.app_cache.exist?
42
+
43
+ Bundler.settings[:frozen] = "1"
44
+ end
45
+
46
+ # When install is called with --no-deployment, disable deployment mode
47
+ if options[:deployment] == false
48
+ Bundler.settings.delete(:frozen)
49
+ options[:system] = true
50
+ end
51
+
52
+ normalize_settings
53
+
54
+ Bundler::Fetcher.disable_endpoint = options["full-index"]
55
+
56
+ # rubygems plugins sometimes hook into the gem install process
57
+ Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
58
+
59
+ Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.settings[:plugins]
60
+
61
+ definition = Bundler.definition
62
+ definition.validate_ruby!
63
+
64
+ Installer.install(Bundler.root, definition, options)
65
+ Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
66
+
67
+ Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
68
+ confirm_without_groups
69
+
70
+ if Bundler.settings[:path]
71
+ absolute_path = File.expand_path(Bundler.settings[:path])
72
+ relative_path = absolute_path.sub(File.expand_path("."), ".")
73
+ Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
74
+ else
75
+ Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
76
+ end
77
+
78
+ unless Bundler.settings["ignore_messages"]
79
+ Installer.post_install_messages.to_a.each do |name, msg|
80
+ print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
81
+ end
82
+ end
83
+
84
+ warn_ambiguous_gems
85
+
86
+ if Bundler.settings[:clean] && Bundler.settings[:path]
87
+ require "bundler/cli/clean"
88
+ Bundler::CLI::Clean.new(options).run
89
+ end
90
+ rescue GemNotFound, VersionConflict => e
91
+ if options[:local] && Bundler.app_cache.exist?
92
+ Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
93
+ end
94
+
95
+ unless Bundler.definition.has_rubygems_remotes?
96
+ Bundler.ui.warn <<-WARN, :wrap => true
97
+ Your Gemfile has no gem server sources. If you need gems that are \
98
+ not already on your machine, add a line like this to your Gemfile:
99
+ source 'https://rubygems.org'
100
+ WARN
101
+ end
102
+ raise e
103
+ rescue Gem::InvalidSpecificationException => e
104
+ Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
105
+ raise e
106
+ end
107
+
108
+ private
109
+
110
+ def warn_if_root
111
+ return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero?
112
+ Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
113
+ "if it is needed, and installing your bundle as root will break this " \
114
+ "application for all non-root users on this machine.", :wrap => true
115
+ end
116
+
117
+ def confirm_without_groups
118
+ return unless Bundler.settings.without.any?
119
+ require "bundler/cli/common"
120
+ Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
121
+ end
122
+
123
+ def dependencies_count_for(definition)
124
+ count = definition.dependencies.count
125
+ "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
126
+ end
127
+
128
+ def gems_installed_for(definition)
129
+ count = definition.specs.count
130
+ "#{count} #{count == 1 ? "gem" : "gems"} now installed"
131
+ end
132
+
133
+ def print_post_install_message(name, msg)
134
+ Bundler.ui.confirm "Post-install message from #{name}:"
135
+ Bundler.ui.info msg
136
+ end
137
+
138
+ def check_for_group_conflicts
139
+ if options[:without] && options[:with]
140
+ conflicting_groups = options[:without] & options[:with]
141
+ unless conflicting_groups.empty?
142
+ Bundler.ui.error "You can't list a group in both, --with and --without." \
143
+ "The offending groups are: #{conflicting_groups.join(", ")}."
144
+ exit 1
145
+ end
146
+ end
147
+ end
148
+
149
+ def check_for_options_conflicts
150
+ if (options[:path] || options[:deployment]) && options[:system]
151
+ error_message = String.new
152
+ error_message << "You have specified both a path to install your gems to as well as --system. Please choose.\n" if options[:path]
153
+ error_message << "You have specified both --deployment as well as --system. Please choose.\n" if options[:deployment]
154
+ raise InvalidOption.new(error_message)
155
+ end
156
+ end
157
+
158
+ def check_trust_policy
159
+ if options["trust-policy"]
160
+ unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
161
+ Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
162
+ "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
163
+ exit 1
164
+ end
165
+ Bundler.settings["trust-policy"] = options["trust-policy"]
166
+ else
167
+ Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"]
168
+ end
169
+ end
170
+
171
+ def normalize_groups
172
+ Bundler.settings.with = [] if options[:with] && options[:with].empty?
173
+ Bundler.settings.without = [] if options[:without] && options[:without].empty?
174
+
175
+ with = options.fetch("with", [])
176
+ with |= Bundler.settings.with.map(&:to_s)
177
+ with -= options[:without] if options[:without]
178
+
179
+ without = options.fetch("without", [])
180
+ without |= Bundler.settings.without.map(&:to_s)
181
+ without -= options[:with] if options[:with]
182
+
183
+ options[:with] = with
184
+ options[:without] = without
185
+ end
186
+
187
+ def normalize_settings
188
+ Bundler.settings[:path] = nil if options[:system]
189
+ Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
190
+ Bundler.settings[:path] = options["path"] if options["path"]
191
+ Bundler.settings[:path] ||= "bundle" if options["standalone"]
192
+
193
+ Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
194
+ Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
195
+
196
+ Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
197
+
198
+ Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
199
+
200
+ Bundler.settings[:no_prune] = true if options["no-prune"]
201
+
202
+ Bundler.settings[:no_install] = true if options["no-install"]
203
+
204
+ Bundler.settings[:clean] = options["clean"] if options["clean"]
205
+
206
+ Bundler.settings.without = options[:without]
207
+ Bundler.settings.with = options[:with]
208
+
209
+ Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? true : nil
210
+ end
211
+
212
+ def warn_ambiguous_gems
213
+ Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
214
+ Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
215
+ Bundler.ui.error "Installed from: #{installed_from_uri}"
216
+ Bundler.ui.error "Also found in:"
217
+ also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
218
+ Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
219
+ Bundler.ui.error "For example:"
220
+ Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
221
+ Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class CLI::Lock
4
+ attr_reader :options
5
+
6
+ def initialize(options)
7
+ @options = options
8
+ end
9
+
10
+ def run
11
+ unless Bundler.default_gemfile
12
+ Bundler.ui.error "Unable to find a Gemfile to lock"
13
+ exit 1
14
+ end
15
+
16
+ print = options[:print]
17
+ ui = Bundler.ui
18
+ Bundler.ui = UI::Silent.new if print
19
+
20
+ gems = options[:update]
21
+ Bundler::Fetcher.disable_endpoint = options["full-index"]
22
+
23
+ if gems && !gems.empty?
24
+ definition = Bundler.definition(:gems => gems)
25
+ else
26
+ definition = Bundler.definition(true)
27
+ end
28
+
29
+ options["add-platform"].each do |platform|
30
+ platform = Gem::Platform.new(platform)
31
+ definition.add_platform(platform)
32
+ end
33
+
34
+ definition.resolve_remotely! unless options[:local]
35
+
36
+ if print
37
+ puts definition.to_lock
38
+ else
39
+ file = options[:lockfile]
40
+ file = file ? File.expand_path(file) : Bundler.default_lockfile
41
+ puts "Writing lockfile to #{file}"
42
+ definition.lock(file)
43
+ end
44
+
45
+ Bundler.ui = ui
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+ require "shellwords"
4
+
5
+ module Bundler
6
+ class CLI::Open
7
+ attr_reader :options, :name
8
+ def initialize(options, name)
9
+ @options = options
10
+ @name = name
11
+ end
12
+
13
+ def run
14
+ editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
15
+ return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
16
+ path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
17
+ Dir.chdir(path) do
18
+ command = Shellwords.split(editor) + [path]
19
+ Bundler.with_clean_env do
20
+ system(*command)
21
+ end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+ require "bundler/cli/common"
3
+
4
+ module Bundler
5
+ class CLI::Outdated
6
+ attr_reader :options, :gems
7
+ def initialize(options, gems)
8
+ @options = options
9
+ @gems = gems
10
+ end
11
+
12
+ def run
13
+ check_for_deployment_mode
14
+
15
+ sources = Array(options[:source])
16
+
17
+ gems.each do |gem_name|
18
+ Bundler::CLI::Common.select_spec(gem_name)
19
+ end
20
+
21
+ Bundler.definition.validate_ruby!
22
+ current_specs = Bundler.ui.silence { Bundler.load.specs }
23
+ current_dependencies = {}
24
+ Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
25
+
26
+ definition = if gems.empty? && sources.empty?
27
+ # We're doing a full update
28
+ Bundler.definition(true)
29
+ else
30
+ Bundler.definition(:gems => gems, :sources => sources)
31
+ end
32
+
33
+ definition_resolution = proc { options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely! }
34
+ if options[:parseable]
35
+ Bundler.ui.silence(&definition_resolution)
36
+ else
37
+ definition_resolution.call
38
+ end
39
+
40
+ Bundler.ui.info ""
41
+
42
+ out_count = 0
43
+ # Loop through the current specs
44
+ gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
45
+ [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
46
+ next if !gems.empty? && !gems.include?(current_spec.name)
47
+
48
+ dependency = current_dependencies[current_spec.name]
49
+
50
+ if options["strict"]
51
+ active_spec = definition.specs.detect {|spec| spec.name == current_spec.name && spec.platform == current_spec.platform }
52
+ else
53
+ active_specs = definition.index[current_spec.name].select {|spec| spec.platform == current_spec.platform }.sort_by(&:version)
54
+ if !current_spec.version.prerelease? && !options[:pre] && active_specs.size > 1
55
+ active_spec = active_specs.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
56
+ end
57
+ active_spec = active_specs.last
58
+
59
+ if options[:major] || options[:minor] || options[:patch]
60
+ update_present = update_present_via_semver_portions(current_spec, active_spec, options)
61
+ active_spec = nil unless update_present
62
+ end
63
+ end
64
+
65
+ next if active_spec.nil?
66
+
67
+ gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
68
+ git_outdated = current_spec.git_version != active_spec.git_version
69
+ if gem_outdated || git_outdated
70
+ unless options[:parseable]
71
+ if out_count == 0
72
+ if options["pre"]
73
+ Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
74
+ else
75
+ Bundler.ui.info "Outdated gems included in the bundle:"
76
+ end
77
+ end
78
+ end
79
+
80
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
81
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
82
+ dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
83
+
84
+ if dependency && !options[:parseable]
85
+ groups = dependency.groups.join(", ")
86
+ pl = (dependency.groups.length > 1) ? "s" : ""
87
+ groups = " in group#{pl} \"#{groups}\""
88
+ end
89
+
90
+ spec_outdated_info = "#{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})"
91
+ if options[:parseable]
92
+ Bundler.ui.info spec_outdated_info.to_s.rstrip
93
+ else
94
+ Bundler.ui.info " * #{spec_outdated_info}#{groups}".rstrip
95
+ end
96
+
97
+ out_count += 1
98
+ end
99
+ Bundler.ui.debug "from #{active_spec.loaded_from}"
100
+ end
101
+
102
+ if out_count.zero?
103
+ Bundler.ui.info "Bundle up to date!\n" unless options[:parseable]
104
+ else
105
+ exit 1
106
+ end
107
+ end
108
+
109
+ private
110
+
111
+ def check_for_deployment_mode
112
+ if Bundler.settings[:frozen]
113
+ error_message = "You are trying to check outdated gems in deployment mode. " \
114
+ "Run `bundle outdated` elsewhere.\n" \
115
+ "\nIf this is a development machine, remove the #{Bundler.default_gemfile} freeze" \
116
+ "\nby running `bundle install --no-deployment`."
117
+ raise ProductionError, error_message
118
+ end
119
+ end
120
+
121
+ def update_present_via_semver_portions(current_spec, active_spec, options)
122
+ current_major = current_spec.version.segments.first
123
+ active_major = active_spec.version.segments.first
124
+
125
+ update_present = false
126
+
127
+ update_present = active_major > current_major if options[:major]
128
+
129
+ if !update_present && (options[:minor] || options[:patch]) && current_major == active_major
130
+ current_minor = get_version_semver_portion_value(current_spec, 1)
131
+ active_minor = get_version_semver_portion_value(active_spec, 1)
132
+
133
+ update_present = active_minor > current_minor if options[:minor]
134
+
135
+ if !update_present && options[:patch] && current_minor == active_minor
136
+ current_patch = get_version_semver_portion_value(current_spec, 2)
137
+ active_patch = get_version_semver_portion_value(active_spec, 2)
138
+
139
+ update_present = active_patch > current_patch
140
+ end
141
+ end
142
+
143
+ update_present
144
+ end
145
+
146
+ def get_version_semver_portion_value(spec, version_portion_index)
147
+ version_section = spec.version.segments[version_portion_index, 1]
148
+ version_section.nil? ? 0 : (version_section.first || 0)
149
+ end
150
+ end
151
+ end