shopify-bundler 1.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +96 -0
- data/.rubocop_todo.yml +177 -0
- data/.travis.yml +104 -0
- data/CHANGELOG.md +2131 -0
- data/CODE_OF_CONDUCT.md +42 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +118 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +40 -0
- data/Rakefile +309 -0
- data/bin/rake +14 -0
- data/bin/rspec +10 -0
- data/bin/rubocop +11 -0
- data/bundler.gemspec +34 -0
- data/exe/bundle +21 -0
- data/exe/bundle_ruby +60 -0
- data/exe/bundler +21 -0
- data/lib/bundler.rb +499 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +435 -0
- data/lib/bundler/cli/binstubs.rb +37 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +37 -0
- data/lib/bundler/cli/clean.rb +25 -0
- data/lib/bundler/cli/common.rb +56 -0
- data/lib/bundler/cli/config.rb +88 -0
- data/lib/bundler/cli/console.rb +37 -0
- data/lib/bundler/cli/exec.rb +51 -0
- data/lib/bundler/cli/gem.rb +208 -0
- data/lib/bundler/cli/init.rb +32 -0
- data/lib/bundler/cli/inject.rb +32 -0
- data/lib/bundler/cli/install.rb +188 -0
- data/lib/bundler/cli/lock.rb +35 -0
- data/lib/bundler/cli/open.rb +22 -0
- data/lib/bundler/cli/outdated.rb +86 -0
- data/lib/bundler/cli/package.rb +45 -0
- data/lib/bundler/cli/platform.rb +42 -0
- data/lib/bundler/cli/show.rb +74 -0
- data/lib/bundler/cli/update.rb +72 -0
- data/lib/bundler/cli/viz.rb +26 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +218 -0
- data/lib/bundler/definition.rb +675 -0
- data/lib/bundler/dep_proxy.rb +45 -0
- data/lib/bundler/dependency.rb +119 -0
- data/lib/bundler/deployment.rb +62 -0
- data/lib/bundler/deprecate.rb +17 -0
- data/lib/bundler/dsl.rb +478 -0
- data/lib/bundler/endpoint_specification.rb +100 -0
- data/lib/bundler/env.rb +82 -0
- data/lib/bundler/environment.rb +41 -0
- data/lib/bundler/fetcher.rb +288 -0
- data/lib/bundler/fetcher/base.rb +26 -0
- data/lib/bundler/fetcher/dependency.rb +88 -0
- data/lib/bundler/fetcher/downloader.rb +60 -0
- data/lib/bundler/fetcher/index.rb +32 -0
- data/lib/bundler/friendly_errors.rb +92 -0
- data/lib/bundler/gem_helper.rb +191 -0
- data/lib/bundler/gem_helpers.rb +26 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +5 -0
- data/lib/bundler/graph.rb +173 -0
- data/lib/bundler/index.rb +199 -0
- data/lib/bundler/injector.rb +62 -0
- data/lib/bundler/inline.rb +58 -0
- data/lib/bundler/installer.rb +242 -0
- data/lib/bundler/installer/parallel_installer.rb +122 -0
- data/lib/bundler/installer/standalone.rb +48 -0
- data/lib/bundler/lazy_specification.rb +82 -0
- data/lib/bundler/lockfile_parser.rb +199 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +82 -0
- data/lib/bundler/resolver.rb +350 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +116 -0
- data/lib/bundler/rubygems_ext.rb +175 -0
- data/lib/bundler/rubygems_integration.rb +674 -0
- data/lib/bundler/runtime.rb +285 -0
- data/lib/bundler/settings.rb +263 -0
- data/lib/bundler/setup.rb +26 -0
- data/lib/bundler/shared_helpers.rb +176 -0
- data/lib/bundler/similarity_detector.rb +61 -0
- data/lib/bundler/source.rb +35 -0
- data/lib/bundler/source/git.rb +286 -0
- data/lib/bundler/source/git/git_proxy.rb +190 -0
- data/lib/bundler/source/path.rb +224 -0
- data/lib/bundler/source/path/installer.rb +43 -0
- data/lib/bundler/source/rubygems.rb +436 -0
- data/lib/bundler/source/rubygems/remote.rb +38 -0
- data/lib/bundler/source_list.rb +101 -0
- data/lib/bundler/spec_set.rb +156 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem +25 -0
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +32 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +64 -0
- data/lib/bundler/stub_specification.rb +23 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +4 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +22 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/bundler/templates/newgem/README.md.tt +41 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +29 -0
- data/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +43 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +17 -0
- data/lib/bundler/ui/shell.rb +108 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +277 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +3 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +99 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +63 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +434 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +43 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +51 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +484 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/bundler/vendored_molinillo.rb +2 -0
- data/lib/bundler/vendored_persistent.rb +11 -0
- data/lib/bundler/vendored_thor.rb +3 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/lib/bundler/worker.rb +72 -0
- data/man/bundle-config.ronn +187 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-gem.ronn +77 -0
- data/man/bundle-install.ronn +398 -0
- data/man/bundle-package.ronn +66 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +188 -0
- data/man/bundle.ronn +98 -0
- data/man/gemfile.5.ronn +495 -0
- data/man/index.txt +8 -0
- metadata +346 -0
data/bin/rake
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
|
6
|
+
bundler_spec.dependencies.each do |dep|
|
7
|
+
begin
|
8
|
+
gem dep.name, dep.requirement.to_s
|
9
|
+
rescue Gem::LoadError => e
|
10
|
+
$stderr.puts "#{e.message} (#{e.class})"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
|
6
|
+
bundler_spec.dependencies.each do |dep|
|
7
|
+
gem dep.name, dep.requirement.to_s
|
8
|
+
end
|
9
|
+
|
10
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/rubocop
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
|
6
|
+
bundler_spec.dependencies.each do |dep|
|
7
|
+
gem dep.name, dep.requirement.to_s
|
8
|
+
end
|
9
|
+
|
10
|
+
gem "rubocop", "= 0.33.0"
|
11
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/bundler.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib/", __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
require "bundler/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "shopify-bundler"
|
8
|
+
s.version = Bundler::VERSION
|
9
|
+
s.licenses = ["MIT"]
|
10
|
+
s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
|
11
|
+
s.email = ["andre.arko+terence.lee@gmail.com"]
|
12
|
+
s.homepage = "http://bundler.io"
|
13
|
+
s.summary = "The best way to manage your application's dependencies"
|
14
|
+
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
|
15
|
+
|
16
|
+
s.required_ruby_version = ">= 1.8.7"
|
17
|
+
s.required_rubygems_version = ">= 1.3.6"
|
18
|
+
|
19
|
+
s.add_development_dependency "automatiek", "~> 0.1.0"
|
20
|
+
s.add_development_dependency "mustache", "0.99.6"
|
21
|
+
s.add_development_dependency "rake", "~> 10.0"
|
22
|
+
s.add_development_dependency "rdiscount", "~> 1.6"
|
23
|
+
s.add_development_dependency "ronn", "~> 0.7.3"
|
24
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
|
26
|
+
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
# we don't check in man pages, but we need to ship them because
|
28
|
+
# we use them to generate the long-form help for each command.
|
29
|
+
s.files += Dir.glob("lib/bundler/man/**/*")
|
30
|
+
|
31
|
+
s.bindir = "exe"
|
32
|
+
s.executables = %w(bundle bundler)
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
end
|
data/exe/bundle
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Exit cleanly from an early interrupt
|
4
|
+
Signal.trap("INT") { exit 1 }
|
5
|
+
|
6
|
+
require "bundler"
|
7
|
+
# Check if an older version of bundler is installed
|
8
|
+
$LOAD_PATH.each do |path|
|
9
|
+
if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
|
10
|
+
err = "Looks like you have a version of bundler that's older than 0.9.\n"
|
11
|
+
err << "Please remove your old versions.\n"
|
12
|
+
err << "An easy way to do this is by running `gem cleanup bundler`."
|
13
|
+
abort(err)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require "bundler/friendly_errors"
|
18
|
+
Bundler.with_friendly_errors do
|
19
|
+
require "bundler/cli"
|
20
|
+
Bundler::CLI.start(ARGV, :debug => true)
|
21
|
+
end
|
data/exe/bundle_ruby
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Signal.trap("INT") { exit 1 }
|
4
|
+
|
5
|
+
require "bundler/ruby_version"
|
6
|
+
require "bundler/ruby_dsl"
|
7
|
+
require "bundler/shared_helpers"
|
8
|
+
|
9
|
+
module Bundler
|
10
|
+
class GemfileError < RuntimeError; end
|
11
|
+
class GemfileEvalError < GemfileError; end
|
12
|
+
|
13
|
+
class Dsl
|
14
|
+
include RubyDsl
|
15
|
+
|
16
|
+
attr_accessor :ruby_version
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@ruby_version = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def eval_gemfile(gemfile, contents = nil)
|
23
|
+
contents ||= File.open(gemfile, "rb") {|f| f.read }
|
24
|
+
instance_eval(contents, gemfile.to_s, 1)
|
25
|
+
rescue SyntaxError => e
|
26
|
+
bt = e.message.split("\n")[1..-1]
|
27
|
+
raise GemfileError, ["Gemfile syntax error:", *bt].join("\n")
|
28
|
+
rescue ScriptError, RegexpError, NameError, ArgumentError => e
|
29
|
+
e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})"
|
30
|
+
STDERR.puts e.backtrace.join("\n ")
|
31
|
+
raise GemfileError, "There was an error in your Gemfile," \
|
32
|
+
" and Bundler cannot continue."
|
33
|
+
end
|
34
|
+
|
35
|
+
def source(source, options = {})
|
36
|
+
end
|
37
|
+
|
38
|
+
def gem(name, *args)
|
39
|
+
end
|
40
|
+
|
41
|
+
def group(*args, &blk)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
STDERR.puts "Warning: bundle_ruby will be deprecated in Bundler 2.0.0."
|
47
|
+
|
48
|
+
dsl = Bundler::Dsl.new
|
49
|
+
begin
|
50
|
+
dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile)
|
51
|
+
ruby_version = dsl.ruby_version
|
52
|
+
if ruby_version
|
53
|
+
puts ruby_version
|
54
|
+
else
|
55
|
+
puts "No ruby version specified"
|
56
|
+
end
|
57
|
+
rescue Bundler::GemfileError => e
|
58
|
+
puts e.message
|
59
|
+
exit(-1)
|
60
|
+
end
|
data/exe/bundler
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Exit cleanly from an early interrupt
|
4
|
+
Signal.trap("INT") { exit 1 }
|
5
|
+
|
6
|
+
require "bundler"
|
7
|
+
# Check if an older version of bundler is installed
|
8
|
+
$LOAD_PATH.each do |path|
|
9
|
+
if path =~ %r'/bundler-0\.(\d+)' && $1.to_i < 9
|
10
|
+
err = "Looks like you have a version of bundler that's older than 0.9.\n"
|
11
|
+
err << "Please remove your old versions.\n"
|
12
|
+
err << "An easy way to do this is by running `gem cleanup bundler`."
|
13
|
+
abort(err)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require "bundler/friendly_errors"
|
18
|
+
Bundler.with_friendly_errors do
|
19
|
+
require "bundler/cli"
|
20
|
+
Bundler::CLI.start(ARGV, :debug => true)
|
21
|
+
end
|
data/lib/bundler.rb
ADDED
@@ -0,0 +1,499 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "pathname"
|
3
|
+
require "rbconfig"
|
4
|
+
require "thread"
|
5
|
+
require "bundler/gem_path_manipulation"
|
6
|
+
require "bundler/rubygems_ext"
|
7
|
+
require "bundler/rubygems_integration"
|
8
|
+
require "bundler/version"
|
9
|
+
require "bundler/constants"
|
10
|
+
require "bundler/current_ruby"
|
11
|
+
|
12
|
+
module Bundler
|
13
|
+
preserve_gem_path
|
14
|
+
ORIGINAL_ENV = ENV.to_hash
|
15
|
+
SUDO_MUTEX = Mutex.new
|
16
|
+
|
17
|
+
autoload :Definition, "bundler/definition"
|
18
|
+
autoload :Dependency, "bundler/dependency"
|
19
|
+
autoload :DepProxy, "bundler/dep_proxy"
|
20
|
+
autoload :Deprecate, "bundler/deprecate"
|
21
|
+
autoload :Dsl, "bundler/dsl"
|
22
|
+
autoload :EndpointSpecification, "bundler/endpoint_specification"
|
23
|
+
autoload :Environment, "bundler/environment"
|
24
|
+
autoload :Env, "bundler/env"
|
25
|
+
autoload :Fetcher, "bundler/fetcher"
|
26
|
+
autoload :GemHelper, "bundler/gem_helper"
|
27
|
+
autoload :GemHelpers, "bundler/gem_helpers"
|
28
|
+
autoload :GemInstaller, "bundler/gem_installer"
|
29
|
+
autoload :Graph, "bundler/graph"
|
30
|
+
autoload :Index, "bundler/index"
|
31
|
+
autoload :Installer, "bundler/installer"
|
32
|
+
autoload :Injector, "bundler/injector"
|
33
|
+
autoload :LazySpecification, "bundler/lazy_specification"
|
34
|
+
autoload :LockfileParser, "bundler/lockfile_parser"
|
35
|
+
autoload :MatchPlatform, "bundler/match_platform"
|
36
|
+
autoload :RemoteSpecification, "bundler/remote_specification"
|
37
|
+
autoload :Resolver, "bundler/resolver"
|
38
|
+
autoload :Retry, "bundler/retry"
|
39
|
+
autoload :RubyVersion, "bundler/ruby_version"
|
40
|
+
autoload :RubyDsl, "bundler/ruby_dsl"
|
41
|
+
autoload :Runtime, "bundler/runtime"
|
42
|
+
autoload :Settings, "bundler/settings"
|
43
|
+
autoload :SharedHelpers, "bundler/shared_helpers"
|
44
|
+
autoload :SpecSet, "bundler/spec_set"
|
45
|
+
autoload :StubSpecification, "bundler/stub_specification"
|
46
|
+
autoload :Source, "bundler/source"
|
47
|
+
autoload :SourceList, "bundler/source_list"
|
48
|
+
autoload :Specification, "bundler/shared_helpers"
|
49
|
+
autoload :SystemRubyVersion, "bundler/ruby_version"
|
50
|
+
autoload :UI, "bundler/ui"
|
51
|
+
|
52
|
+
class BundlerError < StandardError
|
53
|
+
def self.status_code(code)
|
54
|
+
define_method(:status_code) { code }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class GemfileNotFound < BundlerError; status_code(10); end
|
59
|
+
class GemNotFound < BundlerError; status_code(7); end
|
60
|
+
class GemfileError < BundlerError; status_code(4); end
|
61
|
+
class InstallError < BundlerError; status_code(5); end
|
62
|
+
class InstallHookError < BundlerError; status_code(8); end
|
63
|
+
class PathError < BundlerError; status_code(13); end
|
64
|
+
class GitError < BundlerError; status_code(11); end
|
65
|
+
class DeprecatedError < BundlerError; status_code(12); end
|
66
|
+
class GemspecError < BundlerError; status_code(14); end
|
67
|
+
class InvalidOption < BundlerError; status_code(15); end
|
68
|
+
class ProductionError < BundlerError; status_code(16); end
|
69
|
+
class HTTPError < BundlerError; status_code(17); end
|
70
|
+
class RubyVersionMismatch < BundlerError; status_code(18); end
|
71
|
+
class SecurityError < BundlerError; status_code(19); end
|
72
|
+
class LockfileError < BundlerError; status_code(20); end
|
73
|
+
class CyclicDependencyError < BundlerError; status_code(21); end
|
74
|
+
class GemfileLockNotFound < BundlerError; status_code(22); end
|
75
|
+
|
76
|
+
# Internal errors, should be rescued
|
77
|
+
class VersionConflict < BundlerError
|
78
|
+
attr_reader :conflicts
|
79
|
+
|
80
|
+
def initialize(conflicts, msg = nil)
|
81
|
+
super(msg)
|
82
|
+
@conflicts = conflicts
|
83
|
+
end
|
84
|
+
|
85
|
+
status_code(6)
|
86
|
+
end
|
87
|
+
|
88
|
+
class GemRequireError < BundlerError
|
89
|
+
attr_reader :orig_exception
|
90
|
+
|
91
|
+
def initialize(orig_exception, msg)
|
92
|
+
super(msg)
|
93
|
+
@orig_exception = orig_exception
|
94
|
+
end
|
95
|
+
|
96
|
+
status_code(24)
|
97
|
+
end
|
98
|
+
|
99
|
+
class GemfileEvalError < GemfileError; end
|
100
|
+
class MarshalError < StandardError; end
|
101
|
+
|
102
|
+
class PermissionError < BundlerError
|
103
|
+
def initialize(path, permission_type = :write)
|
104
|
+
@path = path
|
105
|
+
@permission_type = permission_type
|
106
|
+
end
|
107
|
+
|
108
|
+
def message
|
109
|
+
action = case @permission_type
|
110
|
+
when :read then "read from"
|
111
|
+
when :write then "write to"
|
112
|
+
when :executable, :exec then "execute"
|
113
|
+
else @permission_type.to_s
|
114
|
+
end
|
115
|
+
"There was an error while trying to #{action} `#{@path}`. " \
|
116
|
+
"It is likely that you need to grant #{@permission_type} permissions " \
|
117
|
+
"for that path."
|
118
|
+
end
|
119
|
+
|
120
|
+
status_code(23)
|
121
|
+
end
|
122
|
+
|
123
|
+
class << self
|
124
|
+
attr_writer :bundle_path
|
125
|
+
|
126
|
+
def configure
|
127
|
+
@configured ||= configure_gem_home_and_path
|
128
|
+
end
|
129
|
+
|
130
|
+
def ui
|
131
|
+
(defined?(@ui) && @ui) || (self.ui = UI::Silent.new)
|
132
|
+
end
|
133
|
+
|
134
|
+
def ui=(ui)
|
135
|
+
Bundler.rubygems.ui = ui ? UI::RGProxy.new(ui) : nil
|
136
|
+
@ui = ui
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns absolute path of where gems are installed on the filesystem.
|
140
|
+
def bundle_path
|
141
|
+
@bundle_path ||= Pathname.new(settings.path).expand_path(root)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns absolute location of where binstubs are installed to.
|
145
|
+
def bin_path
|
146
|
+
@bin_path ||= begin
|
147
|
+
path = settings[:bin] || "bin"
|
148
|
+
path = Pathname.new(path).expand_path(root).expand_path
|
149
|
+
SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }
|
150
|
+
path
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def setup(*groups)
|
155
|
+
# Just return if all groups are already loaded
|
156
|
+
return @setup if defined?(@setup)
|
157
|
+
|
158
|
+
definition.validate_ruby!
|
159
|
+
|
160
|
+
if groups.empty?
|
161
|
+
# Load all groups, but only once
|
162
|
+
@setup = load.setup
|
163
|
+
else
|
164
|
+
load.setup(*groups)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def require(*groups)
|
169
|
+
setup(*groups).require(*groups)
|
170
|
+
end
|
171
|
+
|
172
|
+
def load
|
173
|
+
@load ||= Runtime.new(root, definition)
|
174
|
+
end
|
175
|
+
|
176
|
+
def environment
|
177
|
+
Bundler::Environment.new(root, definition)
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns an instance of Bundler::Definition for given Gemfile and lockfile
|
181
|
+
#
|
182
|
+
# @param unlock [Hash, Boolean, nil] Gems that have been requested
|
183
|
+
# to be updated or true if all gems should be updated
|
184
|
+
# @return [Bundler::Definition]
|
185
|
+
def definition(unlock = nil)
|
186
|
+
@definition = nil if unlock
|
187
|
+
@definition ||= begin
|
188
|
+
configure
|
189
|
+
upgrade_lockfile
|
190
|
+
Definition.build(default_gemfile, default_lockfile, unlock)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def locked_gems
|
195
|
+
return @locked_gems if defined?(@locked_gems)
|
196
|
+
if Bundler.default_lockfile.exist?
|
197
|
+
lock = Bundler.read_file(Bundler.default_lockfile)
|
198
|
+
@locked_gems = LockfileParser.new(lock)
|
199
|
+
else
|
200
|
+
@locked_gems = nil
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def ruby_scope
|
205
|
+
"#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}"
|
206
|
+
end
|
207
|
+
|
208
|
+
def user_bundle_path
|
209
|
+
Pathname.new(Bundler.rubygems.user_home).join(".bundler")
|
210
|
+
end
|
211
|
+
|
212
|
+
def home
|
213
|
+
bundle_path.join("bundler")
|
214
|
+
end
|
215
|
+
|
216
|
+
def install_path
|
217
|
+
home.join("gems")
|
218
|
+
end
|
219
|
+
|
220
|
+
def specs_path
|
221
|
+
bundle_path.join("specifications")
|
222
|
+
end
|
223
|
+
|
224
|
+
def cache
|
225
|
+
bundle_path.join("cache/bundler")
|
226
|
+
end
|
227
|
+
|
228
|
+
def root
|
229
|
+
@root ||= begin
|
230
|
+
default_gemfile.dirname.expand_path
|
231
|
+
rescue GemfileNotFound
|
232
|
+
bundle_dir = default_bundle_dir
|
233
|
+
raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
|
234
|
+
Pathname.new(File.expand_path("..", bundle_dir))
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def app_config_path
|
239
|
+
if ENV["BUNDLE_APP_CONFIG"]
|
240
|
+
Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root)
|
241
|
+
else
|
242
|
+
root.join(".bundle")
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def app_cache(custom_path = nil)
|
247
|
+
path = custom_path || root
|
248
|
+
path.join(self.settings.app_cache_path)
|
249
|
+
end
|
250
|
+
|
251
|
+
def tmp(name = Process.pid.to_s)
|
252
|
+
Pathname.new(Dir.mktmpdir(["bundler", name]))
|
253
|
+
end
|
254
|
+
|
255
|
+
def rm_rf(path)
|
256
|
+
FileUtils.remove_entry_secure(path) if path && File.exist?(path)
|
257
|
+
end
|
258
|
+
|
259
|
+
def settings
|
260
|
+
return @settings if defined?(@settings)
|
261
|
+
@settings = Settings.new(app_config_path)
|
262
|
+
rescue GemfileNotFound
|
263
|
+
@settings = Settings.new(Pathname.new(".bundle").expand_path)
|
264
|
+
end
|
265
|
+
|
266
|
+
def with_original_env
|
267
|
+
bundled_env = ENV.to_hash
|
268
|
+
ENV.replace(ORIGINAL_ENV)
|
269
|
+
yield
|
270
|
+
ensure
|
271
|
+
ENV.replace(bundled_env.to_hash)
|
272
|
+
end
|
273
|
+
|
274
|
+
def with_clean_env
|
275
|
+
with_original_env do
|
276
|
+
ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
|
277
|
+
ENV.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
|
278
|
+
|
279
|
+
if ENV.key?("RUBYOPT")
|
280
|
+
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
|
281
|
+
end
|
282
|
+
|
283
|
+
if ENV.key?("RUBYLIB")
|
284
|
+
rubylib = ENV["RUBYLIB"].split(File::PATH_SEPARATOR)
|
285
|
+
rubylib.delete(File.expand_path("..", __FILE__))
|
286
|
+
ENV["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
|
287
|
+
end
|
288
|
+
|
289
|
+
yield
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
def clean_system(*args)
|
294
|
+
with_clean_env { Kernel.system(*args) }
|
295
|
+
end
|
296
|
+
|
297
|
+
def clean_exec(*args)
|
298
|
+
with_clean_env { Kernel.exec(*args) }
|
299
|
+
end
|
300
|
+
|
301
|
+
def default_gemfile
|
302
|
+
SharedHelpers.default_gemfile
|
303
|
+
end
|
304
|
+
|
305
|
+
def default_lockfile
|
306
|
+
SharedHelpers.default_lockfile
|
307
|
+
end
|
308
|
+
|
309
|
+
def default_bundle_dir
|
310
|
+
SharedHelpers.default_bundle_dir
|
311
|
+
end
|
312
|
+
|
313
|
+
def system_bindir
|
314
|
+
# Gem.bindir doesn't always return the location that Rubygems will install
|
315
|
+
# system binaries. If you put '-n foo' in your .gemrc, Rubygems will
|
316
|
+
# install binstubs there instead. Unfortunately, Rubygems doesn't expose
|
317
|
+
# that directory at all, so rather than parse .gemrc ourselves, we allow
|
318
|
+
# the directory to be set as well, via `bundle config bindir foo`.
|
319
|
+
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
|
320
|
+
end
|
321
|
+
|
322
|
+
def requires_sudo?
|
323
|
+
return @requires_sudo if defined?(@requires_sudo_ran)
|
324
|
+
|
325
|
+
if settings.allow_sudo?
|
326
|
+
sudo_present = which "sudo"
|
327
|
+
end
|
328
|
+
|
329
|
+
if sudo_present
|
330
|
+
# the bundle path and subdirectories need to be writable for Rubygems
|
331
|
+
# to be able to unpack and install gems without exploding
|
332
|
+
path = bundle_path
|
333
|
+
path = path.parent until path.exist?
|
334
|
+
|
335
|
+
# bins are written to a different location on OS X
|
336
|
+
bin_dir = Pathname.new(Bundler.system_bindir)
|
337
|
+
bin_dir = bin_dir.parent until bin_dir.exist?
|
338
|
+
|
339
|
+
# if any directory is not writable, we need sudo
|
340
|
+
files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s]
|
341
|
+
sudo_needed = files.any? {|f| !File.writable?(f) }
|
342
|
+
end
|
343
|
+
|
344
|
+
@requires_sudo_ran = true
|
345
|
+
@requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed
|
346
|
+
end
|
347
|
+
|
348
|
+
def mkdir_p(path)
|
349
|
+
if requires_sudo?
|
350
|
+
sudo "mkdir -p '#{path}'" unless File.exist?(path)
|
351
|
+
else
|
352
|
+
SharedHelpers.filesystem_access(path, :write) do |p|
|
353
|
+
FileUtils.mkdir_p(p)
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
def which(executable)
|
359
|
+
if File.file?(executable) && File.executable?(executable)
|
360
|
+
executable
|
361
|
+
elsif ENV["PATH"]
|
362
|
+
path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |p|
|
363
|
+
abs_path = File.join(p, executable)
|
364
|
+
File.file?(abs_path) && File.executable?(abs_path)
|
365
|
+
end
|
366
|
+
path && File.expand_path(executable, path)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
def sudo(str)
|
371
|
+
SUDO_MUTEX.synchronize do
|
372
|
+
prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
|
373
|
+
Your user account isn't allowed to install to the system Rubygems.
|
374
|
+
You can cancel this installation and run:
|
375
|
+
|
376
|
+
bundle install --path vendor/bundle
|
377
|
+
|
378
|
+
to install the gems into ./vendor/bundle/, or you can enter your password
|
379
|
+
and install the bundled gems to Rubygems using sudo.
|
380
|
+
|
381
|
+
Password:
|
382
|
+
PROMPT
|
383
|
+
|
384
|
+
`sudo -p "#{prompt}" #{str}`
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def read_file(file)
|
389
|
+
File.open(file, "rb") {|f| f.read }
|
390
|
+
end
|
391
|
+
|
392
|
+
def load_marshal(data)
|
393
|
+
Marshal.load(data)
|
394
|
+
rescue => e
|
395
|
+
raise MarshalError, "#{e.class}: #{e.message}"
|
396
|
+
end
|
397
|
+
|
398
|
+
def load_gemspec(file, validate = false)
|
399
|
+
@gemspec_cache ||= {}
|
400
|
+
key = File.expand_path(file)
|
401
|
+
@gemspec_cache[key] ||= load_gemspec_uncached(file, validate)
|
402
|
+
# Protect against caching side-effected gemspecs by returning a
|
403
|
+
# new instance each time.
|
404
|
+
@gemspec_cache[key].dup if @gemspec_cache[key]
|
405
|
+
end
|
406
|
+
|
407
|
+
def load_gemspec_uncached(file, validate = false)
|
408
|
+
path = Pathname.new(file)
|
409
|
+
# Eval the gemspec from its parent directory, because some gemspecs
|
410
|
+
# depend on "./" relative paths.
|
411
|
+
SharedHelpers.chdir(path.dirname.to_s) do
|
412
|
+
contents = path.read
|
413
|
+
if contents[0..2] == "---" # YAML header
|
414
|
+
spec = eval_yaml_gemspec(path, contents)
|
415
|
+
else
|
416
|
+
spec = eval_gemspec(path, contents)
|
417
|
+
end
|
418
|
+
Bundler.rubygems.validate(spec) if spec && validate
|
419
|
+
spec
|
420
|
+
end
|
421
|
+
rescue Gem::InvalidSpecificationException => e
|
422
|
+
UI::Shell.new.warn "The gemspec at #{file} is not valid. " \
|
423
|
+
"The validation error was '#{e.message}'"
|
424
|
+
nil
|
425
|
+
end
|
426
|
+
|
427
|
+
def clear_gemspec_cache
|
428
|
+
@gemspec_cache = {}
|
429
|
+
end
|
430
|
+
|
431
|
+
def git_present?
|
432
|
+
return @git_present if defined?(@git_present)
|
433
|
+
@git_present = Bundler.which("git") || Bundler.which("git.exe")
|
434
|
+
end
|
435
|
+
|
436
|
+
def ruby_version
|
437
|
+
@ruby_version ||= SystemRubyVersion.new
|
438
|
+
end
|
439
|
+
|
440
|
+
def reset!
|
441
|
+
@definition = nil
|
442
|
+
end
|
443
|
+
|
444
|
+
private
|
445
|
+
|
446
|
+
def eval_yaml_gemspec(path, contents)
|
447
|
+
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
|
448
|
+
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
|
449
|
+
Gem::Specification.from_yaml(contents)
|
450
|
+
rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
451
|
+
eval_gemspec(path, contents)
|
452
|
+
end
|
453
|
+
|
454
|
+
def eval_gemspec(path, contents)
|
455
|
+
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
|
456
|
+
rescue ScriptError, StandardError => e
|
457
|
+
original_line = e.backtrace.find {|line| line.include?(path.to_s) }
|
458
|
+
msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}"
|
459
|
+
msg << " from\n #{original_line}" if original_line
|
460
|
+
msg << "\n"
|
461
|
+
|
462
|
+
if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
|
463
|
+
msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
|
464
|
+
end
|
465
|
+
|
466
|
+
raise GemspecError, msg
|
467
|
+
end
|
468
|
+
|
469
|
+
def configure_gem_home_and_path
|
470
|
+
blank_home = ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty?
|
471
|
+
if settings[:disable_shared_gems]
|
472
|
+
ENV["GEM_PATH"] = ""
|
473
|
+
elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
|
474
|
+
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
|
475
|
+
paths = possibles.flatten.compact.uniq.reject(&:empty?)
|
476
|
+
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
477
|
+
end
|
478
|
+
|
479
|
+
configure_gem_home
|
480
|
+
bundle_path
|
481
|
+
end
|
482
|
+
|
483
|
+
def configure_gem_home
|
484
|
+
# TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
|
485
|
+
FileUtils.mkdir_p bundle_path.to_s rescue nil
|
486
|
+
|
487
|
+
ENV["GEM_HOME"] = File.expand_path(bundle_path, root)
|
488
|
+
Bundler.rubygems.clear_paths
|
489
|
+
end
|
490
|
+
|
491
|
+
def upgrade_lockfile
|
492
|
+
lockfile = default_lockfile
|
493
|
+
if lockfile.exist? && lockfile.read(3) == "---"
|
494
|
+
Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
|
495
|
+
lockfile.rmtree
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|