bundler 1.17.2 → 2.2.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2095 -1251
- data/LICENSE.md +18 -19
- data/README.md +10 -11
- data/bundler.gemspec +10 -28
- data/exe/bundle +22 -3
- data/lib/bundler/build_metadata.rb +4 -12
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/binstubs.rb +6 -2
- data/lib/bundler/cli/cache.rb +24 -17
- data/lib/bundler/cli/check.rb +4 -2
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +39 -13
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +20 -9
- data/lib/bundler/cli/exec.rb +8 -25
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +213 -32
- data/lib/bundler/cli/info.rb +42 -7
- data/lib/bundler/cli/init.rb +2 -2
- data/lib/bundler/cli/inject.rb +1 -1
- data/lib/bundler/cli/install.rb +34 -44
- data/lib/bundler/cli/issue.rb +8 -7
- data/lib/bundler/cli/list.rb +19 -11
- data/lib/bundler/cli/lock.rb +5 -1
- data/lib/bundler/cli/open.rb +11 -8
- data/lib/bundler/cli/outdated.rb +142 -118
- data/lib/bundler/cli/plugin.rb +19 -2
- data/lib/bundler/cli/pristine.rb +6 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/show.rb +2 -2
- data/lib/bundler/cli/update.rb +43 -16
- data/lib/bundler/cli.rb +211 -150
- data/lib/bundler/compact_index_client/cache.rb +6 -14
- data/lib/bundler/compact_index_client/gem_parser.rb +28 -0
- data/lib/bundler/compact_index_client/updater.rb +15 -28
- data/lib/bundler/compact_index_client.rb +28 -12
- data/lib/bundler/current_ruby.rb +14 -11
- data/lib/bundler/definition.rb +207 -368
- data/lib/bundler/dep_proxy.rb +16 -9
- data/lib/bundler/dependency.rb +19 -14
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +81 -81
- data/lib/bundler/endpoint_specification.rb +1 -1
- data/lib/bundler/env.rb +9 -14
- data/lib/bundler/environment_preserver.rb +29 -3
- data/lib/bundler/errors.rb +20 -3
- data/lib/bundler/feature_flag.rb +14 -33
- data/lib/bundler/fetcher/base.rb +1 -1
- data/lib/bundler/fetcher/compact_index.rb +28 -14
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +8 -8
- data/lib/bundler/fetcher.rb +22 -17
- data/lib/bundler/friendly_errors.rb +29 -48
- data/lib/bundler/gem_helper.rb +79 -43
- data/lib/bundler/gem_helpers.rb +38 -29
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +5 -5
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/index.rb +9 -9
- data/lib/bundler/injector.rb +33 -13
- data/lib/bundler/inline.rb +41 -30
- data/lib/bundler/installer/gem_installer.rb +9 -18
- data/lib/bundler/installer/parallel_installer.rb +50 -33
- data/lib/bundler/installer/standalone.rb +30 -11
- data/lib/bundler/installer.rb +39 -66
- data/lib/bundler/lazy_specification.rb +63 -28
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +19 -52
- data/lib/bundler/{ssl_certs → man}/.document +0 -0
- data/{man → lib/bundler/man}/bundle-add.1 +10 -2
- data/{man/bundle-add.ronn → lib/bundler/man/bundle-add.1.ronn} +7 -1
- data/{man → lib/bundler/man}/bundle-binstubs.1 +6 -4
- data/{man/bundle-binstubs.ronn → lib/bundler/man/bundle-binstubs.1.ronn} +3 -5
- data/lib/bundler/man/bundle-cache.1 +55 -0
- data/{man/bundle-package.ronn → lib/bundler/man/bundle-cache.1.ronn} +15 -15
- data/{man → lib/bundler/man}/bundle-check.1 +1 -1
- data/{man/bundle-check.ronn → lib/bundler/man/bundle-check.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-clean.1 +1 -1
- data/{man/bundle-clean.ronn → lib/bundler/man/bundle-clean.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-config.1 +59 -60
- data/{man/bundle-config.ronn → lib/bundler/man/bundle-config.1.ronn} +77 -78
- data/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
- data/{man/bundle-doctor.ronn → lib/bundler/man/bundle-doctor.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-exec.1 +2 -2
- data/{man/bundle-exec.ronn → lib/bundler/man/bundle-exec.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-gem.1 +38 -3
- data/{man/bundle-gem.ronn → lib/bundler/man/bundle-gem.1.ronn} +46 -7
- data/{man → lib/bundler/man}/bundle-info.1 +1 -1
- data/{man/bundle-info.ronn → lib/bundler/man/bundle-info.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-init.1 +2 -2
- data/{man/bundle-init.ronn → lib/bundler/man/bundle-init.1.ronn} +1 -1
- data/{man → lib/bundler/man}/bundle-inject.1 +1 -1
- data/{man/bundle-inject.ronn → lib/bundler/man/bundle-inject.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-install.1 +37 -7
- data/{man/bundle-install.ronn → lib/bundler/man/bundle-install.1.ronn} +34 -7
- data/{man → lib/bundler/man}/bundle-list.1 +7 -7
- data/{man/bundle-list.ronn → lib/bundler/man/bundle-list.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-lock.1 +1 -1
- data/{man/bundle-lock.ronn → lib/bundler/man/bundle-lock.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-open.1 +1 -1
- data/{man/bundle-open.ronn → lib/bundler/man/bundle-open.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
- data/{man/bundle-outdated.ronn → lib/bundler/man/bundle-outdated.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-platform.1 +1 -1
- data/{man/bundle-platform.ronn → lib/bundler/man/bundle-platform.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
- data/{man/bundle-pristine.ronn → lib/bundler/man/bundle-pristine.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-remove.1 +1 -1
- data/{man/bundle-remove.ronn → lib/bundler/man/bundle-remove.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-show.1 +1 -1
- data/{man/bundle-show.ronn → lib/bundler/man/bundle-show.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle-update.1 +7 -7
- data/{man/bundle-update.ronn → lib/bundler/man/bundle-update.1.ronn} +6 -6
- data/{man → lib/bundler/man}/bundle-viz.1 +1 -1
- data/{man/bundle-viz.ronn → lib/bundler/man/bundle-viz.1.ronn} +0 -0
- data/{man → lib/bundler/man}/bundle.1 +7 -3
- data/{man/bundle.ronn → lib/bundler/man/bundle.1.ronn} +5 -2
- data/{man → lib/bundler/man}/gemfile.5 +44 -21
- data/{man → lib/bundler/man}/gemfile.5.ronn +24 -20
- data/{man → lib/bundler/man}/index.txt +1 -1
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +5 -5
- data/lib/bundler/plugin/api/source.rb +27 -7
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/dsl.rb +1 -1
- data/lib/bundler/plugin/index.rb +27 -4
- data/lib/bundler/plugin/installer/rubygems.rb +1 -1
- data/lib/bundler/plugin/installer.rb +35 -22
- data/lib/bundler/plugin/source_list.rb +5 -1
- data/lib/bundler/plugin.rb +100 -42
- data/lib/bundler/psyched_yaml.rb +0 -15
- data/lib/bundler/remote_specification.rb +5 -4
- data/lib/bundler/resolver/spec_group.rb +57 -53
- data/lib/bundler/resolver.rb +127 -113
- data/lib/bundler/retry.rb +4 -4
- data/lib/bundler/ruby_version.rb +5 -20
- data/lib/bundler/rubygems_ext.rb +103 -79
- data/lib/bundler/rubygems_gem_installer.rb +69 -8
- data/lib/bundler/rubygems_integration.rb +181 -446
- data/lib/bundler/runtime.rb +24 -34
- data/lib/bundler/settings.rb +159 -110
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +56 -90
- data/lib/bundler/similarity_detector.rb +3 -3
- data/lib/bundler/source/git/git_proxy.rb +106 -105
- data/lib/bundler/source/git.rb +66 -39
- data/lib/bundler/source/metadata.rb +9 -9
- data/lib/bundler/source/path/installer.rb +10 -10
- data/lib/bundler/source/path.rb +23 -12
- data/lib/bundler/source/rubygems/remote.rb +3 -4
- data/lib/bundler/source/rubygems.rb +136 -120
- data/lib/bundler/source/rubygems_aggregate.rb +68 -0
- data/lib/bundler/source.rb +27 -6
- data/lib/bundler/source_list.rb +101 -66
- data/lib/bundler/source_map.rb +58 -0
- data/lib/bundler/spec_set.rb +49 -53
- data/lib/bundler/stub_specification.rb +40 -34
- data/lib/bundler/templates/Executable.bundler +24 -15
- data/lib/bundler/templates/Gemfile +1 -1
- data/lib/bundler/templates/gems.rb +1 -1
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +57 -47
- data/lib/bundler/templates/newgem/Gemfile.tt +19 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -5
- data/lib/bundler/templates/newgem/Rakefile.tt +23 -5
- data/lib/bundler/templates/newgem/bin/console.tt +1 -0
- 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/github/workflows/main.yml.tt +27 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +2 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +4 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +29 -40
- data/lib/bundler/templates/newgem/rubocop.yml.tt +13 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -1
- data/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/lib/bundler/templates/newgem/test/{newgem_test.rb.tt → minitest/newgem_test.rb.tt} +2 -0
- 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 +0 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +7 -11
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/uri_credentials_filter.rb +10 -4
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +174 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +126 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +3 -3
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +39 -11
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +38 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +53 -51
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +5 -6
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- 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/net-http-persistent/lib/net/http/persistent.rb +302 -462
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +20 -9
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +28 -13
- data/lib/bundler/vendor/thor/lib/thor/base.rb +63 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +7 -3
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +21 -5
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +65 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +10 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +16 -9
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +154 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -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/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -12
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_tmpdir.rb +4 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- data/lib/bundler/worker.rb +21 -8
- data/lib/bundler/yaml_serializer.rb +3 -4
- data/lib/bundler.rb +248 -118
- metadata +115 -190
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +0 -26
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-add.1.txt +0 -52
- data/man/bundle-binstubs.1.txt +0 -48
- data/man/bundle-check.1.txt +0 -33
- data/man/bundle-clean.1.txt +0 -26
- data/man/bundle-config.1.txt +0 -529
- data/man/bundle-doctor.1.txt +0 -44
- data/man/bundle-exec.1.txt +0 -178
- data/man/bundle-gem.1.txt +0 -91
- data/man/bundle-info.1.txt +0 -21
- data/man/bundle-init.1.txt +0 -34
- data/man/bundle-inject.1.txt +0 -32
- data/man/bundle-install.1.txt +0 -396
- data/man/bundle-list.1.txt +0 -43
- data/man/bundle-lock.1.txt +0 -93
- data/man/bundle-open.1.txt +0 -29
- data/man/bundle-outdated.1.txt +0 -131
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
- data/man/bundle-platform.1.txt +0 -57
- data/man/bundle-pristine.1.txt +0 -44
- data/man/bundle-remove.1.txt +0 -34
- data/man/bundle-show.1.txt +0 -27
- data/man/bundle-update.1.txt +0 -391
- data/man/bundle-viz.1.txt +0 -39
- data/man/bundle.1.txt +0 -113
- data/man/gemfile.5.txt +0 -653
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Yehuda Katz, Eric Hodel, et al.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "create_file"
|
2
2
|
|
3
3
|
class Bundler::Thor
|
4
4
|
module Actions
|
@@ -33,7 +33,8 @@ class Bundler::Thor
|
|
33
33
|
# Boolean:: true if it is identical, false otherwise.
|
34
34
|
#
|
35
35
|
def identical?
|
36
|
-
|
36
|
+
source = File.expand_path(render, File.dirname(destination))
|
37
|
+
exists? && File.identical?(source, destination)
|
37
38
|
end
|
38
39
|
|
39
40
|
def invoke!
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "empty_directory"
|
2
2
|
|
3
3
|
class Bundler::Thor
|
4
4
|
module Actions
|
@@ -56,7 +56,7 @@ class Bundler::Thor
|
|
56
56
|
attr_reader :source
|
57
57
|
|
58
58
|
def initialize(base, source, destination = nil, config = {}, &block)
|
59
|
-
@source = File.expand_path(base.find_in_source_paths(source.to_s))
|
59
|
+
@source = File.expand_path(Dir[Util.escape_globs(base.find_in_source_paths(source.to_s))].first)
|
60
60
|
@block = block
|
61
61
|
super(base, destination, {:recursive => true}.merge(config))
|
62
62
|
end
|
@@ -96,22 +96,12 @@ class Bundler::Thor
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
def files(lookup)
|
105
|
-
Dir[lookup]
|
106
|
-
end
|
107
|
-
else
|
108
|
-
def file_level_lookup(previous_lookup)
|
109
|
-
File.join(previous_lookup, "*")
|
110
|
-
end
|
99
|
+
def file_level_lookup(previous_lookup)
|
100
|
+
File.join(previous_lookup, "*")
|
101
|
+
end
|
111
102
|
|
112
|
-
|
113
|
-
|
114
|
-
end
|
103
|
+
def files(lookup)
|
104
|
+
Dir.glob(lookup, File::FNM_DOTMATCH)
|
115
105
|
end
|
116
106
|
end
|
117
107
|
end
|
@@ -23,14 +23,14 @@ class Bundler::Thor
|
|
23
23
|
destination = args.first || source
|
24
24
|
source = File.expand_path(find_in_source_paths(source.to_s))
|
25
25
|
|
26
|
-
create_file destination, nil, config do
|
26
|
+
resulting_destination = create_file destination, nil, config do
|
27
27
|
content = File.binread(source)
|
28
28
|
content = yield(content) if block
|
29
29
|
content
|
30
30
|
end
|
31
31
|
if config[:mode] == :preserve
|
32
32
|
mode = File.stat(source).mode
|
33
|
-
chmod(
|
33
|
+
chmod(resulting_destination, mode, config)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -60,6 +60,9 @@ class Bundler::Thor
|
|
60
60
|
# destination. If a block is given instead of destination, the content of
|
61
61
|
# the url is yielded and used as location.
|
62
62
|
#
|
63
|
+
# +get+ relies on open-uri, so passing application user input would provide
|
64
|
+
# a command injection attack vector.
|
65
|
+
#
|
63
66
|
# ==== Parameters
|
64
67
|
# source<String>:: the address of the given content.
|
65
68
|
# destination<String>:: the relative path to the destination root.
|
@@ -77,14 +80,14 @@ class Bundler::Thor
|
|
77
80
|
config = args.last.is_a?(Hash) ? args.pop : {}
|
78
81
|
destination = args.first
|
79
82
|
|
80
|
-
if source =~ %r{^https?\://}
|
83
|
+
render = if source =~ %r{^https?\://}
|
81
84
|
require "open-uri"
|
85
|
+
URI.send(:open, source) { |input| input.binmode.read }
|
82
86
|
else
|
83
87
|
source = File.expand_path(find_in_source_paths(source.to_s))
|
88
|
+
open(source) { |input| input.binmode.read }
|
84
89
|
end
|
85
90
|
|
86
|
-
render = open(source) { |input| input.binmode.read }
|
87
|
-
|
88
91
|
destination ||= if block_given?
|
89
92
|
block.arity == 1 ? yield(render) : yield
|
90
93
|
else
|
@@ -117,7 +120,13 @@ class Bundler::Thor
|
|
117
120
|
context = config.delete(:context) || instance_eval("binding")
|
118
121
|
|
119
122
|
create_file destination, nil, config do
|
120
|
-
|
123
|
+
match = ERB.version.match(/(\d+\.\d+\.\d+)/)
|
124
|
+
capturable_erb = if match && match[1] >= "2.2.0" # Ruby 2.6+
|
125
|
+
CapturableERB.new(::File.binread(source), :trim_mode => "-", :eoutvar => "@output_buffer")
|
126
|
+
else
|
127
|
+
CapturableERB.new(::File.binread(source), nil, "-", "@output_buffer")
|
128
|
+
end
|
129
|
+
content = capturable_erb.tap do |erb|
|
121
130
|
erb.filename = source
|
122
131
|
end.result(context)
|
123
132
|
content = yield(content) if block
|
@@ -242,7 +251,8 @@ class Bundler::Thor
|
|
242
251
|
# path<String>:: path of the file to be changed
|
243
252
|
# flag<Regexp|String>:: the regexp or string to be replaced
|
244
253
|
# replacement<String>:: the replacement, can be also given as a block
|
245
|
-
# config<Hash>:: give :verbose => false to not log the status
|
254
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
255
|
+
# :force => true, to force the replacement regardless of runner behavior.
|
246
256
|
#
|
247
257
|
# ==== Example
|
248
258
|
#
|
@@ -253,9 +263,10 @@ class Bundler::Thor
|
|
253
263
|
# end
|
254
264
|
#
|
255
265
|
def gsub_file(path, flag, *args, &block)
|
256
|
-
return unless behavior == :invoke
|
257
266
|
config = args.last.is_a?(Hash) ? args.pop : {}
|
258
267
|
|
268
|
+
return unless behavior == :invoke || config.fetch(:force, false)
|
269
|
+
|
259
270
|
path = File.expand_path(path, destination_root)
|
260
271
|
say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true)
|
261
272
|
|
@@ -301,7 +312,7 @@ class Bundler::Thor
|
|
301
312
|
def comment_lines(path, flag, *args)
|
302
313
|
flag = flag.respond_to?(:source) ? flag.source : flag
|
303
314
|
|
304
|
-
gsub_file(path, /^(\s*)([
|
315
|
+
gsub_file(path, /^(\s*)([^#\n]*#{flag})/, '\1# \2', *args)
|
305
316
|
end
|
306
317
|
|
307
318
|
# Removes a file at the given location.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "empty_directory"
|
2
2
|
|
3
3
|
class Bundler::Thor
|
4
4
|
module Actions
|
@@ -21,9 +21,14 @@ class Bundler::Thor
|
|
21
21
|
# gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
|
22
22
|
# end
|
23
23
|
#
|
24
|
+
WARNINGS = { unchanged_no_flag: 'File unchanged! The supplied flag value not found!' }
|
25
|
+
|
24
26
|
def insert_into_file(destination, *args, &block)
|
25
27
|
data = block_given? ? block : args.shift
|
26
|
-
|
28
|
+
|
29
|
+
config = args.shift || {}
|
30
|
+
config[:after] = /\z/ unless config.key?(:before) || config.key?(:after)
|
31
|
+
|
27
32
|
action InjectIntoFile.new(self, destination, data, config)
|
28
33
|
end
|
29
34
|
alias_method :inject_into_file, :insert_into_file
|
@@ -45,8 +50,6 @@ class Bundler::Thor
|
|
45
50
|
end
|
46
51
|
|
47
52
|
def invoke!
|
48
|
-
say_status :invoke
|
49
|
-
|
50
53
|
content = if @behavior == :after
|
51
54
|
'\0' + replacement
|
52
55
|
else
|
@@ -54,7 +57,11 @@ class Bundler::Thor
|
|
54
57
|
end
|
55
58
|
|
56
59
|
if exists?
|
57
|
-
replace!(/#{flag}/, content, config[:force])
|
60
|
+
if replace!(/#{flag}/, content, config[:force])
|
61
|
+
say_status(:invoke)
|
62
|
+
else
|
63
|
+
say_status(:unchanged, warning: WARNINGS[:unchanged_no_flag], color: :red)
|
64
|
+
end
|
58
65
|
else
|
59
66
|
unless pretend?
|
60
67
|
raise Bundler::Thor::Error, "The file #{ destination } does not appear to exist"
|
@@ -78,7 +85,7 @@ class Bundler::Thor
|
|
78
85
|
|
79
86
|
protected
|
80
87
|
|
81
|
-
def say_status(behavior)
|
88
|
+
def say_status(behavior, warning: nil, color: nil)
|
82
89
|
status = if behavior == :invoke
|
83
90
|
if flag == /\A/
|
84
91
|
:prepend
|
@@ -87,11 +94,13 @@ class Bundler::Thor
|
|
87
94
|
else
|
88
95
|
:insert
|
89
96
|
end
|
97
|
+
elsif warning
|
98
|
+
warning
|
90
99
|
else
|
91
100
|
:subtract
|
92
101
|
end
|
93
102
|
|
94
|
-
super(status, config[:verbose])
|
103
|
+
super(status, (color || config[:verbose]))
|
95
104
|
end
|
96
105
|
|
97
106
|
# Adds the content to the file.
|
@@ -100,8 +109,10 @@ class Bundler::Thor
|
|
100
109
|
return if pretend?
|
101
110
|
content = File.read(destination)
|
102
111
|
if force || !content.include?(replacement)
|
103
|
-
content.gsub!(regexp, string)
|
112
|
+
success = content.gsub!(regexp, string)
|
113
|
+
|
104
114
|
File.open(destination, "wb") { |file| file.write(content) }
|
115
|
+
success
|
105
116
|
end
|
106
117
|
end
|
107
118
|
end
|
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require "bundler/vendor/thor/lib/thor/actions/file_manipulation"
|
8
|
-
require "bundler/vendor/thor/lib/thor/actions/inject_into_file"
|
1
|
+
require_relative "actions/create_file"
|
2
|
+
require_relative "actions/create_link"
|
3
|
+
require_relative "actions/directory"
|
4
|
+
require_relative "actions/empty_directory"
|
5
|
+
require_relative "actions/file_manipulation"
|
6
|
+
require_relative "actions/inject_into_file"
|
9
7
|
|
10
8
|
class Bundler::Thor
|
11
9
|
module Actions
|
12
10
|
attr_accessor :behavior
|
13
11
|
|
14
12
|
def self.included(base) #:nodoc:
|
13
|
+
super(base)
|
15
14
|
base.extend ClassMethods
|
16
15
|
end
|
17
16
|
|
@@ -113,8 +112,10 @@ class Bundler::Thor
|
|
113
112
|
# the script started).
|
114
113
|
#
|
115
114
|
def relative_to_original_destination_root(path, remove_dot = true)
|
116
|
-
|
117
|
-
if path.
|
115
|
+
root = @destination_stack[0]
|
116
|
+
if path.start_with?(root) && [File::SEPARATOR, File::ALT_SEPARATOR, nil, ''].include?(path[root.size..root.size])
|
117
|
+
path = path.dup
|
118
|
+
path[0...root.size] = '.'
|
118
119
|
remove_dot ? (path[2..-1] || "") : path
|
119
120
|
else
|
120
121
|
path
|
@@ -217,7 +218,8 @@ class Bundler::Thor
|
|
217
218
|
shell.padding += 1 if verbose
|
218
219
|
|
219
220
|
contents = if is_uri
|
220
|
-
|
221
|
+
require "open-uri"
|
222
|
+
URI.open(path, "Accept" => "application/x-thor-template", &:read)
|
221
223
|
else
|
222
224
|
open(path, &:read)
|
223
225
|
end
|
@@ -252,9 +254,22 @@ class Bundler::Thor
|
|
252
254
|
|
253
255
|
say_status :run, desc, config.fetch(:verbose, true)
|
254
256
|
|
255
|
-
|
256
|
-
|
257
|
+
return if options[:pretend]
|
258
|
+
|
259
|
+
env_splat = [config[:env]] if config[:env]
|
260
|
+
|
261
|
+
if config[:capture]
|
262
|
+
require "open3"
|
263
|
+
result, status = Open3.capture2e(*env_splat, command.to_s)
|
264
|
+
success = status.success?
|
265
|
+
else
|
266
|
+
result = system(*env_splat, command.to_s)
|
267
|
+
success = result
|
257
268
|
end
|
269
|
+
|
270
|
+
abort if !success && config.fetch(:abort_on_failure, self.class.exit_on_failure?)
|
271
|
+
|
272
|
+
result
|
258
273
|
end
|
259
274
|
|
260
275
|
# Executes a ruby script (taking into account WIN32 platform quirks).
|
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
require_relative "command"
|
2
|
+
require_relative "core_ext/hash_with_indifferent_access"
|
3
|
+
require_relative "error"
|
4
|
+
require_relative "invocation"
|
5
|
+
require_relative "nested_context"
|
6
|
+
require_relative "parser"
|
7
|
+
require_relative "shell"
|
8
|
+
require_relative "line_editor"
|
9
|
+
require_relative "util"
|
10
10
|
|
11
11
|
class Bundler::Thor
|
12
|
-
autoload :Actions, "
|
13
|
-
autoload :RakeCompat, "
|
14
|
-
autoload :Group, "
|
12
|
+
autoload :Actions, File.expand_path("actions", __dir__)
|
13
|
+
autoload :RakeCompat, File.expand_path("rake_compat", __dir__)
|
14
|
+
autoload :Group, File.expand_path("group", __dir__)
|
15
15
|
|
16
16
|
# Shortcuts for help.
|
17
17
|
HELP_MAPPINGS = %w(-h -? --help -D)
|
@@ -22,6 +22,15 @@ class Bundler::Thor
|
|
22
22
|
|
23
23
|
TEMPLATE_EXTNAME = ".tt"
|
24
24
|
|
25
|
+
class << self
|
26
|
+
def deprecation_warning(message) #:nodoc:
|
27
|
+
unless ENV['THOR_SILENCE_DEPRECATION']
|
28
|
+
warn "Deprecation warning: #{message}\n" +
|
29
|
+
'You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
25
34
|
module Base
|
26
35
|
attr_accessor :options, :parent_options, :args
|
27
36
|
|
@@ -89,6 +98,7 @@ class Bundler::Thor
|
|
89
98
|
|
90
99
|
class << self
|
91
100
|
def included(base) #:nodoc:
|
101
|
+
super(base)
|
92
102
|
base.extend ClassMethods
|
93
103
|
base.send :include, Invocation
|
94
104
|
base.send :include, Shell
|
@@ -113,7 +123,7 @@ class Bundler::Thor
|
|
113
123
|
end
|
114
124
|
|
115
125
|
# Whenever a class inherits from Bundler::Thor or Bundler::Thor::Group, we should track the
|
116
|
-
# class and the file on Bundler::Thor::Base. This is the method
|
126
|
+
# class and the file on Bundler::Thor::Base. This is the method responsible for it.
|
117
127
|
#
|
118
128
|
def register_klass_file(klass) #:nodoc:
|
119
129
|
file = caller[1].match(/(.*):\d+/)[1]
|
@@ -153,17 +163,20 @@ class Bundler::Thor
|
|
153
163
|
|
154
164
|
# If you want to raise an error when the default value of an option does not match
|
155
165
|
# the type call check_default_type!
|
156
|
-
# This
|
166
|
+
# This will be the default; for compatibility a deprecation warning is issued if necessary.
|
157
167
|
def check_default_type!
|
158
168
|
@check_default_type = true
|
159
169
|
end
|
160
170
|
|
161
|
-
|
162
|
-
|
171
|
+
# If you want to use defaults that don't match the type of an option,
|
172
|
+
# either specify `check_default_type: false` or call `allow_incompatible_default_type!`
|
173
|
+
def allow_incompatible_default_type!
|
174
|
+
@check_default_type = false
|
163
175
|
end
|
164
176
|
|
165
|
-
def check_default_type
|
166
|
-
|
177
|
+
def check_default_type #:nodoc:
|
178
|
+
@check_default_type = from_superclass(:check_default_type, nil) unless defined?(@check_default_type)
|
179
|
+
@check_default_type
|
167
180
|
end
|
168
181
|
|
169
182
|
# If true, option parsing is suspended as soon as an unknown option or a
|
@@ -353,22 +366,22 @@ class Bundler::Thor
|
|
353
366
|
# Returns the commands for this Bundler::Thor class.
|
354
367
|
#
|
355
368
|
# ==== Returns
|
356
|
-
#
|
357
|
-
#
|
369
|
+
# Hash:: An ordered hash with commands names as keys and Bundler::Thor::Command
|
370
|
+
# objects as values.
|
358
371
|
#
|
359
372
|
def commands
|
360
|
-
@commands ||=
|
373
|
+
@commands ||= Hash.new
|
361
374
|
end
|
362
375
|
alias_method :tasks, :commands
|
363
376
|
|
364
377
|
# Returns the commands for this Bundler::Thor class and all subclasses.
|
365
378
|
#
|
366
379
|
# ==== Returns
|
367
|
-
#
|
368
|
-
#
|
380
|
+
# Hash:: An ordered hash with commands names as keys and Bundler::Thor::Command
|
381
|
+
# objects as values.
|
369
382
|
#
|
370
383
|
def all_commands
|
371
|
-
@all_commands ||= from_superclass(:all_commands,
|
384
|
+
@all_commands ||= from_superclass(:all_commands, Hash.new)
|
372
385
|
@all_commands.merge!(commands)
|
373
386
|
end
|
374
387
|
alias_method :all_tasks, :all_commands
|
@@ -415,14 +428,20 @@ class Bundler::Thor
|
|
415
428
|
# remove_command :this_is_not_a_command
|
416
429
|
# end
|
417
430
|
#
|
418
|
-
def no_commands
|
419
|
-
|
420
|
-
yield
|
421
|
-
ensure
|
422
|
-
@no_commands = false
|
431
|
+
def no_commands(&block)
|
432
|
+
no_commands_context.enter(&block)
|
423
433
|
end
|
434
|
+
|
424
435
|
alias_method :no_tasks, :no_commands
|
425
436
|
|
437
|
+
def no_commands_context
|
438
|
+
@no_commands_context ||= NestedContext.new
|
439
|
+
end
|
440
|
+
|
441
|
+
def no_commands?
|
442
|
+
no_commands_context.entered?
|
443
|
+
end
|
444
|
+
|
426
445
|
# Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the
|
427
446
|
# namespace is retrieved from the class name. If your Bundler::Thor class is named
|
428
447
|
# Scripts::MyScript, the help method, for example, will be called as:
|
@@ -466,13 +485,13 @@ class Bundler::Thor
|
|
466
485
|
dispatch(nil, given_args.dup, nil, config)
|
467
486
|
rescue Bundler::Thor::Error => e
|
468
487
|
config[:debug] || ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message)
|
469
|
-
exit(
|
488
|
+
exit(false) if exit_on_failure?
|
470
489
|
rescue Errno::EPIPE
|
471
490
|
# This happens if a thor command is piped to something like `head`,
|
472
491
|
# which closes the pipe when it's done reading. This will also
|
473
492
|
# mean that if the pipe is closed, further unnecessary
|
474
493
|
# computation will not occur.
|
475
|
-
exit(
|
494
|
+
exit(true)
|
476
495
|
end
|
477
496
|
|
478
497
|
# Allows to use private methods from parent in child classes as commands.
|
@@ -493,8 +512,7 @@ class Bundler::Thor
|
|
493
512
|
alias_method :public_task, :public_command
|
494
513
|
|
495
514
|
def handle_no_command_error(command, has_namespace = $thor_runner) #:nodoc:
|
496
|
-
raise UndefinedCommandError,
|
497
|
-
raise UndefinedCommandError, "Could not find command #{command.inspect}."
|
515
|
+
raise UndefinedCommandError.new(command, all_commands.keys, (namespace if has_namespace))
|
498
516
|
end
|
499
517
|
alias_method :handle_no_task_error, :handle_no_command_error
|
500
518
|
|
@@ -503,10 +521,16 @@ class Bundler::Thor
|
|
503
521
|
msg = "ERROR: \"#{basename} #{name}\" was called with ".dup
|
504
522
|
msg << "no arguments" if args.empty?
|
505
523
|
msg << "arguments " << args.inspect unless args.empty?
|
506
|
-
msg << "\nUsage: #{banner(command).
|
524
|
+
msg << "\nUsage: \"#{banner(command).split("\n").join("\"\n \"")}\""
|
507
525
|
raise InvocationError, msg
|
508
526
|
end
|
509
527
|
|
528
|
+
# A flag that makes the process exit with status 1 if any error happens.
|
529
|
+
def exit_on_failure?
|
530
|
+
Bundler::Thor.deprecation_warning "Bundler::Thor exit with status 0 on errors. To keep this behavior, you must define `exit_on_failure?` in `#{self.name}`"
|
531
|
+
false
|
532
|
+
end
|
533
|
+
|
510
534
|
protected
|
511
535
|
|
512
536
|
# Prints the class options per group. If an option does not belong to
|
@@ -564,7 +588,7 @@ class Bundler::Thor
|
|
564
588
|
# options<Hash>:: Described in both class_option and method_option.
|
565
589
|
# scope<Hash>:: Options hash that is being built up
|
566
590
|
def build_option(name, options, scope) #:nodoc:
|
567
|
-
scope[name] = Bundler::Thor::Option.new(name,
|
591
|
+
scope[name] = Bundler::Thor::Option.new(name, {:check_default_type => check_default_type}.merge!(options))
|
568
592
|
end
|
569
593
|
|
570
594
|
# Receives a hash of options, parse them and add to the scope. This is a
|
@@ -597,13 +621,15 @@ class Bundler::Thor
|
|
597
621
|
# Everytime someone inherits from a Bundler::Thor class, register the klass
|
598
622
|
# and file into baseclass.
|
599
623
|
def inherited(klass)
|
624
|
+
super(klass)
|
600
625
|
Bundler::Thor::Base.register_klass_file(klass)
|
601
|
-
klass.instance_variable_set(:@no_commands,
|
626
|
+
klass.instance_variable_set(:@no_commands, 0)
|
602
627
|
end
|
603
628
|
|
604
629
|
# Fire this callback whenever a method is added. Added methods are
|
605
630
|
# tracked as commands by invoking the create_command method.
|
606
631
|
def method_added(meth)
|
632
|
+
super(meth)
|
607
633
|
meth = meth.to_s
|
608
634
|
|
609
635
|
if meth == "initialize"
|
@@ -614,8 +640,7 @@ class Bundler::Thor
|
|
614
640
|
# Return if it's not a public instance method
|
615
641
|
return unless public_method_defined?(meth.to_sym)
|
616
642
|
|
617
|
-
|
618
|
-
return if @no_commands || !create_command(meth)
|
643
|
+
return if no_commands? || !create_command(meth)
|
619
644
|
|
620
645
|
is_thor_reserved_word?(meth, :command)
|
621
646
|
Bundler::Thor::Base.register_klass_file(self)
|
@@ -642,11 +667,6 @@ class Bundler::Thor
|
|
642
667
|
end
|
643
668
|
end
|
644
669
|
|
645
|
-
# A flag that makes the process exit with status 1 if any error happens.
|
646
|
-
def exit_on_failure?
|
647
|
-
false
|
648
|
-
end
|
649
|
-
|
650
670
|
#
|
651
671
|
# The basename of the program invoking the thor class.
|
652
672
|
#
|
@@ -49,24 +49,32 @@ class Bundler::Thor
|
|
49
49
|
|
50
50
|
formatted ||= "".dup
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
usage.to_s.gsub(/^#{name}/) do |match|
|
55
|
-
match << " " << klass.arguments.map(&:usage).compact.join(" ")
|
56
|
-
end
|
57
|
-
else
|
58
|
-
usage.to_s
|
59
|
-
end
|
52
|
+
Array(usage).map do |specific_usage|
|
53
|
+
formatted_specific_usage = formatted
|
60
54
|
|
61
|
-
|
62
|
-
formatted << " #{required_options}"
|
55
|
+
formatted_specific_usage += required_arguments_for(klass, specific_usage)
|
63
56
|
|
64
|
-
|
65
|
-
|
57
|
+
# Add required options
|
58
|
+
formatted_specific_usage += " #{required_options}"
|
59
|
+
|
60
|
+
# Strip and go!
|
61
|
+
formatted_specific_usage.strip
|
62
|
+
end.join("\n")
|
66
63
|
end
|
67
64
|
|
68
65
|
protected
|
69
66
|
|
67
|
+
# Add usage with required arguments
|
68
|
+
def required_arguments_for(klass, usage)
|
69
|
+
if klass && !klass.arguments.empty?
|
70
|
+
usage.to_s.gsub(/^#{name}/) do |match|
|
71
|
+
match << " " << klass.arguments.map(&:usage).compact.join(" ")
|
72
|
+
end
|
73
|
+
else
|
74
|
+
usage.to_s
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
70
78
|
def not_debugging?(instance)
|
71
79
|
!(instance.class.respond_to?(:debugging) && instance.class.debugging)
|
72
80
|
end
|
@@ -97,8 +105,7 @@ class Bundler::Thor
|
|
97
105
|
def handle_argument_error?(instance, error, caller)
|
98
106
|
not_debugging?(instance) && (error.message =~ /wrong number of arguments/ || error.message =~ /given \d*, expected \d*/) && begin
|
99
107
|
saned = sans_backtrace(error.backtrace, caller)
|
100
|
-
|
101
|
-
saned.empty? || (saned.size == 1 && RUBY_VERSION >= "1.9")
|
108
|
+
saned.empty? || saned.size == 1
|
102
109
|
end
|
103
110
|
end
|
104
111
|
|