bundler 1.11.1 → 2.2.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +2125 -840
- data/LICENSE.md +18 -19
- data/README.md +33 -11
- data/bundler.gemspec +34 -21
- data/exe/bundle +36 -6
- data/exe/bundler +2 -18
- data/lib/bundler.rb +435 -160
- data/lib/bundler/build_metadata.rb +45 -0
- data/lib/bundler/capistrano.rb +9 -3
- data/lib/bundler/cli.rb +550 -130
- data/lib/bundler/cli/add.rb +47 -0
- data/lib/bundler/cli/binstubs.rb +26 -10
- data/lib/bundler/cli/cache.rb +25 -17
- data/lib/bundler/cli/check.rb +8 -7
- data/lib/bundler/cli/clean.rb +8 -8
- data/lib/bundler/cli/common.rb +69 -9
- data/lib/bundler/cli/config.rb +170 -76
- data/lib/bundler/cli/console.rb +6 -1
- data/lib/bundler/cli/doctor.rb +140 -0
- data/lib/bundler/cli/exec.rb +63 -21
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +158 -42
- data/lib/bundler/cli/info.rb +73 -0
- data/lib/bundler/cli/init.rb +22 -7
- data/lib/bundler/cli/inject.rb +38 -10
- data/lib/bundler/cli/install.rb +139 -104
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +60 -0
- data/lib/bundler/cli/lock.rb +27 -5
- data/lib/bundler/cli/open.rb +13 -5
- data/lib/bundler/cli/outdated.rb +251 -46
- data/lib/bundler/cli/platform.rb +6 -2
- data/lib/bundler/cli/plugin.rb +41 -0
- data/lib/bundler/cli/pristine.rb +52 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +5 -4
- data/lib/bundler/cli/update.rb +67 -26
- data/lib/bundler/cli/viz.rb +11 -6
- data/lib/bundler/compact_index_client.rb +125 -0
- data/lib/bundler/compact_index_client/cache.rb +110 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +104 -0
- data/lib/bundler/constants.rb +2 -0
- data/lib/bundler/current_ruby.rb +51 -174
- data/lib/bundler/definition.rb +533 -216
- data/lib/bundler/dep_proxy.rb +18 -8
- data/lib/bundler/dependency.rb +39 -12
- data/lib/bundler/deployment.rb +7 -0
- data/lib/bundler/deprecate.rb +31 -2
- data/lib/bundler/dsl.rb +188 -91
- data/lib/bundler/endpoint_specification.rb +51 -10
- data/lib/bundler/env.rb +116 -48
- data/lib/bundler/environment_preserver.rb +82 -0
- data/lib/bundler/errors.rb +108 -31
- data/lib/bundler/feature_flag.rb +60 -0
- data/lib/bundler/fetcher.rb +81 -52
- data/lib/bundler/fetcher/base.rb +15 -3
- data/lib/bundler/fetcher/compact_index.rb +140 -0
- data/lib/bundler/fetcher/dependency.rb +36 -42
- data/lib/bundler/fetcher/downloader.rb +39 -12
- data/lib/bundler/fetcher/index.rb +34 -9
- data/lib/bundler/friendly_errors.rb +132 -88
- data/lib/bundler/gem_helper.rb +92 -50
- data/lib/bundler/gem_helpers.rb +90 -5
- data/lib/bundler/gem_tasks.rb +3 -1
- data/lib/bundler/gem_version_promoter.rb +190 -0
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +20 -41
- data/lib/bundler/index.rb +74 -57
- data/lib/bundler/injector.rb +242 -31
- data/lib/bundler/inline.rb +49 -23
- data/lib/bundler/installer.rb +190 -74
- data/lib/bundler/installer/gem_installer.rb +33 -20
- data/lib/bundler/installer/parallel_installer.rb +201 -97
- data/lib/bundler/installer/standalone.rb +10 -6
- data/lib/bundler/lazy_specification.rb +74 -10
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +126 -74
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/lib/bundler/man/bundle-add.1 +66 -0
- data/lib/bundler/man/bundle-add.1.ronn +46 -0
- data/lib/bundler/man/bundle-binstubs.1 +42 -0
- data/lib/bundler/man/bundle-binstubs.1.ronn +41 -0
- data/lib/bundler/man/bundle-cache.1 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +22 -16
- data/lib/bundler/man/bundle-check.1 +31 -0
- data/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/lib/bundler/man/bundle-clean.1 +24 -0
- data/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/lib/bundler/man/bundle-config.1 +488 -0
- data/lib/bundler/man/bundle-config.1.ronn +388 -0
- data/lib/bundler/man/bundle-doctor.1 +44 -0
- data/lib/bundler/man/bundle-doctor.1.ronn +33 -0
- data/lib/bundler/man/bundle-exec.1 +165 -0
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +20 -4
- data/lib/bundler/man/bundle-gem.1 +102 -0
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +37 -13
- data/lib/bundler/man/bundle-info.1 +20 -0
- data/lib/bundler/man/bundle-info.1.ronn +17 -0
- data/lib/bundler/man/bundle-init.1 +25 -0
- data/lib/bundler/man/bundle-init.1.ronn +29 -0
- data/lib/bundler/man/bundle-inject.1 +33 -0
- data/lib/bundler/man/bundle-inject.1.ronn +22 -0
- data/lib/bundler/man/bundle-install.1 +338 -0
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +82 -76
- data/lib/bundler/man/bundle-list.1 +50 -0
- data/lib/bundler/man/bundle-list.1.ronn +33 -0
- data/lib/bundler/man/bundle-lock.1 +84 -0
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +47 -0
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/lib/bundler/man/bundle-open.1.ronn +19 -0
- data/lib/bundler/man/bundle-outdated.1 +155 -0
- data/lib/bundler/man/bundle-outdated.1.ronn +111 -0
- data/lib/bundler/man/bundle-platform.1 +61 -0
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +1 -1
- data/lib/bundler/man/bundle-pristine.1 +34 -0
- data/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/lib/bundler/man/bundle-remove.1 +31 -0
- data/lib/bundler/man/bundle-remove.1.ronn +23 -0
- data/lib/bundler/man/bundle-show.1 +23 -0
- data/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/lib/bundler/man/bundle-update.1 +394 -0
- data/lib/bundler/man/bundle-update.1.ronn +350 -0
- data/lib/bundler/man/bundle-viz.1 +39 -0
- data/lib/bundler/man/bundle-viz.1.ronn +30 -0
- data/lib/bundler/man/bundle.1 +136 -0
- data/lib/bundler/man/bundle.1.ronn +111 -0
- data/lib/bundler/man/gemfile.5 +686 -0
- data/{man → lib/bundler/man}/gemfile.5.ronn +117 -95
- data/lib/bundler/man/index.txt +25 -0
- data/lib/bundler/match_platform.rb +15 -4
- data/lib/bundler/mirror.rb +223 -0
- data/lib/bundler/plugin.rb +330 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/api/source.rb +304 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +182 -0
- data/lib/bundler/plugin/installer.rb +109 -0
- data/lib/bundler/plugin/installer/git.rb +38 -0
- data/lib/bundler/plugin/installer/rubygems.rb +27 -0
- data/lib/bundler/plugin/source_list.rb +27 -0
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +2 -6
- data/lib/bundler/remote_specification.rb +42 -9
- data/lib/bundler/resolver.rb +312 -225
- data/lib/bundler/resolver/spec_group.rb +122 -0
- data/lib/bundler/retry.rb +11 -5
- data/lib/bundler/ruby_dsl.rb +9 -2
- data/lib/bundler/ruby_version.rb +84 -61
- data/lib/bundler/rubygems_ext.rb +92 -53
- data/lib/bundler/rubygems_gem_installer.rb +84 -0
- data/lib/bundler/rubygems_integration.rb +320 -395
- data/lib/bundler/runtime.rb +87 -75
- data/lib/bundler/settings.rb +297 -119
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +13 -12
- data/lib/bundler/shared_helpers.rb +234 -53
- data/lib/bundler/similarity_detector.rb +5 -3
- data/lib/bundler/source.rb +63 -4
- data/lib/bundler/source/gemspec.rb +18 -0
- data/lib/bundler/source/git.rb +97 -50
- data/lib/bundler/source/git/git_proxy.rb +138 -65
- data/lib/bundler/source/metadata.rb +67 -0
- data/lib/bundler/source/path.rb +83 -47
- data/lib/bundler/source/path/installer.rb +42 -11
- data/lib/bundler/source/rubygems.rb +231 -116
- data/lib/bundler/source/rubygems/remote.rb +30 -1
- data/lib/bundler/source_list.rb +103 -21
- data/lib/bundler/spec_set.rb +96 -51
- data/lib/bundler/stub_specification.rb +87 -4
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +14 -1
- data/lib/bundler/templates/Executable.bundler +114 -0
- data/lib/bundler/templates/Executable.standalone +6 -4
- data/lib/bundler/templates/Gemfile +4 -1
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +79 -44
- data/lib/bundler/templates/newgem/Gemfile.tt +18 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +16 -10
- data/lib/bundler/templates/newgem/Rakefile.tt +22 -8
- data/lib/bundler/templates/newgem/bin/console.tt +2 -1
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +13 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +18 -0
- data/lib/bundler/templates/newgem/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +6 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +27 -28
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +4 -4
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -2
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +3 -1
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/test-unit/newgem_test.rb.tt +15 -0
- data/lib/bundler/templates/newgem/test/test-unit/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui.rb +5 -3
- data/lib/bundler/ui/rg_proxy.rb +3 -1
- data/lib/bundler/ui/shell.rb +54 -21
- data/lib/bundler/ui/silent.rb +26 -1
- data/lib/bundler/uri_credentials_filter.rb +43 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1764 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +11 -5
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +81 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +113 -134
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +66 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +62 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +63 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +61 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +126 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +46 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +36 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +158 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +82 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +4 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +6 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +555 -150
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +6 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +19 -12
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +310 -467
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +58 -25
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +50 -33
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +5 -3
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +9 -19
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +79 -22
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +33 -20
- data/lib/bundler/vendor/thor/lib/thor/base.rb +110 -67
- data/lib/bundler/vendor/thor/lib/thor/command.rb +33 -24
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/error.rb +81 -3
- data/lib/bundler/vendor/thor/lib/thor/group.rb +16 -16
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +18 -18
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +60 -26
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +31 -13
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +42 -39
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +109 -39
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/util.rb +26 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendored_fileutils.rb +4 -0
- data/lib/bundler/vendored_molinillo.rb +3 -1
- data/lib/bundler/vendored_persistent.rb +45 -9
- data/lib/bundler/vendored_thor.rb +8 -3
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +7 -4
- data/lib/bundler/version_ranges.rb +122 -0
- data/lib/bundler/vlad.rb +8 -2
- data/lib/bundler/worker.rb +38 -6
- data/lib/bundler/yaml_serializer.rb +89 -0
- metadata +164 -158
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.rubocop.yml +0 -105
- data/.rubocop_todo.yml +0 -120
- data/.travis.yml +0 -97
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -32
- data/DEVELOPMENT.md +0 -118
- data/ISSUES.md +0 -96
- data/Rakefile +0 -309
- data/bin/rake +0 -14
- data/bin/rspec +0 -10
- data/bin/rubocop +0 -11
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -45
- data/lib/bundler/environment.rb +0 -41
- data/lib/bundler/gem_path_manipulation.rb +0 -8
- data/lib/bundler/gem_remote_fetcher.rb +0 -41
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -64
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/net/http/faster.rb +0 -26
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -128
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -10
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -98
- data/man/bundle-config.ronn +0 -187
- data/man/bundle-update.ronn +0 -188
- data/man/bundle.ronn +0 -98
- data/man/index.txt +0 -8
data/lib/bundler/cli/console.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Bundler
|
2
4
|
class CLI::Console
|
3
5
|
attr_reader :options, :group
|
@@ -7,7 +9,10 @@ module Bundler
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def run
|
10
|
-
|
12
|
+
Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \
|
13
|
+
"by `bin/console` generated by `bundle gem <name>`"
|
14
|
+
|
15
|
+
group ? Bundler.require(:default, *group.split(" ").map!(&:to_sym)) : Bundler.require
|
11
16
|
ARGV.clear
|
12
17
|
|
13
18
|
console = get_console(Bundler.settings[:console] || "irb")
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rbconfig"
|
4
|
+
|
5
|
+
module Bundler
|
6
|
+
class CLI::Doctor
|
7
|
+
DARWIN_REGEX = /\s+(.+) \(compatibility /.freeze
|
8
|
+
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/.freeze
|
9
|
+
|
10
|
+
attr_reader :options
|
11
|
+
|
12
|
+
def initialize(options)
|
13
|
+
@options = options
|
14
|
+
end
|
15
|
+
|
16
|
+
def otool_available?
|
17
|
+
Bundler.which("otool")
|
18
|
+
end
|
19
|
+
|
20
|
+
def ldd_available?
|
21
|
+
Bundler.which("ldd")
|
22
|
+
end
|
23
|
+
|
24
|
+
def dylibs_darwin(path)
|
25
|
+
output = `/usr/bin/otool -L "#{path}"`.chomp
|
26
|
+
dylibs = output.split("\n")[1..-1].map {|l| l.match(DARWIN_REGEX).captures[0] }.uniq
|
27
|
+
# ignore @rpath and friends
|
28
|
+
dylibs.reject {|dylib| dylib.start_with? "@" }
|
29
|
+
end
|
30
|
+
|
31
|
+
def dylibs_ldd(path)
|
32
|
+
output = `/usr/bin/ldd "#{path}"`.chomp
|
33
|
+
output.split("\n").map do |l|
|
34
|
+
match = l.match(LDD_REGEX)
|
35
|
+
next if match.nil?
|
36
|
+
match.captures[0]
|
37
|
+
end.compact
|
38
|
+
end
|
39
|
+
|
40
|
+
def dylibs(path)
|
41
|
+
case RbConfig::CONFIG["host_os"]
|
42
|
+
when /darwin/
|
43
|
+
return [] unless otool_available?
|
44
|
+
dylibs_darwin(path)
|
45
|
+
when /(linux|solaris|bsd)/
|
46
|
+
return [] unless ldd_available?
|
47
|
+
dylibs_ldd(path)
|
48
|
+
else # Windows, etc.
|
49
|
+
Bundler.ui.warn("Dynamic library check not supported on this platform.")
|
50
|
+
[]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def bundles_for_gem(spec)
|
55
|
+
Dir.glob("#{spec.full_gem_path}/**/*.bundle")
|
56
|
+
end
|
57
|
+
|
58
|
+
def check!
|
59
|
+
require_relative "check"
|
60
|
+
Bundler::CLI::Check.new({}).run
|
61
|
+
end
|
62
|
+
|
63
|
+
def run
|
64
|
+
Bundler.ui.level = "error" if options[:quiet]
|
65
|
+
Bundler.settings.validate!
|
66
|
+
check!
|
67
|
+
|
68
|
+
definition = Bundler.definition
|
69
|
+
broken_links = {}
|
70
|
+
|
71
|
+
definition.specs.each do |spec|
|
72
|
+
bundles_for_gem(spec).each do |bundle|
|
73
|
+
bad_paths = dylibs(bundle).select {|f| !File.exist?(f) }
|
74
|
+
if bad_paths.any?
|
75
|
+
broken_links[spec] ||= []
|
76
|
+
broken_links[spec].concat(bad_paths)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
permissions_valid = check_home_permissions
|
82
|
+
|
83
|
+
if broken_links.any?
|
84
|
+
message = "The following gems are missing OS dependencies:"
|
85
|
+
broken_links.map do |spec, paths|
|
86
|
+
paths.uniq.map do |path|
|
87
|
+
"\n * #{spec.name}: #{path}"
|
88
|
+
end
|
89
|
+
end.flatten.sort.each {|m| message += m }
|
90
|
+
raise ProductionError, message
|
91
|
+
elsif !permissions_valid
|
92
|
+
Bundler.ui.info "No issues found with the installed bundle"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def check_home_permissions
|
99
|
+
require "find"
|
100
|
+
files_not_readable_or_writable = []
|
101
|
+
files_not_rw_and_owned_by_different_user = []
|
102
|
+
files_not_owned_by_current_user_but_still_rw = []
|
103
|
+
Find.find(Bundler.bundle_path.to_s).each do |f|
|
104
|
+
if !File.writable?(f) || !File.readable?(f)
|
105
|
+
if File.stat(f).uid != Process.uid
|
106
|
+
files_not_rw_and_owned_by_different_user << f
|
107
|
+
else
|
108
|
+
files_not_readable_or_writable << f
|
109
|
+
end
|
110
|
+
elsif File.stat(f).uid != Process.uid
|
111
|
+
files_not_owned_by_current_user_but_still_rw << f
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
ok = true
|
116
|
+
if files_not_owned_by_current_user_but_still_rw.any?
|
117
|
+
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
|
118
|
+
"user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}"
|
119
|
+
|
120
|
+
ok = false
|
121
|
+
end
|
122
|
+
|
123
|
+
if files_not_rw_and_owned_by_different_user.any?
|
124
|
+
Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \
|
125
|
+
"user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}"
|
126
|
+
|
127
|
+
ok = false
|
128
|
+
end
|
129
|
+
|
130
|
+
if files_not_readable_or_writable.any?
|
131
|
+
Bundler.ui.warn "Files exist in the Bundler home that are not " \
|
132
|
+
"readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}"
|
133
|
+
|
134
|
+
ok = false
|
135
|
+
end
|
136
|
+
|
137
|
+
ok
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/lib/bundler/cli/exec.rb
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../current_ruby"
|
2
4
|
|
3
5
|
module Bundler
|
4
6
|
class CLI::Exec
|
5
7
|
attr_reader :options, :args, :cmd
|
6
8
|
|
9
|
+
TRAPPED_SIGNALS = %w[INT].freeze
|
10
|
+
|
7
11
|
def initialize(options, args)
|
8
12
|
@options = options
|
9
13
|
@cmd = args.shift
|
10
14
|
@args = args
|
11
15
|
|
12
|
-
if
|
16
|
+
if !Bundler.current_ruby.jruby?
|
13
17
|
@args << { :close_others => !options.keep_file_descriptors? }
|
14
18
|
elsif options.keep_file_descriptors?
|
15
19
|
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
@@ -17,35 +21,73 @@ module Bundler
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def run
|
20
|
-
|
21
|
-
raise ArgumentError if cmd.nil?
|
22
|
-
|
23
|
-
# First, try to exec directly to something in PATH
|
24
|
+
validate_cmd!
|
24
25
|
SharedHelpers.set_bundle_environment
|
25
|
-
bin_path = Bundler.which(
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
if bin_path = Bundler.which(cmd)
|
27
|
+
if !Bundler.settings[:disable_exec_load] && ruby_shebang?(bin_path)
|
28
|
+
return kernel_load(bin_path, *args)
|
29
|
+
end
|
30
|
+
kernel_exec(bin_path, *args)
|
31
|
+
else
|
32
|
+
# exec using the given command
|
33
|
+
kernel_exec(cmd, *args)
|
29
34
|
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
30
38
|
|
31
|
-
|
32
|
-
|
33
|
-
Bundler.
|
34
|
-
|
35
|
-
|
39
|
+
def validate_cmd!
|
40
|
+
return unless cmd.nil?
|
41
|
+
Bundler.ui.error "bundler: exec needs a command to run"
|
42
|
+
exit 128
|
43
|
+
end
|
44
|
+
|
45
|
+
def kernel_exec(*args)
|
46
|
+
Kernel.exec(*args)
|
36
47
|
rescue Errno::EACCES, Errno::ENOEXEC
|
37
|
-
Bundler.ui = ui
|
38
48
|
Bundler.ui.error "bundler: not executable: #{cmd}"
|
39
49
|
exit 126
|
40
50
|
rescue Errno::ENOENT
|
41
|
-
Bundler.ui = ui
|
42
51
|
Bundler.ui.error "bundler: command not found: #{cmd}"
|
43
52
|
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
44
53
|
exit 127
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
54
|
+
end
|
55
|
+
|
56
|
+
def kernel_load(file, *args)
|
57
|
+
args.pop if args.last.is_a?(Hash)
|
58
|
+
ARGV.replace(args)
|
59
|
+
$0 = file
|
60
|
+
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
|
61
|
+
require_relative "../setup"
|
62
|
+
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
|
63
|
+
Kernel.load(file)
|
64
|
+
rescue SystemExit, SignalException
|
65
|
+
raise
|
66
|
+
rescue Exception # rubocop:disable Lint/RescueException
|
67
|
+
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
|
68
|
+
Bundler::FriendlyErrors.disable!
|
69
|
+
raise
|
70
|
+
end
|
71
|
+
|
72
|
+
def process_title(file, args)
|
73
|
+
"#{file} #{args.join(" ")}".strip
|
74
|
+
end
|
75
|
+
|
76
|
+
def ruby_shebang?(file)
|
77
|
+
possibilities = [
|
78
|
+
"#!/usr/bin/env ruby\n",
|
79
|
+
"#!/usr/bin/env jruby\n",
|
80
|
+
"#!/usr/bin/env truffleruby\n",
|
81
|
+
"#!#{Gem.ruby}\n",
|
82
|
+
]
|
83
|
+
|
84
|
+
if File.zero?(file)
|
85
|
+
Bundler.ui.warn "#{file} is empty"
|
86
|
+
return false
|
87
|
+
end
|
88
|
+
|
89
|
+
first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
|
90
|
+
possibilities.any? {|shebang| first_line.start_with?(shebang) }
|
49
91
|
end
|
50
92
|
end
|
51
93
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class CLI::Fund
|
5
|
+
attr_reader :options
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
Bundler.definition.validate_runtime!
|
13
|
+
|
14
|
+
groups = Array(options[:group]).map(&:to_sym)
|
15
|
+
|
16
|
+
deps = if groups.any?
|
17
|
+
Bundler.definition.dependencies_for(groups)
|
18
|
+
else
|
19
|
+
Bundler.definition.current_dependencies
|
20
|
+
end
|
21
|
+
|
22
|
+
fund_info = deps.each_with_object([]) do |dep, arr|
|
23
|
+
spec = Bundler.definition.specs[dep.name].first
|
24
|
+
if spec.metadata.key?("funding_uri")
|
25
|
+
arr << "* #{spec.name} (#{spec.version})\n Funding: #{spec.metadata["funding_uri"]}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if fund_info.empty?
|
30
|
+
Bundler.ui.info "None of the installed gems you directly depend on are looking for funding."
|
31
|
+
else
|
32
|
+
Bundler.ui.info fund_info.join("\n")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -1,18 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "pathname"
|
2
4
|
|
3
5
|
module Bundler
|
6
|
+
class CLI
|
7
|
+
Bundler.require_thor_actions
|
8
|
+
include Thor::Actions
|
9
|
+
end
|
10
|
+
|
4
11
|
class CLI::Gem
|
5
12
|
TEST_FRAMEWORK_VERSIONS = {
|
6
13
|
"rspec" => "3.0",
|
7
|
-
"minitest" => "5.0"
|
8
|
-
|
14
|
+
"minitest" => "5.0",
|
15
|
+
"test-unit" => "3.0",
|
16
|
+
}.freeze
|
9
17
|
|
10
18
|
attr_reader :options, :gem_name, :thor, :name, :target
|
11
19
|
|
12
20
|
def initialize(options, gem_name, thor)
|
13
21
|
@options = options
|
14
22
|
@gem_name = resolve_name(gem_name)
|
23
|
+
|
15
24
|
@thor = thor
|
25
|
+
thor.behavior = :invoke
|
26
|
+
thor.destination_root = nil
|
16
27
|
|
17
28
|
@name = @gem_name
|
18
29
|
@target = SharedHelpers.pwd.join(gem_name)
|
@@ -27,10 +38,12 @@ module Bundler
|
|
27
38
|
namespaced_path = name.tr("-", "/")
|
28
39
|
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
29
40
|
constant_array = constant_name.split("::")
|
30
|
-
test_task = options[:test] == "minitest" ? "test" : "spec"
|
31
41
|
|
32
|
-
|
33
|
-
|
42
|
+
git_installed = Bundler.git_present?
|
43
|
+
|
44
|
+
git_author_name = git_installed ? `git config user.name`.chomp : ""
|
45
|
+
github_username = git_installed ? `git config github.user`.chomp : ""
|
46
|
+
git_user_email = git_installed ? `git config user.email`.chomp : ""
|
34
47
|
|
35
48
|
config = {
|
36
49
|
:name => name,
|
@@ -39,39 +52,39 @@ module Bundler
|
|
39
52
|
:makefile_path => "#{underscored_name}/#{underscored_name}",
|
40
53
|
:constant_name => constant_name,
|
41
54
|
:constant_array => constant_array,
|
42
|
-
:author =>
|
55
|
+
:author => git_author_name.empty? ? "TODO: Write your name" : git_author_name,
|
43
56
|
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
|
44
57
|
:test => options[:test],
|
45
|
-
:test_task => test_task,
|
46
58
|
:ext => options[:ext],
|
47
|
-
:
|
48
|
-
:bundler_version => bundler_dependency_version
|
59
|
+
:exe => options[:exe],
|
60
|
+
:bundler_version => bundler_dependency_version,
|
61
|
+
:github_username => github_username.empty? ? "[USERNAME]" : github_username,
|
62
|
+
:required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
|
49
63
|
}
|
50
64
|
ensure_safe_gem_name(name, constant_array)
|
51
65
|
|
52
66
|
templates = {
|
53
|
-
"
|
54
|
-
"gitignore.tt" => ".gitignore",
|
67
|
+
"#{Bundler.preferred_gemfile_name}.tt" => Bundler.preferred_gemfile_name,
|
55
68
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
56
69
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
57
70
|
"newgem.gemspec.tt" => "#{name}.gemspec",
|
58
71
|
"Rakefile.tt" => "Rakefile",
|
59
72
|
"README.md.tt" => "README.md",
|
60
73
|
"bin/console.tt" => "bin/console",
|
61
|
-
"bin/setup.tt" => "bin/setup"
|
74
|
+
"bin/setup.tt" => "bin/setup",
|
62
75
|
}
|
63
76
|
|
64
|
-
executables = %w
|
77
|
+
executables = %w[
|
65
78
|
bin/console
|
66
79
|
bin/setup
|
67
|
-
|
80
|
+
]
|
81
|
+
|
82
|
+
templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
|
68
83
|
|
69
84
|
if test_framework = ask_and_set_test_framework
|
70
85
|
config[:test] = test_framework
|
71
86
|
config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
|
72
87
|
|
73
|
-
templates.merge!(".travis.yml.tt" => ".travis.yml")
|
74
|
-
|
75
88
|
case test_framework
|
76
89
|
when "rspec"
|
77
90
|
templates.merge!(
|
@@ -79,18 +92,38 @@ module Bundler
|
|
79
92
|
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
80
93
|
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
81
94
|
)
|
95
|
+
config[:test_task] = :spec
|
82
96
|
when "minitest"
|
83
97
|
templates.merge!(
|
84
|
-
"test/test_helper.rb.tt" => "test/test_helper.rb",
|
85
|
-
"test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
98
|
+
"test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
|
99
|
+
"test/minitest/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
100
|
+
)
|
101
|
+
config[:test_task] = :test
|
102
|
+
when "test-unit"
|
103
|
+
templates.merge!(
|
104
|
+
"test/test-unit/test_helper.rb.tt" => "test/test_helper.rb",
|
105
|
+
"test/test-unit/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
86
106
|
)
|
107
|
+
config[:test_task] = :test
|
87
108
|
end
|
88
109
|
end
|
89
110
|
|
111
|
+
config[:ci] = ask_and_set_ci
|
112
|
+
case config[:ci]
|
113
|
+
when "github"
|
114
|
+
templates.merge!("github/workflows/main.yml.tt" => ".github/workflows/main.yml")
|
115
|
+
when "travis"
|
116
|
+
templates.merge!("travis.yml.tt" => ".travis.yml")
|
117
|
+
when "gitlab"
|
118
|
+
templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml")
|
119
|
+
when "circle"
|
120
|
+
templates.merge!("circleci/config.yml.tt" => ".circleci/config.yml")
|
121
|
+
end
|
122
|
+
|
90
123
|
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
91
124
|
"This means that any other developer or company will be legally allowed to use your code " \
|
92
125
|
"for free as long as they admit you created it. You can read more about the MIT license " \
|
93
|
-
"at
|
126
|
+
"at https://choosealicense.com/licenses/mit.")
|
94
127
|
config[:mit] = true
|
95
128
|
Bundler.ui.info "MIT License enabled in config"
|
96
129
|
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
@@ -103,13 +136,24 @@ module Bundler
|
|
103
136
|
"of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
|
104
137
|
"address is specified as a contact in the generated code of conduct so that people know " \
|
105
138
|
"who to contact in case of a violation. For suggestions about " \
|
106
|
-
"how to enforce codes of conduct, see
|
139
|
+
"how to enforce codes of conduct, see https://bit.ly/coc-enforcement.")
|
107
140
|
config[:coc] = true
|
108
141
|
Bundler.ui.info "Code of conduct enabled in config"
|
109
142
|
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
110
143
|
end
|
111
144
|
|
112
|
-
|
145
|
+
if ask_and_set(:rubocop, "Do you want to add rubocop as a dependency for gems you generate?",
|
146
|
+
"RuboCop is a static code analyzer that has out-of-the-box rules for many " \
|
147
|
+
"of the guidelines in the community style guide. " \
|
148
|
+
"For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
|
149
|
+
"and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
|
150
|
+
config[:rubocop] = true
|
151
|
+
config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
|
152
|
+
Bundler.ui.info "RuboCop enabled in config"
|
153
|
+
templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
|
154
|
+
end
|
155
|
+
|
156
|
+
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
113
157
|
|
114
158
|
if options[:ext]
|
115
159
|
templates.merge!(
|
@@ -120,28 +164,37 @@ module Bundler
|
|
120
164
|
end
|
121
165
|
|
122
166
|
templates.each do |src, dst|
|
123
|
-
|
167
|
+
destination = target.join(dst)
|
168
|
+
SharedHelpers.filesystem_access(destination) do
|
169
|
+
thor.template("newgem/#{src}", destination, config)
|
170
|
+
end
|
124
171
|
end
|
125
172
|
|
126
173
|
executables.each do |file|
|
127
|
-
|
128
|
-
|
129
|
-
|
174
|
+
SharedHelpers.filesystem_access(target.join(file)) do |path|
|
175
|
+
executable = (path.stat.mode | 0o111)
|
176
|
+
path.chmod(executable)
|
177
|
+
end
|
130
178
|
end
|
131
179
|
|
132
|
-
Bundler.
|
133
|
-
|
134
|
-
|
135
|
-
|
180
|
+
if Bundler.git_present? && options[:git]
|
181
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
182
|
+
Dir.chdir(target) do
|
183
|
+
`git init`
|
184
|
+
`git add .`
|
185
|
+
end
|
136
186
|
end
|
137
187
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
188
|
+
# Open gemspec in editor
|
189
|
+
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
|
190
|
+
|
191
|
+
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
192
|
+
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
193
|
+
rescue Errno::EEXIST => e
|
194
|
+
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
142
195
|
end
|
143
196
|
|
144
|
-
|
197
|
+
private
|
145
198
|
|
146
199
|
def resolve_name(name)
|
147
200
|
SharedHelpers.pwd.join(name).basename.to_s
|
@@ -166,18 +219,19 @@ module Bundler
|
|
166
219
|
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
167
220
|
"naming guidelines for C extensions. For more information, \n" \
|
168
221
|
"see the 'Extension Naming' section at the following URL:\n" \
|
169
|
-
"
|
222
|
+
"https://guides.rubygems.org/gems-with-extensions/\n"
|
170
223
|
exit 1
|
171
224
|
end
|
172
225
|
|
173
226
|
def ask_and_set_test_framework
|
174
227
|
test_framework = options[:test] || Bundler.settings["gem.test"]
|
175
228
|
|
176
|
-
if test_framework.
|
229
|
+
if test_framework.to_s.empty?
|
177
230
|
Bundler.ui.confirm "Do you want to generate tests with your gem?"
|
178
|
-
|
179
|
-
|
180
|
-
|
231
|
+
Bundler.ui.info hint_text("test")
|
232
|
+
|
233
|
+
result = Bundler.ui.ask "Enter a test framework. rspec/minitest/test-unit/(none):"
|
234
|
+
if result =~ /rspec|minitest|test-unit/
|
181
235
|
test_framework = result
|
182
236
|
else
|
183
237
|
test_framework = false
|
@@ -188,9 +242,54 @@ module Bundler
|
|
188
242
|
Bundler.settings.set_global("gem.test", test_framework)
|
189
243
|
end
|
190
244
|
|
245
|
+
if options[:test] == Bundler.settings["gem.test"]
|
246
|
+
Bundler.ui.info "#{options[:test]} is already configured, ignoring --test flag."
|
247
|
+
end
|
248
|
+
|
191
249
|
test_framework
|
192
250
|
end
|
193
251
|
|
252
|
+
def hint_text(setting)
|
253
|
+
if Bundler.settings["gem.#{setting}"] == false
|
254
|
+
"Your choice will only be applied to this gem."
|
255
|
+
else
|
256
|
+
"Future `bundle gem` calls will use your choice. " \
|
257
|
+
"This setting can be changed anytime with `bundle config gem.#{setting}`."
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def ask_and_set_ci
|
262
|
+
ci_template = options[:ci] || Bundler.settings["gem.ci"]
|
263
|
+
|
264
|
+
if ci_template.to_s.empty?
|
265
|
+
Bundler.ui.confirm "Do you want to set up continuous integration for your gem? " \
|
266
|
+
"Supported services:\n" \
|
267
|
+
"* CircleCI: https://circleci.com/\n" \
|
268
|
+
"* GitHub Actions: https://github.com/features/actions\n" \
|
269
|
+
"* GitLab CI: https://docs.gitlab.com/ee/ci/\n" \
|
270
|
+
"* Travis CI: https://travis-ci.org/\n" \
|
271
|
+
"\n"
|
272
|
+
Bundler.ui.info hint_text("ci")
|
273
|
+
|
274
|
+
result = Bundler.ui.ask "Enter a CI service. github/travis/gitlab/circle/(none):"
|
275
|
+
if result =~ /github|travis|gitlab|circle/
|
276
|
+
ci_template = result
|
277
|
+
else
|
278
|
+
ci_template = false
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
if Bundler.settings["gem.ci"].nil?
|
283
|
+
Bundler.settings.set_global("gem.ci", ci_template)
|
284
|
+
end
|
285
|
+
|
286
|
+
if options[:ci] == Bundler.settings["gem.ci"]
|
287
|
+
Bundler.ui.info "#{options[:ci]} is already configured, ignoring --ci flag."
|
288
|
+
end
|
289
|
+
|
290
|
+
ci_template
|
291
|
+
end
|
292
|
+
|
194
293
|
def bundler_dependency_version
|
195
294
|
v = Gem::Version.new(Bundler::VERSION)
|
196
295
|
req = v.segments[0..1]
|
@@ -202,10 +301,27 @@ module Bundler
|
|
202
301
|
if name =~ /^\d/
|
203
302
|
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
|
204
303
|
exit 1
|
205
|
-
elsif constant_array.inject(Object) {|c, s| (c.const_defined?(s) && c.const_get(s)) || break }
|
206
|
-
Bundler.ui.error "Invalid gem name #{name} constant #{constant_array.join("::")} is already in use. Please choose another gem name."
|
207
|
-
exit 1
|
208
304
|
end
|
305
|
+
|
306
|
+
constant_name = constant_array.join("::")
|
307
|
+
|
308
|
+
existing_constant = constant_array.inject(Object) do |c, s|
|
309
|
+
defined = begin
|
310
|
+
c.const_defined?(s)
|
311
|
+
rescue NameError
|
312
|
+
Bundler.ui.error "Invalid gem name #{name} -- `#{constant_name}` is an invalid constant name"
|
313
|
+
exit 1
|
314
|
+
end
|
315
|
+
(defined && c.const_get(s)) || break
|
316
|
+
end
|
317
|
+
|
318
|
+
return unless existing_constant
|
319
|
+
Bundler.ui.error "Invalid gem name #{name} constant #{constant_name} is already in use. Please choose another gem name."
|
320
|
+
exit 1
|
321
|
+
end
|
322
|
+
|
323
|
+
def open_editor(editor, file)
|
324
|
+
thor.run(%(#{editor} "#{file}"))
|
209
325
|
end
|
210
326
|
end
|
211
327
|
end
|