bundler 1.9.0 → 1.17.3
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 +1157 -6
- data/README.md +33 -6
- data/bundler.gemspec +51 -18
- data/exe/bundle +31 -0
- data/{bin → exe}/bundle_ruby +10 -6
- data/exe/bundler +4 -0
- data/lib/bundler.rb +326 -207
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +9 -3
- data/lib/bundler/cli.rb +522 -141
- data/lib/bundler/cli/add.rb +35 -0
- data/lib/bundler/cli/binstubs.rb +22 -11
- data/lib/bundler/cli/cache.rb +7 -6
- data/lib/bundler/cli/check.rb +11 -8
- data/lib/bundler/cli/clean.rb +7 -8
- data/lib/bundler/cli/common.rb +53 -7
- data/lib/bundler/cli/config.rb +84 -49
- data/lib/bundler/cli/console.rb +13 -8
- data/lib/bundler/cli/doctor.rb +140 -0
- data/lib/bundler/cli/exec.rb +77 -16
- data/lib/bundler/cli/gem.rb +120 -52
- data/lib/bundler/cli/info.rb +50 -0
- data/lib/bundler/cli/init.rb +21 -7
- data/lib/bundler/cli/inject.rb +37 -10
- data/lib/bundler/cli/install.rb +139 -78
- data/lib/bundler/cli/issue.rb +40 -0
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +63 -0
- data/lib/bundler/cli/open.rb +9 -6
- data/lib/bundler/cli/outdated.rb +221 -35
- data/lib/bundler/cli/package.rb +11 -7
- data/lib/bundler/cli/platform.rb +7 -4
- data/lib/bundler/cli/plugin.rb +24 -0
- data/lib/bundler/cli/pristine.rb +47 -0
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +11 -10
- data/lib/bundler/cli/update.rb +47 -29
- data/lib/bundler/cli/viz.rb +12 -8
- data/lib/bundler/compact_index_client.rb +109 -0
- data/lib/bundler/compact_index_client/cache.rb +118 -0
- data/lib/bundler/compact_index_client/updater.rb +116 -0
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +3 -1
- data/lib/bundler/current_ruby.rb +47 -137
- data/lib/bundler/definition.rb +599 -230
- data/lib/bundler/dep_proxy.rb +15 -10
- data/lib/bundler/dependency.rb +54 -25
- data/lib/bundler/deployment.rb +12 -2
- data/lib/bundler/deprecate.rb +33 -4
- data/lib/bundler/dsl.rb +383 -99
- data/lib/bundler/endpoint_specification.rb +72 -7
- data/lib/bundler/env.rb +121 -41
- data/lib/bundler/environment_preserver.rb +59 -0
- data/lib/bundler/errors.rb +158 -0
- data/lib/bundler/feature_flag.rb +74 -0
- data/lib/bundler/fetcher.rb +171 -280
- data/lib/bundler/fetcher/base.rb +52 -0
- data/lib/bundler/fetcher/compact_index.rb +126 -0
- data/lib/bundler/fetcher/dependency.rb +82 -0
- data/lib/bundler/fetcher/downloader.rb +84 -0
- data/lib/bundler/fetcher/index.rb +52 -0
- data/lib/bundler/friendly_errors.rb +113 -58
- data/lib/bundler/gem_helper.rb +73 -46
- data/lib/bundler/gem_helpers.rb +85 -9
- data/lib/bundler/gem_remote_fetcher.rb +43 -0
- data/lib/bundler/gem_tasks.rb +6 -1
- data/lib/bundler/gem_version_promoter.rb +190 -0
- data/lib/bundler/gemdeps.rb +29 -0
- data/lib/bundler/graph.rb +32 -49
- data/lib/bundler/index.rb +79 -67
- data/lib/bundler/injector.rb +219 -30
- data/lib/bundler/inline.rb +74 -0
- data/lib/bundler/installer.rb +191 -206
- data/lib/bundler/installer/gem_installer.rb +85 -0
- data/lib/bundler/installer/parallel_installer.rb +233 -0
- data/lib/bundler/installer/standalone.rb +53 -0
- data/lib/bundler/lazy_specification.rb +53 -13
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +157 -62
- data/lib/bundler/match_platform.rb +15 -4
- data/lib/bundler/mirror.rb +223 -0
- data/lib/bundler/plugin.rb +292 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/api/source.rb +306 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +162 -0
- data/lib/bundler/plugin/installer.rb +96 -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 +17 -6
- data/lib/bundler/remote_specification.rb +68 -11
- data/lib/bundler/resolver.rb +263 -229
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/retry.rb +25 -19
- data/lib/bundler/ruby_dsl.rb +9 -2
- data/lib/bundler/ruby_version.rb +101 -66
- data/lib/bundler/rubygems_ext.rb +77 -37
- data/lib/bundler/rubygems_gem_installer.rb +106 -0
- data/lib/bundler/rubygems_integration.rb +450 -163
- data/lib/bundler/runtime.rb +133 -103
- data/lib/bundler/settings.rb +344 -83
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/setup.rb +7 -3
- data/lib/bundler/shared_helpers.rb +284 -54
- data/lib/bundler/similarity_detector.rb +21 -21
- data/lib/bundler/source.rb +68 -15
- data/lib/bundler/source/gemspec.rb +18 -0
- data/lib/bundler/source/git.rb +90 -55
- data/lib/bundler/source/git/git_proxy.rb +135 -35
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path.rb +84 -61
- data/lib/bundler/source/path/installer.rb +53 -17
- data/lib/bundler/source/rubygems.rb +282 -122
- data/lib/bundler/source/rubygems/remote.rb +69 -0
- data/lib/bundler/source_list.rb +107 -22
- data/lib/bundler/spec_set.rb +83 -45
- data/lib/bundler/ssl_certs/certificate_manager.rb +8 -7
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
- data/lib/bundler/ssl_certs/{DigiCertHighAssuranceEVRootCA.pem → rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem} +0 -0
- data/lib/bundler/ssl_certs/{AddTrustExternalCARoot-2048.pem → rubygems.org/AddTrustExternalCARoot.pem} +0 -0
- data/lib/bundler/stub_specification.rb +108 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +19 -6
- data/lib/bundler/templates/Executable.bundler +105 -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 +68 -7
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -2
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
- data/lib/bundler/templates/newgem/README.md.tt +19 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +10 -6
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
- 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/gitignore.tt +5 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -6
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +31 -15
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +3 -5
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +14 -2
- data/lib/bundler/templates/newgem/test/{test_newgem.rb.tt → newgem_test.rb.tt} +2 -2
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/travis.yml.tt +7 -0
- data/lib/bundler/ui.rb +5 -3
- data/lib/bundler/ui/rg_proxy.rb +5 -7
- data/lib/bundler/ui/shell.rb +69 -18
- data/lib/bundler/ui/silent.rb +26 -1
- data/lib/bundler/uri_credentials_filter.rb +37 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +12 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- 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 +223 -0
- 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 +136 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +143 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
- data/lib/bundler/vendor/{Molinillo-0.2.1 → molinillo}/lib/molinillo/modules/specification_provider.rb +11 -0
- data/lib/bundler/vendor/{Molinillo-0.2.1 → molinillo}/lib/molinillo/modules/ui.rb +6 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +837 -0
- data/lib/bundler/vendor/{Molinillo-0.2.1 → molinillo}/lib/molinillo/resolver.rb +6 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +58 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +27 -24
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor.rb +47 -22
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions.rb +31 -29
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/directory.rb +3 -3
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/empty_directory.rb +16 -8
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/file_manipulation.rb +66 -18
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/actions/inject_into_file.rb +18 -16
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/base.rb +67 -44
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/command.rb +13 -11
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/core_ext/hash_with_indifferent_access.rb +21 -1
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +12 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +129 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/error.rb +3 -3
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/group.rb +14 -14
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/invocation.rb +4 -5
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/line_editor/readline.rb +0 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/argument.rb +4 -7
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/arguments.rb +16 -16
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/option.rb +42 -21
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/parser/options.rb +13 -10
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/rake_compat.rb +1 -1
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/runner.rb +35 -33
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/basic.rb +49 -33
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/color.rb +2 -2
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/shell/html.rb +5 -5
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/util.rb +8 -7
- data/lib/bundler/vendor/{thor-0.19.1 → thor}/lib/thor/version.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +4 -5
- data/lib/bundler/vendored_persistent.rb +45 -4
- data/lib/bundler/vendored_thor.rb +8 -5
- data/lib/bundler/version.rb +23 -1
- data/lib/bundler/version_ranges.rb +76 -0
- data/lib/bundler/vlad.rb +8 -2
- data/lib/bundler/worker.rb +39 -6
- data/lib/bundler/yaml_serializer.rb +90 -0
- data/man/bundle-add.1 +58 -0
- data/man/bundle-add.1.txt +52 -0
- data/man/bundle-add.ronn +40 -0
- data/man/bundle-binstubs.1 +40 -0
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +43 -0
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +33 -0
- data/man/bundle-check.ronn +26 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-clean.ronn +18 -0
- data/man/bundle-config.1 +497 -0
- data/man/bundle-config.1.txt +529 -0
- data/man/bundle-config.ronn +256 -31
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/man/bundle-exec.1 +165 -0
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +19 -3
- data/man/bundle-gem.1 +80 -0
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +78 -0
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-info.ronn +17 -0
- data/man/bundle-init.1 +25 -0
- data/man/bundle-init.1.txt +34 -0
- data/man/bundle-init.ronn +29 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-inject.ronn +22 -0
- data/man/bundle-install.1 +308 -0
- data/man/bundle-install.1.txt +396 -0
- data/man/bundle-install.ronn +64 -67
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/man/bundle-lock.1 +84 -0
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-lock.ronn +94 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-open.ronn +19 -0
- data/man/bundle-outdated.1 +155 -0
- data/man/bundle-outdated.1.txt +131 -0
- data/man/bundle-outdated.ronn +111 -0
- data/man/bundle-package.1 +55 -0
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +14 -8
- data/man/bundle-platform.1 +61 -0
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-platform.ronn +1 -1
- data/man/bundle-pristine.1 +34 -0
- data/man/bundle-pristine.1.txt +44 -0
- data/man/bundle-pristine.ronn +34 -0
- data/man/bundle-remove.1 +31 -0
- data/man/bundle-remove.1.txt +34 -0
- data/man/bundle-remove.ronn +23 -0
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +27 -0
- data/man/bundle-show.ronn +21 -0
- data/man/bundle-update.1 +394 -0
- data/man/bundle-update.1.txt +391 -0
- data/man/bundle-update.ronn +180 -18
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +39 -0
- data/man/bundle-viz.ronn +30 -0
- data/man/bundle.1 +136 -0
- data/man/bundle.1.txt +116 -0
- data/man/bundle.ronn +46 -33
- data/man/gemfile.5 +689 -0
- data/man/gemfile.5.ronn +127 -79
- data/man/gemfile.5.txt +653 -0
- data/man/index.txt +25 -7
- metadata +242 -95
- data/.gitignore +0 -16
- data/.rspec +0 -3
- data/.travis.yml +0 -110
- data/CODE_OF_CONDUCT.md +0 -40
- data/CONTRIBUTING.md +0 -32
- data/DEVELOPMENT.md +0 -119
- data/ISSUES.md +0 -96
- data/Rakefile +0 -302
- data/UPGRADING.md +0 -103
- data/bin/bundle +0 -21
- data/bin/bundler +0 -21
- data/lib/bundler/anonymizable_uri.rb +0 -32
- data/lib/bundler/environment.rb +0 -42
- data/lib/bundler/gem_installer.rb +0 -9
- data/lib/bundler/gem_path_manipulation.rb +0 -8
- data/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem +0 -32
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +0 -14
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +0 -28
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +0 -20
- data/lib/bundler/templates/newgem/.travis.yml.tt +0 -3
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +0 -4
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo.rb +0 -5
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/dependency_graph.rb +0 -266
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/errors.rb +0 -69
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/gem_metadata.rb +0 -3
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/resolution.rb +0 -412
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/state.rb +0 -43
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/core_ext/io_binary_read.rb +0 -10
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/core_ext/ordered_hash.rb +0 -98
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/parser.rb +0 -4
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,10 +9,13 @@ 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
|
-
console = get_console(Bundler.settings[:console] ||
|
18
|
+
console = get_console(Bundler.settings[:console] || "irb")
|
14
19
|
console.start
|
15
20
|
end
|
16
21
|
|
@@ -18,21 +23,21 @@ module Bundler
|
|
18
23
|
require name
|
19
24
|
get_constant(name)
|
20
25
|
rescue LoadError
|
21
|
-
Bundler.ui.error "Couldn't load console #{name}"
|
22
|
-
|
26
|
+
Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
|
27
|
+
require "irb"
|
28
|
+
get_constant("irb")
|
23
29
|
end
|
24
30
|
|
25
31
|
def get_constant(name)
|
26
32
|
const_name = {
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
"pry" => :Pry,
|
34
|
+
"ripl" => :Ripl,
|
35
|
+
"irb" => :IRB,
|
30
36
|
}[name]
|
31
37
|
Object.const_get(const_name)
|
32
38
|
rescue NameError
|
33
39
|
Bundler.ui.error "Could not find constant #{const_name}"
|
34
40
|
exit 1
|
35
41
|
end
|
36
|
-
|
37
42
|
end
|
38
43
|
end
|
@@ -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 /
|
8
|
+
LDD_REGEX = /\t\S+ => (\S+) \(\S+\)/
|
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 "bundler/cli/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.home.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,13 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/current_ruby"
|
4
|
+
|
1
5
|
module Bundler
|
2
6
|
class CLI::Exec
|
3
7
|
attr_reader :options, :args, :cmd
|
4
8
|
|
9
|
+
TRAPPED_SIGNALS = %w[INT].freeze
|
10
|
+
|
5
11
|
def initialize(options, args)
|
6
12
|
@options = options
|
7
13
|
@cmd = args.shift
|
8
14
|
@args = args
|
9
15
|
|
10
|
-
if
|
16
|
+
if Bundler.current_ruby.ruby_2? && !Bundler.current_ruby.jruby?
|
11
17
|
@args << { :close_others => !options.keep_file_descriptors? }
|
12
18
|
elsif options.keep_file_descriptors?
|
13
19
|
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
@@ -15,30 +21,85 @@ module Bundler
|
|
15
21
|
end
|
16
22
|
|
17
23
|
def run
|
18
|
-
|
19
|
-
|
20
|
-
# First, try to exec directly to something in PATH
|
24
|
+
validate_cmd!
|
21
25
|
SharedHelpers.set_bundle_environment
|
22
|
-
bin_path = Bundler.which(
|
23
|
-
|
24
|
-
|
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
|
+
# First, try to exec directly to something in PATH
|
31
|
+
if Bundler.current_ruby.jruby_18?
|
32
|
+
kernel_exec(bin_path, *args)
|
33
|
+
else
|
34
|
+
kernel_exec([bin_path, cmd], *args)
|
35
|
+
end
|
36
|
+
else
|
37
|
+
# exec using the given command
|
38
|
+
kernel_exec(cmd, *args)
|
25
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def validate_cmd!
|
45
|
+
return unless cmd.nil?
|
46
|
+
Bundler.ui.error "bundler: exec needs a command to run"
|
47
|
+
exit 128
|
48
|
+
end
|
26
49
|
|
27
|
-
|
28
|
-
Bundler.
|
29
|
-
Bundler.
|
30
|
-
Kernel.exec(
|
31
|
-
rescue Errno::EACCES
|
50
|
+
def kernel_exec(*args)
|
51
|
+
ui = Bundler.ui
|
52
|
+
Bundler.ui = nil
|
53
|
+
Kernel.exec(*args)
|
54
|
+
rescue Errno::EACCES, Errno::ENOEXEC
|
55
|
+
Bundler.ui = ui
|
32
56
|
Bundler.ui.error "bundler: not executable: #{cmd}"
|
33
57
|
exit 126
|
34
58
|
rescue Errno::ENOENT
|
59
|
+
Bundler.ui = ui
|
35
60
|
Bundler.ui.error "bundler: command not found: #{cmd}"
|
36
|
-
Bundler.ui.warn
|
61
|
+
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
37
62
|
exit 127
|
38
|
-
rescue ArgumentError
|
39
|
-
Bundler.ui.error "bundler: exec needs a command to run"
|
40
|
-
exit 128
|
41
63
|
end
|
42
64
|
|
65
|
+
def kernel_load(file, *args)
|
66
|
+
args.pop if args.last.is_a?(Hash)
|
67
|
+
ARGV.replace(args)
|
68
|
+
$0 = file
|
69
|
+
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
|
70
|
+
ui = Bundler.ui
|
71
|
+
Bundler.ui = nil
|
72
|
+
require "bundler/setup"
|
73
|
+
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
|
74
|
+
Kernel.load(file)
|
75
|
+
rescue SystemExit, SignalException
|
76
|
+
raise
|
77
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
78
|
+
Bundler.ui = ui
|
79
|
+
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
|
80
|
+
backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
|
81
|
+
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def process_title(file, args)
|
85
|
+
"#{file} #{args.join(" ")}".strip
|
86
|
+
end
|
87
|
+
|
88
|
+
def ruby_shebang?(file)
|
89
|
+
possibilities = [
|
90
|
+
"#!/usr/bin/env ruby\n",
|
91
|
+
"#!/usr/bin/env jruby\n",
|
92
|
+
"#!/usr/bin/env truffleruby\n",
|
93
|
+
"#!#{Gem.ruby}\n",
|
94
|
+
]
|
95
|
+
|
96
|
+
if File.zero?(file)
|
97
|
+
Bundler.ui.warn "#{file} is empty"
|
98
|
+
return false
|
99
|
+
end
|
100
|
+
|
101
|
+
first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) }
|
102
|
+
possibilities.any? {|shebang| first_line.start_with?(shebang) }
|
103
|
+
end
|
43
104
|
end
|
44
105
|
end
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -1,16 +1,31 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
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
|
12
|
+
TEST_FRAMEWORK_VERSIONS = {
|
13
|
+
"rspec" => "3.0",
|
14
|
+
"minitest" => "5.0"
|
15
|
+
}.freeze
|
16
|
+
|
5
17
|
attr_reader :options, :gem_name, :thor, :name, :target
|
6
18
|
|
7
19
|
def initialize(options, gem_name, thor)
|
8
20
|
@options = options
|
9
21
|
@gem_name = resolve_name(gem_name)
|
22
|
+
|
10
23
|
@thor = thor
|
24
|
+
thor.behavior = :invoke
|
25
|
+
thor.destination_root = nil
|
11
26
|
|
12
27
|
@name = @gem_name
|
13
|
-
@target =
|
28
|
+
@target = SharedHelpers.pwd.join(gem_name)
|
14
29
|
|
15
30
|
validate_ext_name if options[:ext]
|
16
31
|
end
|
@@ -18,13 +33,16 @@ module Bundler
|
|
18
33
|
def run
|
19
34
|
Bundler.ui.confirm "Creating gem '#{name}'..."
|
20
35
|
|
21
|
-
underscored_name = name.tr(
|
22
|
-
namespaced_path = name.tr(
|
23
|
-
constant_name = name.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
36
|
+
underscored_name = name.tr("-", "_")
|
37
|
+
namespaced_path = name.tr("-", "/")
|
38
|
+
constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
|
39
|
+
constant_array = constant_name.split("::")
|
40
|
+
|
41
|
+
git_installed = Bundler.git_present?
|
42
|
+
|
43
|
+
git_author_name = git_installed ? `git config user.name`.chomp : ""
|
44
|
+
github_username = git_installed ? `git config github.user`.chomp : ""
|
45
|
+
git_user_email = git_installed ? `git config user.email`.chomp : ""
|
28
46
|
|
29
47
|
config = {
|
30
48
|
:name => name,
|
@@ -33,18 +51,18 @@ module Bundler
|
|
33
51
|
:makefile_path => "#{underscored_name}/#{underscored_name}",
|
34
52
|
:constant_name => constant_name,
|
35
53
|
:constant_array => constant_array,
|
36
|
-
:author =>
|
54
|
+
:author => git_author_name.empty? ? "TODO: Write your name" : git_author_name,
|
37
55
|
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
|
38
56
|
:test => options[:test],
|
39
57
|
:ext => options[:ext],
|
40
|
-
:
|
41
|
-
:bundler_version => bundler_dependency_version
|
58
|
+
:exe => options[:exe],
|
59
|
+
:bundler_version => bundler_dependency_version,
|
60
|
+
:github_username => github_username.empty? ? "[USERNAME]" : github_username
|
42
61
|
}
|
43
62
|
ensure_safe_gem_name(name, constant_array)
|
44
63
|
|
45
64
|
templates = {
|
46
65
|
"Gemfile.tt" => "Gemfile",
|
47
|
-
"gitignore.tt" => ".gitignore",
|
48
66
|
"lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb",
|
49
67
|
"lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb",
|
50
68
|
"newgem.gemspec.tt" => "#{name}.gemspec",
|
@@ -54,44 +72,59 @@ module Bundler
|
|
54
72
|
"bin/setup.tt" => "bin/setup"
|
55
73
|
}
|
56
74
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
"of enforcing it, so be sure that you are prepared to do that. For suggestions about " \
|
62
|
-
"how to enforce codes of conduct, see bit.ly/coc-enforcement."
|
63
|
-
)
|
64
|
-
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
65
|
-
end
|
75
|
+
executables = %w[
|
76
|
+
bin/console
|
77
|
+
bin/setup
|
78
|
+
]
|
66
79
|
|
67
|
-
|
68
|
-
"This means that any other developer or company will be legally allowed to use your code " \
|
69
|
-
"for free as long as they admit you created it. You can read more about the MIT license " \
|
70
|
-
"at choosealicense.com/licenses/mit."
|
71
|
-
)
|
72
|
-
config[:mit] = true
|
73
|
-
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
74
|
-
end
|
80
|
+
templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
|
75
81
|
|
76
82
|
if test_framework = ask_and_set_test_framework
|
77
|
-
|
83
|
+
config[:test] = test_framework
|
84
|
+
config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework]
|
85
|
+
|
86
|
+
templates.merge!("travis.yml.tt" => ".travis.yml")
|
78
87
|
|
79
88
|
case test_framework
|
80
|
-
when
|
89
|
+
when "rspec"
|
81
90
|
templates.merge!(
|
82
91
|
"rspec.tt" => ".rspec",
|
83
92
|
"spec/spec_helper.rb.tt" => "spec/spec_helper.rb",
|
84
93
|
"spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb"
|
85
94
|
)
|
86
|
-
when
|
95
|
+
when "minitest"
|
87
96
|
templates.merge!(
|
88
|
-
"test/
|
89
|
-
"test/
|
97
|
+
"test/test_helper.rb.tt" => "test/test_helper.rb",
|
98
|
+
"test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb"
|
90
99
|
)
|
91
100
|
end
|
92
101
|
end
|
93
102
|
|
94
|
-
|
103
|
+
config[:test_task] = config[:test] == "minitest" ? "test" : "spec"
|
104
|
+
|
105
|
+
if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?",
|
106
|
+
"This means that any other developer or company will be legally allowed to use your code " \
|
107
|
+
"for free as long as they admit you created it. You can read more about the MIT license " \
|
108
|
+
"at https://choosealicense.com/licenses/mit.")
|
109
|
+
config[:mit] = true
|
110
|
+
Bundler.ui.info "MIT License enabled in config"
|
111
|
+
templates.merge!("LICENSE.txt.tt" => "LICENSE.txt")
|
112
|
+
end
|
113
|
+
|
114
|
+
if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?",
|
115
|
+
"Codes of conduct can increase contributions to your project by contributors who " \
|
116
|
+
"prefer collaborative, safe spaces. You can read more about the code of conduct at " \
|
117
|
+
"contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \
|
118
|
+
"of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \
|
119
|
+
"address is specified as a contact in the generated code of conduct so that people know " \
|
120
|
+
"who to contact in case of a violation. For suggestions about " \
|
121
|
+
"how to enforce codes of conduct, see https://bit.ly/coc-enforcement.")
|
122
|
+
config[:coc] = true
|
123
|
+
Bundler.ui.info "Code of conduct enabled in config"
|
124
|
+
templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md")
|
125
|
+
end
|
126
|
+
|
127
|
+
templates.merge!("exe/newgem.tt" => "exe/#{name}") if config[:exe]
|
95
128
|
|
96
129
|
if options[:ext]
|
97
130
|
templates.merge!(
|
@@ -102,30 +135,49 @@ module Bundler
|
|
102
135
|
end
|
103
136
|
|
104
137
|
templates.each do |src, dst|
|
105
|
-
|
138
|
+
destination = target.join(dst)
|
139
|
+
SharedHelpers.filesystem_access(destination) do
|
140
|
+
thor.template("newgem/#{src}", destination, config)
|
141
|
+
end
|
106
142
|
end
|
107
143
|
|
108
|
-
|
109
|
-
|
144
|
+
executables.each do |file|
|
145
|
+
SharedHelpers.filesystem_access(target.join(file)) do |path|
|
146
|
+
executable = (path.stat.mode | 0o111)
|
147
|
+
path.chmod(executable)
|
148
|
+
end
|
149
|
+
end
|
110
150
|
|
111
|
-
if
|
112
|
-
|
113
|
-
|
151
|
+
if Bundler.git_present?
|
152
|
+
Bundler.ui.info "Initializing git repo in #{target}"
|
153
|
+
Dir.chdir(target) do
|
154
|
+
`git init`
|
155
|
+
`git add .`
|
156
|
+
end
|
114
157
|
end
|
158
|
+
|
159
|
+
# Open gemspec in editor
|
160
|
+
open_editor(options["edit"], target.join("#{name}.gemspec")) if options[:edit]
|
161
|
+
|
162
|
+
Bundler.ui.info "Gem '#{name}' was successfully created. " \
|
163
|
+
"For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
|
164
|
+
rescue Errno::EEXIST => e
|
165
|
+
raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
|
115
166
|
end
|
116
167
|
|
117
|
-
|
168
|
+
private
|
118
169
|
|
119
170
|
def resolve_name(name)
|
120
|
-
|
171
|
+
SharedHelpers.pwd.join(name).basename.to_s
|
121
172
|
end
|
122
173
|
|
123
174
|
def ask_and_set(key, header, message)
|
124
|
-
choice = options[key]
|
175
|
+
choice = options[key]
|
176
|
+
choice = Bundler.settings["gem.#{key}"] if choice.nil?
|
125
177
|
|
126
178
|
if choice.nil?
|
127
179
|
Bundler.ui.confirm header
|
128
|
-
choice =
|
180
|
+
choice = Bundler.ui.yes? "#{message} y/(n):"
|
129
181
|
Bundler.settings.set_global("gem.#{key}", choice)
|
130
182
|
end
|
131
183
|
|
@@ -133,7 +185,7 @@ module Bundler
|
|
133
185
|
end
|
134
186
|
|
135
187
|
def validate_ext_name
|
136
|
-
return unless gem_name.index(
|
188
|
+
return unless gem_name.index("-")
|
137
189
|
|
138
190
|
Bundler.ui.error "You have specified a gem name which does not conform to the \n" \
|
139
191
|
"naming guidelines for C extensions. For more information, \n" \
|
@@ -166,19 +218,35 @@ module Bundler
|
|
166
218
|
def bundler_dependency_version
|
167
219
|
v = Gem::Version.new(Bundler::VERSION)
|
168
220
|
req = v.segments[0..1]
|
169
|
-
req <<
|
221
|
+
req << "a" if v.prerelease?
|
170
222
|
req.join(".")
|
171
223
|
end
|
172
224
|
|
173
|
-
def ensure_safe_gem_name
|
225
|
+
def ensure_safe_gem_name(name, constant_array)
|
174
226
|
if name =~ /^\d/
|
175
227
|
Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
|
176
228
|
exit 1
|
177
|
-
elsif Object.const_defined?(constant_array.first)
|
178
|
-
Bundler.ui.error "Invalid gem name #{name} constant #{constant_array.join("::")} is already in use. Please choose another gem name."
|
179
|
-
exit 1
|
180
229
|
end
|
230
|
+
|
231
|
+
constant_name = constant_array.join("::")
|
232
|
+
|
233
|
+
existing_constant = constant_array.inject(Object) do |c, s|
|
234
|
+
defined = begin
|
235
|
+
c.const_defined?(s)
|
236
|
+
rescue NameError
|
237
|
+
Bundler.ui.error "Invalid gem name #{name} -- `#{constant_name}` is an invalid constant name"
|
238
|
+
exit 1
|
239
|
+
end
|
240
|
+
(defined && c.const_get(s)) || break
|
241
|
+
end
|
242
|
+
|
243
|
+
return unless existing_constant
|
244
|
+
Bundler.ui.error "Invalid gem name #{name} constant #{constant_name} is already in use. Please choose another gem name."
|
245
|
+
exit 1
|
181
246
|
end
|
182
247
|
|
248
|
+
def open_editor(editor, file)
|
249
|
+
thor.run(%(#{editor} "#{file}"))
|
250
|
+
end
|
183
251
|
end
|
184
252
|
end
|