shopify-bundler 1.10.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +96 -0
  5. data/.rubocop_todo.yml +177 -0
  6. data/.travis.yml +104 -0
  7. data/CHANGELOG.md +2131 -0
  8. data/CODE_OF_CONDUCT.md +42 -0
  9. data/CONTRIBUTING.md +32 -0
  10. data/DEVELOPMENT.md +118 -0
  11. data/ISSUES.md +96 -0
  12. data/LICENSE.md +23 -0
  13. data/README.md +40 -0
  14. data/Rakefile +309 -0
  15. data/bin/rake +14 -0
  16. data/bin/rspec +10 -0
  17. data/bin/rubocop +11 -0
  18. data/bundler.gemspec +34 -0
  19. data/exe/bundle +21 -0
  20. data/exe/bundle_ruby +60 -0
  21. data/exe/bundler +21 -0
  22. data/lib/bundler.rb +499 -0
  23. data/lib/bundler/capistrano.rb +16 -0
  24. data/lib/bundler/cli.rb +435 -0
  25. data/lib/bundler/cli/binstubs.rb +37 -0
  26. data/lib/bundler/cli/cache.rb +34 -0
  27. data/lib/bundler/cli/check.rb +37 -0
  28. data/lib/bundler/cli/clean.rb +25 -0
  29. data/lib/bundler/cli/common.rb +56 -0
  30. data/lib/bundler/cli/config.rb +88 -0
  31. data/lib/bundler/cli/console.rb +37 -0
  32. data/lib/bundler/cli/exec.rb +51 -0
  33. data/lib/bundler/cli/gem.rb +208 -0
  34. data/lib/bundler/cli/init.rb +32 -0
  35. data/lib/bundler/cli/inject.rb +32 -0
  36. data/lib/bundler/cli/install.rb +188 -0
  37. data/lib/bundler/cli/lock.rb +35 -0
  38. data/lib/bundler/cli/open.rb +22 -0
  39. data/lib/bundler/cli/outdated.rb +86 -0
  40. data/lib/bundler/cli/package.rb +45 -0
  41. data/lib/bundler/cli/platform.rb +42 -0
  42. data/lib/bundler/cli/show.rb +74 -0
  43. data/lib/bundler/cli/update.rb +72 -0
  44. data/lib/bundler/cli/viz.rb +26 -0
  45. data/lib/bundler/constants.rb +5 -0
  46. data/lib/bundler/current_ruby.rb +218 -0
  47. data/lib/bundler/definition.rb +675 -0
  48. data/lib/bundler/dep_proxy.rb +45 -0
  49. data/lib/bundler/dependency.rb +119 -0
  50. data/lib/bundler/deployment.rb +62 -0
  51. data/lib/bundler/deprecate.rb +17 -0
  52. data/lib/bundler/dsl.rb +478 -0
  53. data/lib/bundler/endpoint_specification.rb +100 -0
  54. data/lib/bundler/env.rb +82 -0
  55. data/lib/bundler/environment.rb +41 -0
  56. data/lib/bundler/fetcher.rb +288 -0
  57. data/lib/bundler/fetcher/base.rb +26 -0
  58. data/lib/bundler/fetcher/dependency.rb +88 -0
  59. data/lib/bundler/fetcher/downloader.rb +60 -0
  60. data/lib/bundler/fetcher/index.rb +32 -0
  61. data/lib/bundler/friendly_errors.rb +92 -0
  62. data/lib/bundler/gem_helper.rb +191 -0
  63. data/lib/bundler/gem_helpers.rb +26 -0
  64. data/lib/bundler/gem_installer.rb +9 -0
  65. data/lib/bundler/gem_path_manipulation.rb +8 -0
  66. data/lib/bundler/gem_tasks.rb +5 -0
  67. data/lib/bundler/graph.rb +173 -0
  68. data/lib/bundler/index.rb +199 -0
  69. data/lib/bundler/injector.rb +62 -0
  70. data/lib/bundler/inline.rb +58 -0
  71. data/lib/bundler/installer.rb +242 -0
  72. data/lib/bundler/installer/parallel_installer.rb +122 -0
  73. data/lib/bundler/installer/standalone.rb +48 -0
  74. data/lib/bundler/lazy_specification.rb +82 -0
  75. data/lib/bundler/lockfile_parser.rb +199 -0
  76. data/lib/bundler/match_platform.rb +13 -0
  77. data/lib/bundler/psyched_yaml.rb +26 -0
  78. data/lib/bundler/remote_specification.rb +82 -0
  79. data/lib/bundler/resolver.rb +350 -0
  80. data/lib/bundler/retry.rb +60 -0
  81. data/lib/bundler/ruby_dsl.rb +11 -0
  82. data/lib/bundler/ruby_version.rb +116 -0
  83. data/lib/bundler/rubygems_ext.rb +175 -0
  84. data/lib/bundler/rubygems_integration.rb +674 -0
  85. data/lib/bundler/runtime.rb +285 -0
  86. data/lib/bundler/settings.rb +263 -0
  87. data/lib/bundler/setup.rb +26 -0
  88. data/lib/bundler/shared_helpers.rb +176 -0
  89. data/lib/bundler/similarity_detector.rb +61 -0
  90. data/lib/bundler/source.rb +35 -0
  91. data/lib/bundler/source/git.rb +286 -0
  92. data/lib/bundler/source/git/git_proxy.rb +190 -0
  93. data/lib/bundler/source/path.rb +224 -0
  94. data/lib/bundler/source/path/installer.rb +43 -0
  95. data/lib/bundler/source/rubygems.rb +436 -0
  96. data/lib/bundler/source/rubygems/remote.rb +38 -0
  97. data/lib/bundler/source_list.rb +101 -0
  98. data/lib/bundler/spec_set.rb +156 -0
  99. data/lib/bundler/ssl_certs/.document +1 -0
  100. data/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem +25 -0
  101. data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +32 -0
  102. data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
  103. data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
  104. data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
  105. data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
  106. data/lib/bundler/ssl_certs/certificate_manager.rb +64 -0
  107. data/lib/bundler/stub_specification.rb +23 -0
  108. data/lib/bundler/templates/Executable +16 -0
  109. data/lib/bundler/templates/Executable.standalone +12 -0
  110. data/lib/bundler/templates/Gemfile +4 -0
  111. data/lib/bundler/templates/newgem/.travis.yml.tt +4 -0
  112. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +22 -0
  113. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  114. data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
  115. data/lib/bundler/templates/newgem/README.md.tt +41 -0
  116. data/lib/bundler/templates/newgem/Rakefile.tt +29 -0
  117. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  118. data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
  119. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  120. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  121. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  122. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  123. data/lib/bundler/templates/newgem/gitignore.tt +16 -0
  124. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  125. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  126. data/lib/bundler/templates/newgem/newgem.gemspec.tt +43 -0
  127. data/lib/bundler/templates/newgem/rspec.tt +2 -0
  128. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  129. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  130. data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
  131. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
  132. data/lib/bundler/ui.rb +7 -0
  133. data/lib/bundler/ui/rg_proxy.rb +17 -0
  134. data/lib/bundler/ui/shell.rb +108 -0
  135. data/lib/bundler/ui/silent.rb +44 -0
  136. data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -0
  137. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +277 -0
  138. data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -0
  139. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +3 -0
  140. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +99 -0
  141. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +63 -0
  142. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +434 -0
  143. data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +43 -0
  144. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +51 -0
  145. data/lib/bundler/vendor/net/http/faster.rb +26 -0
  146. data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
  147. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
  148. data/lib/bundler/vendor/thor/lib/thor.rb +484 -0
  149. data/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
  150. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
  151. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
  152. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
  153. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
  154. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
  155. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
  156. data/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
  157. data/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
  158. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  159. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
  160. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
  161. data/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
  162. data/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
  163. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
  164. data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
  165. data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
  166. data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
  167. data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
  168. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
  169. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
  170. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
  171. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
  172. data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
  173. data/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
  174. data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
  175. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
  176. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
  177. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
  178. data/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
  179. data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
  180. data/lib/bundler/vendored_molinillo.rb +2 -0
  181. data/lib/bundler/vendored_persistent.rb +11 -0
  182. data/lib/bundler/vendored_thor.rb +3 -0
  183. data/lib/bundler/version.rb +6 -0
  184. data/lib/bundler/vlad.rb +11 -0
  185. data/lib/bundler/worker.rb +72 -0
  186. data/man/bundle-config.ronn +187 -0
  187. data/man/bundle-exec.ronn +136 -0
  188. data/man/bundle-gem.ronn +77 -0
  189. data/man/bundle-install.ronn +398 -0
  190. data/man/bundle-package.ronn +66 -0
  191. data/man/bundle-platform.ronn +42 -0
  192. data/man/bundle-update.ronn +188 -0
  193. data/man/bundle.ronn +98 -0
  194. data/man/gemfile.5.ronn +495 -0
  195. data/man/index.txt +8 -0
  196. metadata +346 -0
@@ -0,0 +1,32 @@
1
+ module Bundler
2
+ class CLI::Init
3
+ attr_reader :options
4
+ def initialize(options)
5
+ @options = options
6
+ end
7
+
8
+ def run
9
+ if File.exist?("Gemfile")
10
+ Bundler.ui.error "Gemfile already exists at #{SharedHelpers.pwd}/Gemfile"
11
+ exit 1
12
+ end
13
+
14
+ if options[:gemspec]
15
+ gemspec = File.expand_path(options[:gemspec])
16
+ unless File.exist?(gemspec)
17
+ Bundler.ui.error "Gem specification #{gemspec} doesn't exist"
18
+ exit 1
19
+ end
20
+ spec = Gem::Specification.load(gemspec)
21
+ puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
22
+ File.open("Gemfile", "wb") do |file|
23
+ file << "# Generated from #{gemspec}\n"
24
+ file << spec.to_gemfile
25
+ end
26
+ else
27
+ puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile"
28
+ FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile")
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module Bundler
2
+ class CLI::Inject
3
+ attr_reader :options, :name, :version, :gems
4
+ def initialize(options, name, version, gems)
5
+ @options = options
6
+ @name = name
7
+ @version = version
8
+ @gems = gems
9
+ end
10
+
11
+ def run
12
+ # The required arguments allow Thor to give useful feedback when the arguments
13
+ # are incorrect. This adds those first two arguments onto the list as a whole.
14
+ gems.unshift(version).unshift(name)
15
+
16
+ # Build an array of Dependency objects out of the arguments
17
+ deps = []
18
+ gems.each_slice(2) do |gem_name, gem_version|
19
+ deps << Bundler::Dependency.new(gem_name, gem_version)
20
+ end
21
+
22
+ added = Injector.inject(deps)
23
+
24
+ if added.any?
25
+ Bundler.ui.confirm "Added to Gemfile:"
26
+ Bundler.ui.confirm added.map {|g| " #{g}" }.join("\n")
27
+ else
28
+ Bundler.ui.confirm "All injected gems were already present in the Gemfile"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,188 @@
1
+ module Bundler
2
+ class CLI::Install
3
+ attr_reader :options
4
+ def initialize(options)
5
+ @options = options
6
+ end
7
+
8
+ def run
9
+ Bundler.ui.level = "error" if options[:quiet]
10
+
11
+ warn_if_root
12
+
13
+ [:with, :without].each do |option|
14
+ if options[option]
15
+ options[option] = options[option].join(":").tr(" ", ":").split(":")
16
+ end
17
+ end
18
+
19
+ if options[:without] && options[:with]
20
+ conflicting_groups = options[:without] & options[:with]
21
+ unless conflicting_groups.empty?
22
+ Bundler.ui.error "You can't list a group in both, --with and --without." \
23
+ "The offending groups are: #{conflicting_groups.join(", ")}."
24
+ exit 1
25
+ end
26
+ end
27
+
28
+ Bundler.settings.with = [] if options[:with] && options[:with].empty?
29
+ Bundler.settings.without = [] if options[:without] && options[:without].empty?
30
+
31
+ with = options.fetch("with", [])
32
+ with |= Bundler.settings.with.map(&:to_s)
33
+ with -= options[:without] if options[:without]
34
+
35
+ without = options.fetch("without", [])
36
+ without |= Bundler.settings.without.map(&:to_s)
37
+ without -= options[:with] if options[:with]
38
+
39
+ options[:with] = with
40
+ options[:without] = without
41
+
42
+ ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD
43
+
44
+ # Just disable color in deployment mode
45
+ Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment]
46
+
47
+ if (options[:path] || options[:deployment]) && options[:system]
48
+ Bundler.ui.error "You have specified both a path to install your gems to, \n" \
49
+ "as well as --system. Please choose."
50
+ exit 1
51
+ end
52
+
53
+ if options["trust-policy"]
54
+ unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])
55
+ Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \
56
+ "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}."
57
+ exit 1
58
+ end
59
+ Bundler.settings["trust-policy"] = options["trust-policy"]
60
+ else
61
+ Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"]
62
+ end
63
+
64
+ if options[:deployment] || options[:frozen]
65
+ unless Bundler.default_lockfile.exist?
66
+ flag = options[:deployment] ? "--deployment" : "--frozen"
67
+ raise ProductionError, "The #{flag} flag requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \
68
+ "sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \
69
+ "before deploying."
70
+ end
71
+
72
+ if Bundler.app_cache.exist?
73
+ options[:local] = true
74
+ end
75
+
76
+ Bundler.settings[:frozen] = "1"
77
+ end
78
+
79
+ # When install is called with --no-deployment, disable deployment mode
80
+ if options[:deployment] == false
81
+ Bundler.settings.delete(:frozen)
82
+ options[:system] = true
83
+ end
84
+
85
+ Bundler.settings[:path] = nil if options[:system]
86
+ Bundler.settings[:path] = "vendor/bundle" if options[:deployment]
87
+ Bundler.settings[:path] = options["path"] if options["path"]
88
+ Bundler.settings[:path] ||= "bundle" if options["standalone"]
89
+ Bundler.settings[:bin] = options["binstubs"] if options["binstubs"]
90
+ Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty?
91
+ Bundler.settings[:shebang] = options["shebang"] if options["shebang"]
92
+ Bundler.settings[:jobs] = options["jobs"] if options["jobs"]
93
+ Bundler.settings[:no_prune] = true if options["no-prune"]
94
+ Bundler.settings[:no_install] = true if options["no-install"]
95
+ Bundler.settings[:clean] = options["clean"] if options["clean"]
96
+ Bundler.settings.without = options[:without]
97
+ Bundler.settings.with = options[:with]
98
+ Bundler::Fetcher.disable_endpoint = options["full-index"]
99
+ Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? "1" : nil
100
+
101
+ # rubygems plugins sometimes hook into the gem install process
102
+ Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
103
+
104
+ definition = Bundler.definition
105
+ definition.validate_ruby!
106
+
107
+ Installer.install(Bundler.root, definition, options)
108
+ Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen]
109
+
110
+ Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
111
+ confirm_without_groups
112
+
113
+ if Bundler.settings[:path]
114
+ absolute_path = File.expand_path(Bundler.settings[:path])
115
+ relative_path = absolute_path.sub(File.expand_path("."), ".")
116
+ Bundler.ui.confirm "Bundled gems are installed into #{relative_path}."
117
+ else
118
+ Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed."
119
+ end
120
+
121
+ unless Bundler.settings["ignore_messages"]
122
+ Installer.post_install_messages.to_a.each do |name, msg|
123
+ print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
124
+ end
125
+ end
126
+
127
+ Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris|
128
+ Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources."
129
+ Bundler.ui.error "Installed from: #{installed_from_uri}"
130
+ Bundler.ui.error "Also found in:"
131
+ also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" }
132
+ Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source."
133
+ Bundler.ui.error "For example:"
134
+ Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'"
135
+ Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again."
136
+ end
137
+
138
+ if Bundler.settings[:clean] && Bundler.settings[:path]
139
+ require "bundler/cli/clean"
140
+ Bundler::CLI::Clean.new(options).run
141
+ end
142
+ rescue GemNotFound, VersionConflict => e
143
+ if options[:local] && Bundler.app_cache.exist?
144
+ Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
145
+ end
146
+
147
+ unless Bundler.definition.has_rubygems_remotes?
148
+ Bundler.ui.warn <<-WARN, :wrap => true
149
+ Your Gemfile has no gem server sources. If you need gems that are \
150
+ not already on your machine, add a line like this to your Gemfile:
151
+ source 'https://rubygems.org'
152
+ WARN
153
+ end
154
+ raise e
155
+ end
156
+
157
+ private
158
+
159
+ def warn_if_root
160
+ return if Bundler::WINDOWS || !Process.uid.zero?
161
+ Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \
162
+ "if it is needed, and installing your bundle as root will break this " \
163
+ "application for all non-root users on this machine.", :wrap => true
164
+ end
165
+
166
+ def confirm_without_groups
167
+ if Bundler.settings.without.any?
168
+ require "bundler/cli/common"
169
+ Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
170
+ end
171
+ end
172
+
173
+ def dependencies_count_for(definition)
174
+ count = definition.dependencies.count
175
+ "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}"
176
+ end
177
+
178
+ def gems_installed_for(definition)
179
+ count = definition.specs.count
180
+ "#{count} #{count == 1 ? "gem" : "gems"} now installed"
181
+ end
182
+
183
+ def print_post_install_message(name, msg)
184
+ Bundler.ui.confirm "Post-install message from #{name}:"
185
+ Bundler.ui.info msg
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,35 @@
1
+ module Bundler
2
+ class CLI::Lock
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ unless Bundler.default_gemfile
11
+ Bundler.ui.error "Unable to find a Gemfile to lock"
12
+ exit 1
13
+ end
14
+
15
+ print = options[:print]
16
+ ui = Bundler.ui
17
+ Bundler.ui = UI::Silent.new if print
18
+
19
+ unlock = options[:update]
20
+ definition = Bundler.definition(unlock)
21
+ definition.resolve_remotely! unless options[:local]
22
+
23
+ if print
24
+ puts definition.to_lock
25
+ else
26
+ file = options[:lockfile]
27
+ file = file ? File.expand_path(file) : Bundler.default_lockfile
28
+ puts "Writing lockfile to #{file}"
29
+ definition.lock(file)
30
+ end
31
+
32
+ Bundler.ui = ui
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ require "bundler/cli/common"
2
+ require "shellwords"
3
+
4
+ module Bundler
5
+ class CLI::Open
6
+ attr_reader :options, :name
7
+ def initialize(options, name)
8
+ @options = options
9
+ @name = name
10
+ end
11
+
12
+ def run
13
+ editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
14
+ return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
15
+ path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path
16
+ Dir.chdir(path) do
17
+ command = Shellwords.split(editor) + [path]
18
+ system(*command) || Bundler.ui.info("Could not run '#{command.join(" ")}'")
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,86 @@
1
+ require "bundler/cli/common"
2
+
3
+ module Bundler
4
+ class CLI::Outdated
5
+ attr_reader :options, :gems
6
+ def initialize(options, gems)
7
+ @options = options
8
+ @gems = gems
9
+ end
10
+
11
+ def run
12
+ sources = Array(options[:source])
13
+
14
+ gems.each do |gem_name|
15
+ Bundler::CLI::Common.select_spec(gem_name)
16
+ end
17
+
18
+ Bundler.definition.validate_ruby!
19
+ current_specs = Bundler.ui.silence { Bundler.load.specs }
20
+ current_dependencies = {}
21
+ Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
22
+
23
+ if gems.empty? && sources.empty?
24
+ # We're doing a full update
25
+ definition = Bundler.definition(true)
26
+ else
27
+ definition = Bundler.definition(:gems => gems, :sources => sources)
28
+ end
29
+ options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely!
30
+
31
+ Bundler.ui.info ""
32
+
33
+ out_count = 0
34
+ # Loop through the current specs
35
+ gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
36
+ [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
37
+ next if !gems.empty? && !gems.include?(current_spec.name)
38
+
39
+ dependency = current_dependencies[current_spec.name]
40
+
41
+ if options["strict"]
42
+ active_spec = definition.specs.detect {|spec| spec.name == current_spec.name }
43
+ else
44
+ active_spec = definition.index[current_spec.name].sort_by(&:version)
45
+ if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1
46
+ active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
47
+ end
48
+ active_spec = active_spec.last
49
+ end
50
+ next if active_spec.nil?
51
+
52
+ gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version)
53
+ git_outdated = current_spec.git_version != active_spec.git_version
54
+ if gem_outdated || git_outdated
55
+ if out_count == 0
56
+ if options["pre"]
57
+ Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
58
+ else
59
+ Bundler.ui.info "Outdated gems included in the bundle:"
60
+ end
61
+ end
62
+
63
+ spec_version = "#{active_spec.version}#{active_spec.git_version}"
64
+ current_version = "#{current_spec.version}#{current_spec.git_version}"
65
+ dependency_version = %|, requested #{dependency.requirement}| if dependency && dependency.specific?
66
+
67
+ if dependency
68
+ groups = dependency.groups.join(", ")
69
+ pl = (dependency.groups.length > 1) ? "s" : ""
70
+ groups = " in group#{pl} \"#{groups}\""
71
+ end
72
+
73
+ Bundler.ui.info " * #{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})#{groups}".rstrip
74
+ out_count += 1
75
+ end
76
+ Bundler.ui.debug "from #{active_spec.loaded_from}"
77
+ end
78
+
79
+ if out_count.zero?
80
+ Bundler.ui.info "Bundle up to date!\n"
81
+ else
82
+ exit 1
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,45 @@
1
+ module Bundler
2
+ class CLI::Package
3
+ attr_reader :options
4
+
5
+ def initialize(options)
6
+ @options = options
7
+ end
8
+
9
+ def run
10
+ Bundler.ui.level = "error" if options[:quiet]
11
+ Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path]
12
+ Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms")
13
+ Bundler.settings[:cache_path] = options["cache-path"] if options.key?("cache-path")
14
+
15
+ setup_cache_all
16
+ install
17
+
18
+ # TODO: move cache contents here now that all bundles are locked
19
+ custom_path = Pathname.new(options[:path]) if options[:path]
20
+ Bundler.load.cache(custom_path)
21
+ end
22
+
23
+ private
24
+
25
+ def install
26
+ require "bundler/cli/install"
27
+ options = self.options.dup
28
+ if Bundler.settings[:cache_all_platforms]
29
+ options["local"] = false
30
+ options["update"] = true
31
+ end
32
+ Bundler::CLI::Install.new(options).run
33
+ end
34
+
35
+ def setup_cache_all
36
+ Bundler.settings[:cache_all] = options[:all] if options.key?("all")
37
+
38
+ if Bundler.definition.has_local_dependencies? && !Bundler.settings[:cache_all]
39
+ Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
40
+ "to package them as well, please pass the --all flag. This will be the default " \
41
+ "on Bundler 2.0."
42
+ end
43
+ end
44
+ end
45
+ end