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.
- checksums.yaml +4 -4
- data/.travis.yml +18 -24
- data/CODE_OF_CONDUCT.md +2 -2
- data/CONTRIBUTING.rdoc +1 -1
- data/History.txt +30 -1
- data/Manifest.txt +233 -3
- data/Rakefile +30 -1
- data/appveyor.yml +0 -2
- data/bundler/CHANGELOG.md +2407 -0
- data/bundler/CODE_OF_CONDUCT.md +42 -0
- data/bundler/CONTRIBUTING.md +36 -0
- data/bundler/DEVELOPMENT.md +148 -0
- data/bundler/ISSUES.md +100 -0
- data/bundler/LICENSE.md +23 -0
- data/bundler/README.md +40 -0
- data/bundler/exe/bundle +35 -0
- data/bundler/exe/bundle_ruby +61 -0
- data/bundler/exe/bundler +22 -0
- data/bundler/lib/bundler.rb +455 -0
- data/bundler/lib/bundler/capistrano.rb +17 -0
- data/bundler/lib/bundler/cli.rb +497 -0
- data/bundler/lib/bundler/cli/binstubs.rb +40 -0
- data/bundler/lib/bundler/cli/cache.rb +35 -0
- data/bundler/lib/bundler/cli/check.rb +40 -0
- data/bundler/lib/bundler/cli/clean.rb +26 -0
- data/bundler/lib/bundler/cli/common.rb +56 -0
- data/bundler/lib/bundler/cli/config.rb +100 -0
- data/bundler/lib/bundler/cli/console.rb +39 -0
- data/bundler/lib/bundler/cli/exec.rb +82 -0
- data/bundler/lib/bundler/cli/gem.rb +214 -0
- data/bundler/lib/bundler/cli/init.rb +33 -0
- data/bundler/lib/bundler/cli/inject.rb +33 -0
- data/bundler/lib/bundler/cli/install.rb +225 -0
- data/bundler/lib/bundler/cli/lock.rb +48 -0
- data/bundler/lib/bundler/cli/open.rb +25 -0
- data/bundler/lib/bundler/cli/outdated.rb +151 -0
- data/bundler/lib/bundler/cli/package.rb +46 -0
- data/bundler/lib/bundler/cli/platform.rb +45 -0
- data/bundler/lib/bundler/cli/plugin.rb +23 -0
- data/bundler/lib/bundler/cli/show.rb +75 -0
- data/bundler/lib/bundler/cli/update.rb +72 -0
- data/bundler/lib/bundler/cli/viz.rb +27 -0
- data/bundler/lib/bundler/constants.rb +6 -0
- data/bundler/lib/bundler/current_ruby.rb +84 -0
- data/bundler/lib/bundler/definition.rb +744 -0
- data/bundler/lib/bundler/dep_proxy.rb +46 -0
- data/bundler/lib/bundler/dependency.rb +127 -0
- data/bundler/lib/bundler/deployment.rb +63 -0
- data/bundler/lib/bundler/deprecate.rb +16 -0
- data/bundler/lib/bundler/dsl.rb +512 -0
- data/bundler/lib/bundler/endpoint_specification.rb +129 -0
- data/bundler/lib/bundler/env.rb +83 -0
- data/bundler/lib/bundler/environment.rb +42 -0
- data/bundler/lib/bundler/environment_preserver.rb +38 -0
- data/bundler/lib/bundler/errors.rb +124 -0
- data/bundler/lib/bundler/fetcher.rb +304 -0
- data/bundler/lib/bundler/fetcher/base.rb +41 -0
- data/bundler/lib/bundler/fetcher/compact_index.rb +103 -0
- data/bundler/lib/bundler/fetcher/dependency.rb +92 -0
- data/bundler/lib/bundler/fetcher/downloader.rb +66 -0
- data/bundler/lib/bundler/fetcher/index.rb +51 -0
- data/bundler/lib/bundler/friendly_errors.rb +103 -0
- data/bundler/lib/bundler/gem_helper.rb +188 -0
- data/bundler/lib/bundler/gem_helpers.rb +32 -0
- data/bundler/lib/bundler/gem_remote_fetcher.rb +42 -0
- data/bundler/lib/bundler/gem_tasks.rb +6 -0
- data/bundler/lib/bundler/graph.rb +172 -0
- data/bundler/lib/bundler/index.rb +191 -0
- data/bundler/lib/bundler/injector.rb +63 -0
- data/bundler/lib/bundler/inline.rb +74 -0
- data/bundler/lib/bundler/installer.rb +217 -0
- data/bundler/lib/bundler/installer/gem_installer.rb +77 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +126 -0
- data/bundler/lib/bundler/installer/standalone.rb +52 -0
- data/bundler/lib/bundler/lazy_specification.rb +85 -0
- data/bundler/lib/bundler/lockfile_parser.rb +233 -0
- data/bundler/lib/bundler/match_platform.rb +14 -0
- data/bundler/lib/bundler/mirror.rb +218 -0
- data/bundler/lib/bundler/plugin.rb +156 -0
- data/bundler/lib/bundler/plugin/api.rb +56 -0
- data/bundler/lib/bundler/plugin/dsl.rb +29 -0
- data/bundler/lib/bundler/plugin/index.rb +88 -0
- data/bundler/lib/bundler/plugin/installer.rb +99 -0
- data/bundler/lib/bundler/plugin/installer/git.rb +38 -0
- data/bundler/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/bundler/lib/bundler/plugin/source_list.rb +24 -0
- data/bundler/lib/bundler/postit_trampoline.rb +57 -0
- data/bundler/lib/bundler/psyched_yaml.rb +27 -0
- data/bundler/lib/bundler/remote_specification.rb +85 -0
- data/bundler/lib/bundler/resolver.rb +368 -0
- data/bundler/lib/bundler/retry.rb +61 -0
- data/bundler/lib/bundler/ruby_dsl.rb +17 -0
- data/bundler/lib/bundler/ruby_version.rb +140 -0
- data/bundler/lib/bundler/rubygems_ext.rb +178 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +10 -0
- data/bundler/lib/bundler/rubygems_integration.rb +710 -0
- data/bundler/lib/bundler/runtime.rb +282 -0
- data/bundler/lib/bundler/settings.rb +259 -0
- data/bundler/lib/bundler/setup.rb +28 -0
- data/bundler/lib/bundler/shared_helpers.rb +212 -0
- data/bundler/lib/bundler/similarity_detector.rb +62 -0
- data/bundler/lib/bundler/source.rb +37 -0
- data/bundler/lib/bundler/source/gemspec.rb +13 -0
- data/bundler/lib/bundler/source/git.rb +297 -0
- data/bundler/lib/bundler/source/git/git_proxy.rb +218 -0
- data/bundler/lib/bundler/source/path.rb +245 -0
- data/bundler/lib/bundler/source/path/installer.rb +44 -0
- data/bundler/lib/bundler/source/rubygems.rb +450 -0
- data/bundler/lib/bundler/source/rubygems/remote.rb +59 -0
- data/bundler/lib/bundler/source_list.rb +106 -0
- data/bundler/lib/bundler/spec_set.rb +157 -0
- data/bundler/lib/bundler/ssl_certs/.document +1 -0
- data/bundler/lib/bundler/ssl_certs/certificate_manager.rb +65 -0
- data/bundler/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/bundler/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/{lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot-2048.pem → bundler/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem} +0 -0
- data/bundler/lib/bundler/stub_specification.rb +24 -0
- data/bundler/lib/bundler/templates/Executable +17 -0
- data/bundler/lib/bundler/templates/Executable.standalone +12 -0
- data/bundler/lib/bundler/templates/Gemfile +5 -0
- data/bundler/lib/bundler/templates/newgem/.travis.yml.tt +5 -0
- data/bundler/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +74 -0
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/bundler/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +41 -0
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +29 -0
- data/bundler/lib/bundler/templates/newgem/bin/console.tt +14 -0
- data/bundler/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/bundler/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/bundler/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/bundler/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +46 -0
- data/bundler/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/test/newgem_test.rb.tt +11 -0
- data/bundler/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/bundler/lib/bundler/ui.rb +8 -0
- data/bundler/lib/bundler/ui/rg_proxy.rb +18 -0
- data/bundler/lib/bundler/ui/shell.rb +114 -0
- data/bundler/lib/bundler/ui/silent.rb +48 -0
- data/bundler/lib/bundler/uri_credentials_filter.rb +36 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +79 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +98 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +80 -0
- data/bundler/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +4 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo.rb +10 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +203 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +5 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +100 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +65 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +460 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +45 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +54 -0
- data/bundler/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/bundler/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/bundler/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit.rb +15 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
- data/bundler/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +484 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +319 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +103 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +59 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +118 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +135 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +316 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +107 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/base.rb +656 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/command.rb +133 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +10 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +98 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +32 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/group.rb +281 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +35 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +73 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +175 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/option.rb +125 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +218 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +71 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/runner.rb +322 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +421 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +149 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb +126 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +267 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/bundler/lib/bundler/vendored_molinillo.rb +3 -0
- data/bundler/lib/bundler/vendored_persistent.rb +12 -0
- data/bundler/lib/bundler/vendored_thor.rb +4 -0
- data/bundler/lib/bundler/version.rb +11 -0
- data/bundler/lib/bundler/vlad.rb +12 -0
- data/bundler/lib/bundler/worker.rb +82 -0
- data/bundler/lib/bundler/yaml_serializer.rb +67 -0
- data/bundler/man/bundle-config.ronn +193 -0
- data/bundler/man/bundle-exec.ronn +136 -0
- data/bundler/man/bundle-gem.ronn +77 -0
- data/bundler/man/bundle-install.ronn +404 -0
- data/bundler/man/bundle-lock.ronn +47 -0
- data/bundler/man/bundle-package.ronn +67 -0
- data/bundler/man/bundle-platform.ronn +42 -0
- data/bundler/man/bundle-update.ronn +194 -0
- data/bundler/man/bundle.ronn +98 -0
- data/bundler/man/gemfile.5.ronn +499 -0
- data/bundler/man/index.txt +8 -0
- data/lib/rubygems.rb +42 -2
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/defaults.rb +18 -0
- data/lib/rubygems/installer.rb +1 -0
- data/lib/rubygems/package.rb +3 -1
- data/lib/rubygems/package/tar_writer.rb +10 -16
- data/lib/rubygems/remote_fetcher.rb +1 -15
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +57 -145
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +55 -54
- data/lib/rubygems/resolver/molinillo/lib/molinillo/state.rb +4 -2
- data/lib/rubygems/security/signer.rb +2 -0
- data/lib/rubygems/specification.rb +4 -4
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +25 -0
- data/test/rubygems/alternate_cert.pem +10 -9
- data/test/rubygems/alternate_cert_32.pem +10 -9
- data/test/rubygems/child_cert.pem +11 -9
- data/test/rubygems/child_cert_32.pem +11 -9
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/expired_cert.pem +9 -8
- data/test/rubygems/future_cert.pem +9 -8
- data/test/rubygems/future_cert_32.pem +9 -8
- data/test/rubygems/grandchild_cert.pem +11 -9
- data/test/rubygems/grandchild_cert_32.pem +11 -9
- data/test/rubygems/invalid_issuer_cert.pem +11 -9
- data/test/rubygems/invalid_issuer_cert_32.pem +11 -9
- data/test/rubygems/invalid_signer_cert.pem +10 -9
- data/test/rubygems/invalid_signer_cert_32.pem +10 -9
- data/test/rubygems/invalidchild_cert.pem +11 -9
- data/test/rubygems/invalidchild_cert_32.pem +11 -9
- data/test/rubygems/public_cert.pem +11 -9
- data/test/rubygems/public_cert_32.pem +10 -9
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_gem.rb +7 -0
- data/test/rubygems/test_gem_installer.rb +119 -0
- data/test/rubygems/test_gem_package.rb +9 -3
- data/test/rubygems/test_gem_package_tar_writer.rb +24 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +0 -12
- data/test/rubygems/test_gem_security_signer.rb +8 -0
- data/test/rubygems/test_gem_specification.rb +1 -1
- data/test/rubygems/wrong_key_cert.pem +10 -9
- data/test/rubygems/wrong_key_cert_32.pem +10 -9
- data/util/ci +73 -0
- data/util/create_certs.rb +64 -49
- data/util/update_bundled_ca_certificates.rb +23 -2
- metadata +257 -19
- data/lib/gauntlet_rubygems.rb +0 -51
- data/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler
|
3
|
+
class DepProxy
|
4
|
+
attr_reader :__platform, :dep
|
5
|
+
|
6
|
+
def initialize(dep, platform)
|
7
|
+
@dep = dep
|
8
|
+
@__platform = platform
|
9
|
+
end
|
10
|
+
|
11
|
+
def hash
|
12
|
+
@hash ||= dep.hash
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
dep == other.dep && __platform == other.__platform
|
17
|
+
end
|
18
|
+
|
19
|
+
alias_method :eql?, :==
|
20
|
+
|
21
|
+
def type
|
22
|
+
@dep.type
|
23
|
+
end
|
24
|
+
|
25
|
+
def name
|
26
|
+
@dep.name
|
27
|
+
end
|
28
|
+
|
29
|
+
def requirement
|
30
|
+
@dep.requirement
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
s = name.dup
|
35
|
+
s << " (#{requirement})" unless requirement == Gem::Requirement.default
|
36
|
+
s << " #{__platform}" unless __platform == Gem::Platform::RUBY
|
37
|
+
s
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def method_missing(*args, &blk)
|
43
|
+
@dep.send(*args, &blk)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "rubygems/dependency"
|
3
|
+
require "bundler/shared_helpers"
|
4
|
+
require "bundler/rubygems_ext"
|
5
|
+
|
6
|
+
module Bundler
|
7
|
+
class Dependency < Gem::Dependency
|
8
|
+
attr_reader :autorequire
|
9
|
+
attr_reader :groups
|
10
|
+
attr_reader :platforms
|
11
|
+
|
12
|
+
PLATFORM_MAP = {
|
13
|
+
:ruby => Gem::Platform::RUBY,
|
14
|
+
:ruby_18 => Gem::Platform::RUBY,
|
15
|
+
:ruby_19 => Gem::Platform::RUBY,
|
16
|
+
:ruby_20 => Gem::Platform::RUBY,
|
17
|
+
:ruby_21 => Gem::Platform::RUBY,
|
18
|
+
:ruby_22 => Gem::Platform::RUBY,
|
19
|
+
:ruby_23 => Gem::Platform::RUBY,
|
20
|
+
:mri => Gem::Platform::RUBY,
|
21
|
+
:mri_18 => Gem::Platform::RUBY,
|
22
|
+
:mri_19 => Gem::Platform::RUBY,
|
23
|
+
:mri_20 => Gem::Platform::RUBY,
|
24
|
+
:mri_21 => Gem::Platform::RUBY,
|
25
|
+
:mri_22 => Gem::Platform::RUBY,
|
26
|
+
:mri_23 => Gem::Platform::RUBY,
|
27
|
+
:rbx => Gem::Platform::RUBY,
|
28
|
+
:jruby => Gem::Platform::JAVA,
|
29
|
+
:jruby_18 => Gem::Platform::JAVA,
|
30
|
+
:jruby_19 => Gem::Platform::JAVA,
|
31
|
+
:mswin => Gem::Platform::MSWIN,
|
32
|
+
:mswin_18 => Gem::Platform::MSWIN,
|
33
|
+
:mswin_19 => Gem::Platform::MSWIN,
|
34
|
+
:mswin_20 => Gem::Platform::MSWIN,
|
35
|
+
:mswin_21 => Gem::Platform::MSWIN,
|
36
|
+
:mswin_22 => Gem::Platform::MSWIN,
|
37
|
+
:mswin_23 => Gem::Platform::MSWIN,
|
38
|
+
:mswin64 => Gem::Platform::MSWIN64,
|
39
|
+
:mswin64_19 => Gem::Platform::MSWIN64,
|
40
|
+
:mswin64_20 => Gem::Platform::MSWIN64,
|
41
|
+
:mswin64_21 => Gem::Platform::MSWIN64,
|
42
|
+
:mswin64_22 => Gem::Platform::MSWIN64,
|
43
|
+
:mswin64_23 => Gem::Platform::MSWIN64,
|
44
|
+
:mingw => Gem::Platform::MINGW,
|
45
|
+
:mingw_18 => Gem::Platform::MINGW,
|
46
|
+
:mingw_19 => Gem::Platform::MINGW,
|
47
|
+
:mingw_20 => Gem::Platform::MINGW,
|
48
|
+
:mingw_21 => Gem::Platform::MINGW,
|
49
|
+
:mingw_22 => Gem::Platform::MINGW,
|
50
|
+
:mingw_23 => Gem::Platform::MINGW,
|
51
|
+
:x64_mingw => Gem::Platform::X64_MINGW,
|
52
|
+
:x64_mingw_20 => Gem::Platform::X64_MINGW,
|
53
|
+
:x64_mingw_21 => Gem::Platform::X64_MINGW,
|
54
|
+
:x64_mingw_22 => Gem::Platform::X64_MINGW,
|
55
|
+
:x64_mingw_23 => Gem::Platform::X64_MINGW
|
56
|
+
}.freeze
|
57
|
+
|
58
|
+
REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
|
59
|
+
PLATFORM_MAP.each do |key, value|
|
60
|
+
reverse_platform_map[value] ||= []
|
61
|
+
reverse_platform_map[value] << key
|
62
|
+
end
|
63
|
+
|
64
|
+
reverse_platform_map.each {|_, platforms| platforms.freeze }
|
65
|
+
end.freeze
|
66
|
+
|
67
|
+
def initialize(name, version, options = {}, &blk)
|
68
|
+
type = options["type"] || :runtime
|
69
|
+
super(name, version, type)
|
70
|
+
|
71
|
+
@autorequire = nil
|
72
|
+
@groups = Array(options["group"] || :default).map(&:to_sym)
|
73
|
+
@source = options["source"]
|
74
|
+
@platforms = Array(options["platforms"])
|
75
|
+
@env = options["env"]
|
76
|
+
@should_include = options.fetch("should_include", true)
|
77
|
+
|
78
|
+
@autorequire = Array(options["require"] || []) if options.key?("require")
|
79
|
+
end
|
80
|
+
|
81
|
+
def gem_platforms(valid_platforms)
|
82
|
+
return valid_platforms if @platforms.empty?
|
83
|
+
|
84
|
+
platforms = []
|
85
|
+
@platforms.each do |p|
|
86
|
+
platform = PLATFORM_MAP[p]
|
87
|
+
next unless valid_platforms.include?(platform)
|
88
|
+
platforms |= [platform]
|
89
|
+
end
|
90
|
+
platforms
|
91
|
+
end
|
92
|
+
|
93
|
+
def should_include?
|
94
|
+
@should_include && current_env? && current_platform?
|
95
|
+
end
|
96
|
+
|
97
|
+
def current_env?
|
98
|
+
return true unless @env
|
99
|
+
if @env.is_a?(Hash)
|
100
|
+
@env.all? do |key, val|
|
101
|
+
ENV[key.to_s] && (val.is_a?(String) ? ENV[key.to_s] == val : ENV[key.to_s] =~ val)
|
102
|
+
end
|
103
|
+
else
|
104
|
+
ENV[@env.to_s]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def current_platform?
|
109
|
+
return true if @platforms.empty?
|
110
|
+
@platforms.any? do |p|
|
111
|
+
Bundler.current_ruby.send("#{p}?")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def to_lock
|
116
|
+
out = super
|
117
|
+
out << "!" if source
|
118
|
+
out << "\n"
|
119
|
+
end
|
120
|
+
|
121
|
+
def specific?
|
122
|
+
super
|
123
|
+
rescue NoMethodError
|
124
|
+
requirement != ">= 0"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler
|
3
|
+
class Deployment
|
4
|
+
def self.define_task(context, task_method = :task, opts = {})
|
5
|
+
if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
|
6
|
+
context_name = "capistrano"
|
7
|
+
role_default = "{:except => {:no_release => true}}"
|
8
|
+
error_type = ::Capistrano::CommandError
|
9
|
+
else
|
10
|
+
context_name = "vlad"
|
11
|
+
role_default = "[:app]"
|
12
|
+
error_type = ::Rake::CommandFailedError
|
13
|
+
end
|
14
|
+
|
15
|
+
roles = context.fetch(:bundle_roles, false)
|
16
|
+
opts[:roles] = roles if roles
|
17
|
+
|
18
|
+
context.send :namespace, :bundle do
|
19
|
+
send :desc, <<-DESC
|
20
|
+
Install the current Bundler environment. By default, gems will be \
|
21
|
+
installed to the shared/bundle path. Gems in the development and \
|
22
|
+
test group will not be installed. The install command is executed \
|
23
|
+
with the --deployment and --quiet flags. If the bundle cmd cannot \
|
24
|
+
be found then you can override the bundle_cmd variable to specify \
|
25
|
+
which one it should use. The base path to the app is fetched from \
|
26
|
+
the :latest_release variable. Set it for custom deploy layouts.
|
27
|
+
|
28
|
+
You can override any of these defaults by setting the variables shown below.
|
29
|
+
|
30
|
+
N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \
|
31
|
+
in your deploy.rb file.
|
32
|
+
|
33
|
+
set :bundle_gemfile, "Gemfile"
|
34
|
+
set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
|
35
|
+
set :bundle_flags, "--deployment --quiet"
|
36
|
+
set :bundle_without, [:development, :test]
|
37
|
+
set :bundle_with, [:mysql]
|
38
|
+
set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
|
39
|
+
set :bundle_roles, #{role_default} # e.g. [:app, :batch]
|
40
|
+
DESC
|
41
|
+
send task_method, :install, opts do
|
42
|
+
bundle_cmd = context.fetch(:bundle_cmd, "bundle")
|
43
|
+
bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet")
|
44
|
+
bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), "bundle"))
|
45
|
+
bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
|
46
|
+
bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
|
47
|
+
bundle_with = [*context.fetch(:bundle_with, [])].compact
|
48
|
+
app_path = context.fetch(:latest_release)
|
49
|
+
if app_path.to_s.empty?
|
50
|
+
raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
|
51
|
+
end
|
52
|
+
args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"]
|
53
|
+
args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
|
54
|
+
args << bundle_flags.to_s
|
55
|
+
args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
|
56
|
+
args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty?
|
57
|
+
|
58
|
+
run "cd #{app_path} && #{bundle_cmd} install #{args.join(" ")}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Bundler
|
3
|
+
if defined? ::Deprecate
|
4
|
+
Deprecate = ::Deprecate
|
5
|
+
elsif defined? Gem::Deprecate
|
6
|
+
Deprecate = Gem::Deprecate
|
7
|
+
else
|
8
|
+
class Deprecate; end
|
9
|
+
end
|
10
|
+
|
11
|
+
unless Deprecate.respond_to?(:skip_during)
|
12
|
+
def Deprecate.skip_during
|
13
|
+
yield
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,512 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "bundler/dependency"
|
3
|
+
require "bundler/ruby_dsl"
|
4
|
+
|
5
|
+
module Bundler
|
6
|
+
class Dsl
|
7
|
+
include RubyDsl
|
8
|
+
|
9
|
+
def self.evaluate(gemfile, lockfile, unlock)
|
10
|
+
builder = new
|
11
|
+
builder.eval_gemfile(gemfile)
|
12
|
+
builder.to_definition(lockfile, unlock)
|
13
|
+
end
|
14
|
+
|
15
|
+
VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
|
16
|
+
|
17
|
+
attr_reader :gemspecs
|
18
|
+
attr_accessor :dependencies
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
@source = nil
|
22
|
+
@sources = SourceList.new
|
23
|
+
@git_sources = {}
|
24
|
+
@dependencies = []
|
25
|
+
@groups = []
|
26
|
+
@install_conditionals = []
|
27
|
+
@optional_groups = []
|
28
|
+
@platforms = []
|
29
|
+
@env = nil
|
30
|
+
@ruby_version = nil
|
31
|
+
@gemspecs = []
|
32
|
+
@gemfile = nil
|
33
|
+
add_git_sources
|
34
|
+
end
|
35
|
+
|
36
|
+
def eval_gemfile(gemfile, contents = nil)
|
37
|
+
expanded_gemfile_path = Pathname.new(gemfile).expand_path
|
38
|
+
original_gemfile = @gemfile
|
39
|
+
@gemfile = expanded_gemfile_path
|
40
|
+
contents ||= Bundler.read_file(gemfile.to_s)
|
41
|
+
instance_eval(contents, gemfile.to_s, 1)
|
42
|
+
rescue Exception => e
|
43
|
+
message = "There was an error " \
|
44
|
+
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
|
45
|
+
"`#{File.basename gemfile.to_s}`: #{e.message}"
|
46
|
+
|
47
|
+
raise DSLError.new(message, gemfile, e.backtrace, contents)
|
48
|
+
ensure
|
49
|
+
@gemfile = original_gemfile
|
50
|
+
end
|
51
|
+
|
52
|
+
def gemspec(opts = nil)
|
53
|
+
path = opts && opts[:path] || "."
|
54
|
+
glob = opts && opts[:glob]
|
55
|
+
name = opts && opts[:name] || "{,*}"
|
56
|
+
development_group = opts && opts[:development_group] || :development
|
57
|
+
expanded_path = gemfile_root.join(path)
|
58
|
+
|
59
|
+
gemspecs = Dir[File.join(expanded_path, "#{name}.gemspec")]
|
60
|
+
|
61
|
+
case gemspecs.size
|
62
|
+
when 1
|
63
|
+
spec = Bundler.load_gemspec(gemspecs.first)
|
64
|
+
|
65
|
+
unless spec
|
66
|
+
raise InvalidOption, "There was an error loading the gemspec at " \
|
67
|
+
"#{file}. Make sure you can build the gem, then try again"
|
68
|
+
end
|
69
|
+
|
70
|
+
@gemspecs << spec
|
71
|
+
|
72
|
+
gem_platforms = Bundler::Dependency::REVERSE_PLATFORM_MAP[Bundler::GemHelpers.generic_local_platform]
|
73
|
+
gem spec.name, :name => spec.name, :path => path, :glob => glob, :platforms => gem_platforms
|
74
|
+
|
75
|
+
group(development_group) do
|
76
|
+
spec.development_dependencies.each do |dep|
|
77
|
+
gem dep.name, *(dep.requirement.as_list + [:type => :development, :platforms => gem_platforms])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
when 0
|
81
|
+
raise InvalidOption, "There are no gemspecs at #{expanded_path}"
|
82
|
+
else
|
83
|
+
raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \
|
84
|
+
"Please use the :name option to specify which one should be used"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def gem(name, *args)
|
89
|
+
options = args.last.is_a?(Hash) ? args.pop.dup : {}
|
90
|
+
version = args || [">= 0"]
|
91
|
+
|
92
|
+
normalize_options(name, version, options)
|
93
|
+
|
94
|
+
dep = Dependency.new(name, version, options)
|
95
|
+
|
96
|
+
# if there's already a dependency with this name we try to prefer one
|
97
|
+
if current = @dependencies.find {|d| d.name == dep.name }
|
98
|
+
if current.requirement != dep.requirement
|
99
|
+
if current.type == :development
|
100
|
+
@dependencies.delete current
|
101
|
+
else
|
102
|
+
return if dep.type == :development
|
103
|
+
raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
|
104
|
+
"You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})"
|
105
|
+
end
|
106
|
+
|
107
|
+
else
|
108
|
+
Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
|
109
|
+
"You should probably keep only one of them.\n" \
|
110
|
+
"While it's not a problem now, it could cause errors if you change the version of one of them later."
|
111
|
+
end
|
112
|
+
|
113
|
+
if current.source != dep.source
|
114
|
+
if current.type == :development
|
115
|
+
@dependencies.delete current
|
116
|
+
else
|
117
|
+
return if dep.type == :development
|
118
|
+
raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
|
119
|
+
"You specified that #{dep.name} (#{dep.requirement}) should come from " \
|
120
|
+
"#{current.source || "an unspecified source"} and #{dep.source}\n"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
@dependencies << dep
|
126
|
+
end
|
127
|
+
|
128
|
+
def source(source, &blk)
|
129
|
+
source = normalize_source(source)
|
130
|
+
if block_given?
|
131
|
+
with_source(@sources.add_rubygems_source("remotes" => source), &blk)
|
132
|
+
else
|
133
|
+
check_primary_source_safety(@sources)
|
134
|
+
@sources.add_rubygems_remote(source)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def git_source(name, &block)
|
139
|
+
unless block_given?
|
140
|
+
raise InvalidOption, "You need to pass a block to #git_source"
|
141
|
+
end
|
142
|
+
|
143
|
+
if valid_keys.include?(name.to_s)
|
144
|
+
raise InvalidOption, "You cannot use #{name} as a git source. It " \
|
145
|
+
"is a reserved key. Reserved keys are: #{valid_keys.join(", ")}"
|
146
|
+
end
|
147
|
+
|
148
|
+
@git_sources[name.to_s] = block
|
149
|
+
end
|
150
|
+
|
151
|
+
def path(path, options = {}, &blk)
|
152
|
+
source_options = normalize_hash(options).merge(
|
153
|
+
"path" => Pathname.new(path),
|
154
|
+
"root_path" => gemfile_root,
|
155
|
+
"gemspec" => gemspecs.find {|g| g.name == options["name"] }
|
156
|
+
)
|
157
|
+
source = @sources.add_path_source(source_options)
|
158
|
+
with_source(source, &blk)
|
159
|
+
end
|
160
|
+
|
161
|
+
def git(uri, options = {}, &blk)
|
162
|
+
unless block_given?
|
163
|
+
msg = "You can no longer specify a git source by itself. Instead, \n" \
|
164
|
+
"either use the :git option on a gem, or specify the gems that \n" \
|
165
|
+
"bundler should find in the git source by passing a block to \n" \
|
166
|
+
"the git method, like: \n\n" \
|
167
|
+
" git 'git://github.com/rails/rails.git' do\n" \
|
168
|
+
" gem 'rails'\n" \
|
169
|
+
" end"
|
170
|
+
raise DeprecatedError, msg
|
171
|
+
end
|
172
|
+
|
173
|
+
with_source(@sources.add_git_source(normalize_hash(options).merge("uri" => uri)), &blk)
|
174
|
+
end
|
175
|
+
|
176
|
+
def github(repo, options = {})
|
177
|
+
raise ArgumentError, "Github sources require a block" unless block_given?
|
178
|
+
github_uri = @git_sources["github"].call(repo)
|
179
|
+
git_options = normalize_hash(options).merge("uri" => github_uri)
|
180
|
+
git_source = @sources.add_git_source(git_options)
|
181
|
+
with_source(git_source) { yield }
|
182
|
+
end
|
183
|
+
|
184
|
+
def to_definition(lockfile, unlock)
|
185
|
+
Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups)
|
186
|
+
end
|
187
|
+
|
188
|
+
def group(*args, &blk)
|
189
|
+
opts = Hash === args.last ? args.pop.dup : {}
|
190
|
+
normalize_group_options(opts, args)
|
191
|
+
|
192
|
+
@groups.concat args
|
193
|
+
|
194
|
+
if opts["optional"]
|
195
|
+
optional_groups = args - @optional_groups
|
196
|
+
@optional_groups.concat optional_groups
|
197
|
+
end
|
198
|
+
|
199
|
+
yield
|
200
|
+
ensure
|
201
|
+
args.each { @groups.pop }
|
202
|
+
end
|
203
|
+
|
204
|
+
def install_if(*args, &blk)
|
205
|
+
@install_conditionals.concat args
|
206
|
+
blk.call
|
207
|
+
ensure
|
208
|
+
args.each { @install_conditionals.pop }
|
209
|
+
end
|
210
|
+
|
211
|
+
def platforms(*platforms)
|
212
|
+
@platforms.concat platforms
|
213
|
+
yield
|
214
|
+
ensure
|
215
|
+
platforms.each { @platforms.pop }
|
216
|
+
end
|
217
|
+
alias_method :platform, :platforms
|
218
|
+
|
219
|
+
def env(name)
|
220
|
+
old = @env
|
221
|
+
@env = name
|
222
|
+
yield
|
223
|
+
ensure
|
224
|
+
@env = old
|
225
|
+
end
|
226
|
+
|
227
|
+
def plugin(*args)
|
228
|
+
# Pass on
|
229
|
+
end
|
230
|
+
|
231
|
+
def method_missing(name, *args)
|
232
|
+
raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile"
|
233
|
+
end
|
234
|
+
|
235
|
+
private
|
236
|
+
|
237
|
+
def add_git_sources
|
238
|
+
git_source(:github) do |repo_name|
|
239
|
+
# It would be better to use https instead of the git protocol, but this
|
240
|
+
# can break deployment of existing locked bundles when switching between
|
241
|
+
# different versions of Bundler. The change will be made in 2.0, which
|
242
|
+
# does not guarantee compatibility with the 1.x series.
|
243
|
+
#
|
244
|
+
# See https://github.com/bundler/bundler/pull/2569 for discussion
|
245
|
+
#
|
246
|
+
# This can be overridden by adding this code to your Gemfiles:
|
247
|
+
#
|
248
|
+
# git_source(:github) do |repo_name|
|
249
|
+
# repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
250
|
+
# "https://github.com/#{repo_name}.git"
|
251
|
+
# end
|
252
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
253
|
+
"git://github.com/#{repo_name}.git"
|
254
|
+
end
|
255
|
+
|
256
|
+
git_source(:gist) {|repo_name| "https://gist.github.com/#{repo_name}.git" }
|
257
|
+
|
258
|
+
git_source(:bitbucket) do |repo_name|
|
259
|
+
user_name, repo_name = repo_name.split "/"
|
260
|
+
repo_name ||= user_name
|
261
|
+
"https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
def with_source(source)
|
266
|
+
old_source = @source
|
267
|
+
if block_given?
|
268
|
+
@source = source
|
269
|
+
yield
|
270
|
+
end
|
271
|
+
source
|
272
|
+
ensure
|
273
|
+
@source = old_source
|
274
|
+
end
|
275
|
+
|
276
|
+
def normalize_hash(opts)
|
277
|
+
opts.keys.each do |k|
|
278
|
+
opts[k.to_s] = opts.delete(k) unless k.is_a?(String)
|
279
|
+
end
|
280
|
+
opts
|
281
|
+
end
|
282
|
+
|
283
|
+
def valid_keys
|
284
|
+
@valid_keys ||= %w(group groups git path glob name branch ref tag require submodules platform platforms type source install_if)
|
285
|
+
end
|
286
|
+
|
287
|
+
def normalize_options(name, version, opts)
|
288
|
+
if name.is_a?(Symbol)
|
289
|
+
raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
|
290
|
+
end
|
291
|
+
if name =~ /\s/
|
292
|
+
raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
|
293
|
+
end
|
294
|
+
|
295
|
+
normalize_hash(opts)
|
296
|
+
|
297
|
+
git_names = @git_sources.keys.map(&:to_s)
|
298
|
+
validate_keys("gem '#{name}'", opts, valid_keys + git_names)
|
299
|
+
|
300
|
+
groups = @groups.dup
|
301
|
+
opts["group"] = opts.delete("groups") || opts["group"]
|
302
|
+
groups.concat Array(opts.delete("group"))
|
303
|
+
groups = [:default] if groups.empty?
|
304
|
+
|
305
|
+
install_if = @install_conditionals.dup
|
306
|
+
install_if.concat Array(opts.delete("install_if"))
|
307
|
+
install_if = install_if.reduce(true) do |memo, val|
|
308
|
+
memo && (val.respond_to?(:call) ? val.call : val)
|
309
|
+
end
|
310
|
+
|
311
|
+
platforms = @platforms.dup
|
312
|
+
opts["platforms"] = opts["platform"] || opts["platforms"]
|
313
|
+
platforms.concat Array(opts.delete("platforms"))
|
314
|
+
platforms.map!(&:to_sym)
|
315
|
+
platforms.each do |p|
|
316
|
+
next if VALID_PLATFORMS.include?(p)
|
317
|
+
raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
|
318
|
+
end
|
319
|
+
|
320
|
+
# Save sources passed in a key
|
321
|
+
if opts.key?("source")
|
322
|
+
source = normalize_source(opts["source"])
|
323
|
+
opts["source"] = @sources.add_rubygems_source("remotes" => source)
|
324
|
+
end
|
325
|
+
|
326
|
+
git_name = (git_names & opts.keys).last
|
327
|
+
if @git_sources[git_name]
|
328
|
+
opts["git"] = @git_sources[git_name].call(opts[git_name])
|
329
|
+
end
|
330
|
+
|
331
|
+
%w(git path).each do |type|
|
332
|
+
next unless param = opts[type]
|
333
|
+
if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
|
334
|
+
options = opts.merge("name" => name, "version" => $1)
|
335
|
+
else
|
336
|
+
options = opts.dup
|
337
|
+
end
|
338
|
+
source = send(type, param, options) {}
|
339
|
+
opts["source"] = source
|
340
|
+
end
|
341
|
+
|
342
|
+
opts["source"] ||= @source
|
343
|
+
opts["env"] ||= @env
|
344
|
+
opts["platforms"] = platforms.dup
|
345
|
+
opts["group"] = groups
|
346
|
+
opts["should_include"] = install_if
|
347
|
+
end
|
348
|
+
|
349
|
+
def normalize_group_options(opts, groups)
|
350
|
+
normalize_hash(opts)
|
351
|
+
|
352
|
+
groups = groups.map {|group| ":#{group}" }.join(", ")
|
353
|
+
validate_keys("group #{groups}", opts, %w(optional))
|
354
|
+
|
355
|
+
opts["optional"] ||= false
|
356
|
+
end
|
357
|
+
|
358
|
+
def validate_keys(command, opts, valid_keys)
|
359
|
+
invalid_keys = opts.keys - valid_keys
|
360
|
+
if invalid_keys.any?
|
361
|
+
message = String.new
|
362
|
+
message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
|
363
|
+
message << if invalid_keys.size > 1
|
364
|
+
"as options for #{command}, but they are invalid."
|
365
|
+
else
|
366
|
+
"as an option for #{command}, but it is invalid."
|
367
|
+
end
|
368
|
+
|
369
|
+
message << " Valid options are: #{valid_keys.join(", ")}"
|
370
|
+
raise InvalidOption, message
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
def normalize_source(source)
|
375
|
+
case source
|
376
|
+
when :gemcutter, :rubygems, :rubyforge
|
377
|
+
Bundler.ui.warn "The source :#{source} is deprecated because HTTP " \
|
378
|
+
"requests are insecure.\nPlease change your source to 'https://" \
|
379
|
+
"rubygems.org' if possible, or 'http://rubygems.org' if not."
|
380
|
+
"http://rubygems.org"
|
381
|
+
when String
|
382
|
+
source
|
383
|
+
else
|
384
|
+
raise GemfileError, "Unknown source '#{source}'"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def check_primary_source_safety(source)
|
389
|
+
return unless source.rubygems_primary_remotes.any?
|
390
|
+
|
391
|
+
if Bundler.settings[:disable_multisource]
|
392
|
+
raise GemspecError, "Warning: this Gemfile contains multiple primary sources. " \
|
393
|
+
"Each source after the first must include a block to indicate which gems " \
|
394
|
+
"should come from that source. To downgrade this error to a warning, run " \
|
395
|
+
"`bundle config --delete disable_multisource`"
|
396
|
+
else
|
397
|
+
Bundler.ui.warn "Warning: this Gemfile contains multiple primary sources. " \
|
398
|
+
"Using `source` more than once without a block is a security risk, and " \
|
399
|
+
"may result in installing unexpected gems. To resolve this warning, use " \
|
400
|
+
"a block to indicate which gems should come from the secondary source. " \
|
401
|
+
"To upgrade this warning to an error, run `bundle config " \
|
402
|
+
"disable_multisource true`."
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
class DSLError < GemfileError
|
407
|
+
# @return [String] the description that should be presented to the user.
|
408
|
+
#
|
409
|
+
attr_reader :description
|
410
|
+
|
411
|
+
# @return [String] the path of the dsl file that raised the exception.
|
412
|
+
#
|
413
|
+
attr_reader :dsl_path
|
414
|
+
|
415
|
+
# @return [Exception] the backtrace of the exception raised by the
|
416
|
+
# evaluation of the dsl file.
|
417
|
+
#
|
418
|
+
attr_reader :backtrace
|
419
|
+
|
420
|
+
# @param [Exception] backtrace @see backtrace
|
421
|
+
# @param [String] dsl_path @see dsl_path
|
422
|
+
#
|
423
|
+
def initialize(description, dsl_path, backtrace, contents = nil)
|
424
|
+
@status_code = $!.respond_to?(:status_code) && $!.status_code
|
425
|
+
|
426
|
+
@description = description
|
427
|
+
@dsl_path = dsl_path
|
428
|
+
@backtrace = backtrace
|
429
|
+
@contents = contents
|
430
|
+
end
|
431
|
+
|
432
|
+
def status_code
|
433
|
+
@status_code || super
|
434
|
+
end
|
435
|
+
|
436
|
+
# @return [String] the contents of the DSL that cause the exception to
|
437
|
+
# be raised.
|
438
|
+
#
|
439
|
+
def contents
|
440
|
+
@contents ||= begin
|
441
|
+
dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
# The message of the exception reports the content of podspec for the
|
446
|
+
# line that generated the original exception.
|
447
|
+
#
|
448
|
+
# @example Output
|
449
|
+
#
|
450
|
+
# Invalid podspec at `RestKit.podspec` - undefined method
|
451
|
+
# `exclude_header_search_paths=' for #<Pod::Specification for
|
452
|
+
# `RestKit/Network (0.9.3)`>
|
453
|
+
#
|
454
|
+
# from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36
|
455
|
+
# -------------------------------------------
|
456
|
+
# # because it would break: #import <CoreData/CoreData.h>
|
457
|
+
# > ns.exclude_header_search_paths = 'Code/RestKit.h'
|
458
|
+
# end
|
459
|
+
# -------------------------------------------
|
460
|
+
#
|
461
|
+
# @return [String] the message of the exception.
|
462
|
+
#
|
463
|
+
def to_s
|
464
|
+
@to_s ||= begin
|
465
|
+
trace_line, description = parse_line_number_from_description
|
466
|
+
|
467
|
+
m = String.new("\n[!] ")
|
468
|
+
m << description
|
469
|
+
m << ". Bundler cannot continue.\n"
|
470
|
+
|
471
|
+
return m unless backtrace && dsl_path && contents
|
472
|
+
|
473
|
+
trace_line = backtrace.find {|l| l.include?(dsl_path.to_s) } || trace_line
|
474
|
+
return m unless trace_line
|
475
|
+
line_numer = trace_line.split(":")[1].to_i - 1
|
476
|
+
return m unless line_numer
|
477
|
+
|
478
|
+
lines = contents.lines.to_a
|
479
|
+
indent = " # "
|
480
|
+
indicator = indent.tr('#', ">")
|
481
|
+
first_line = (line_numer.zero?)
|
482
|
+
last_line = (line_numer == (lines.count - 1))
|
483
|
+
|
484
|
+
m << "\n"
|
485
|
+
m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n"
|
486
|
+
m << "#{indent}-------------------------------------------\n"
|
487
|
+
m << "#{indent}#{lines[line_numer - 1]}" unless first_line
|
488
|
+
m << "#{indicator}#{lines[line_numer]}"
|
489
|
+
m << "#{indent}#{lines[line_numer + 1]}" unless last_line
|
490
|
+
m << "\n" unless m.end_with?("\n")
|
491
|
+
m << "#{indent}-------------------------------------------\n"
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
private
|
496
|
+
|
497
|
+
def parse_line_number_from_description
|
498
|
+
description = self.description
|
499
|
+
if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
|
500
|
+
trace_line = Regexp.last_match[1]
|
501
|
+
description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
|
502
|
+
end
|
503
|
+
[trace_line, description]
|
504
|
+
end
|
505
|
+
end
|
506
|
+
|
507
|
+
def gemfile_root
|
508
|
+
@gemfile ||= Bundler.default_gemfile
|
509
|
+
@gemfile.dirname
|
510
|
+
end
|
511
|
+
end
|
512
|
+
end
|