bundler-clone 4.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5670 -0
- data/LICENSE.md +22 -0
- data/README.md +58 -0
- data/bundler.gemspec +46 -0
- data/exe/bundle +29 -0
- data/exe/bundler +4 -0
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +44 -0
- data/lib/bundler/capistrano.rb +4 -0
- data/lib/bundler/checksum.rb +270 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +62 -0
- data/lib/bundler/cli/binstubs.rb +57 -0
- data/lib/bundler/cli/cache.rb +32 -0
- data/lib/bundler/cli/check.rb +40 -0
- data/lib/bundler/cli/clean.rb +25 -0
- data/lib/bundler/cli/common.rb +161 -0
- data/lib/bundler/cli/config.rb +208 -0
- data/lib/bundler/cli/console.rb +47 -0
- data/lib/bundler/cli/doctor/diagnose.rb +167 -0
- data/lib/bundler/cli/doctor/ssl.rb +249 -0
- data/lib/bundler/cli/doctor.rb +33 -0
- data/lib/bundler/cli/exec.rb +114 -0
- data/lib/bundler/cli/fund.rb +36 -0
- data/lib/bundler/cli/gem.rb +493 -0
- data/lib/bundler/cli/info.rb +83 -0
- data/lib/bundler/cli/init.rb +51 -0
- data/lib/bundler/cli/install.rb +127 -0
- data/lib/bundler/cli/issue.rb +41 -0
- data/lib/bundler/cli/list.rb +97 -0
- data/lib/bundler/cli/lock.rb +94 -0
- data/lib/bundler/cli/open.rb +29 -0
- data/lib/bundler/cli/outdated.rb +337 -0
- data/lib/bundler/cli/platform.rb +48 -0
- data/lib/bundler/cli/plugin.rb +39 -0
- data/lib/bundler/cli/pristine.rb +64 -0
- data/lib/bundler/cli/remove.rb +17 -0
- data/lib/bundler/cli/show.rb +71 -0
- data/lib/bundler/cli/update.rb +125 -0
- data/lib/bundler/cli.rb +829 -0
- data/lib/bundler/compact_index_client/cache.rb +96 -0
- data/lib/bundler/compact_index_client/cache_file.rb +148 -0
- data/lib/bundler/compact_index_client/parser.rb +87 -0
- data/lib/bundler/compact_index_client/updater.rb +105 -0
- data/lib/bundler/compact_index_client.rb +92 -0
- data/lib/bundler/constants.rb +14 -0
- data/lib/bundler/current_ruby.rb +94 -0
- data/lib/bundler/definition.rb +1304 -0
- data/lib/bundler/dependency.rb +151 -0
- data/lib/bundler/deployment.rb +6 -0
- data/lib/bundler/deprecate.rb +44 -0
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +642 -0
- data/lib/bundler/endpoint_specification.rb +184 -0
- data/lib/bundler/env.rb +148 -0
- data/lib/bundler/environment_preserver.rb +69 -0
- data/lib/bundler/errors.rb +277 -0
- data/lib/bundler/feature_flag.rb +20 -0
- data/lib/bundler/fetcher/base.rb +55 -0
- data/lib/bundler/fetcher/compact_index.rb +133 -0
- data/lib/bundler/fetcher/dependency.rb +85 -0
- data/lib/bundler/fetcher/downloader.rb +116 -0
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +24 -0
- data/lib/bundler/fetcher/index.rb +25 -0
- data/lib/bundler/fetcher.rb +365 -0
- data/lib/bundler/force_platform.rb +16 -0
- data/lib/bundler/friendly_errors.rb +127 -0
- data/lib/bundler/gem_helper.rb +237 -0
- data/lib/bundler/gem_tasks.rb +7 -0
- data/lib/bundler/gem_version_promoter.rb +147 -0
- data/lib/bundler/index.rb +203 -0
- data/lib/bundler/injector.rb +284 -0
- data/lib/bundler/inline.rb +106 -0
- data/lib/bundler/installer/gem_installer.rb +88 -0
- data/lib/bundler/installer/parallel_installer.rb +280 -0
- data/lib/bundler/installer/standalone.rb +113 -0
- data/lib/bundler/installer.rb +241 -0
- data/lib/bundler/lazy_specification.rb +270 -0
- data/lib/bundler/lockfile_generator.rb +119 -0
- data/lib/bundler/lockfile_parser.rb +328 -0
- data/lib/bundler/man/.document +1 -0
- data/lib/bundler/man/bundle-add.1 +79 -0
- data/lib/bundler/man/bundle-add.1.ronn +92 -0
- data/lib/bundler/man/bundle-binstubs.1 +30 -0
- data/lib/bundler/man/bundle-binstubs.1.ronn +42 -0
- data/lib/bundler/man/bundle-cache.1 +56 -0
- data/lib/bundler/man/bundle-cache.1.ronn +95 -0
- data/lib/bundler/man/bundle-check.1 +21 -0
- data/lib/bundler/man/bundle-check.1.ronn +26 -0
- data/lib/bundler/man/bundle-clean.1 +17 -0
- data/lib/bundler/man/bundle-clean.1.ronn +18 -0
- data/lib/bundler/man/bundle-config.1 +339 -0
- data/lib/bundler/man/bundle-config.1.ronn +455 -0
- data/lib/bundler/man/bundle-console.1 +33 -0
- data/lib/bundler/man/bundle-console.1.ronn +39 -0
- data/lib/bundler/man/bundle-doctor.1 +69 -0
- data/lib/bundler/man/bundle-doctor.1.ronn +77 -0
- data/lib/bundler/man/bundle-env.1 +9 -0
- data/lib/bundler/man/bundle-env.1.ronn +10 -0
- data/lib/bundler/man/bundle-exec.1 +104 -0
- data/lib/bundler/man/bundle-exec.1.ronn +150 -0
- data/lib/bundler/man/bundle-fund.1 +22 -0
- data/lib/bundler/man/bundle-fund.1.ronn +25 -0
- data/lib/bundler/man/bundle-gem.1 +107 -0
- data/lib/bundler/man/bundle-gem.1.ronn +150 -0
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +17 -0
- data/lib/bundler/man/bundle-info.1.ronn +21 -0
- data/lib/bundler/man/bundle-init.1 +20 -0
- data/lib/bundler/man/bundle-init.1.ronn +32 -0
- data/lib/bundler/man/bundle-install.1 +178 -0
- data/lib/bundler/man/bundle-install.1.ronn +314 -0
- data/lib/bundler/man/bundle-issue.1 +45 -0
- data/lib/bundler/man/bundle-issue.1.ronn +37 -0
- data/lib/bundler/man/bundle-licenses.1 +9 -0
- data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
- data/lib/bundler/man/bundle-list.1 +40 -0
- data/lib/bundler/man/bundle-list.1.ronn +41 -0
- data/lib/bundler/man/bundle-lock.1 +75 -0
- data/lib/bundler/man/bundle-lock.1.ronn +115 -0
- data/lib/bundler/man/bundle-open.1 +32 -0
- data/lib/bundler/man/bundle-open.1.ronn +28 -0
- data/lib/bundler/man/bundle-outdated.1 +106 -0
- data/lib/bundler/man/bundle-outdated.1.ronn +117 -0
- data/lib/bundler/man/bundle-platform.1 +49 -0
- data/lib/bundler/man/bundle-platform.1.ronn +49 -0
- data/lib/bundler/man/bundle-plugin.1 +76 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/bundle-pristine.1 +23 -0
- data/lib/bundler/man/bundle-pristine.1.ronn +34 -0
- data/lib/bundler/man/bundle-remove.1 +15 -0
- data/lib/bundler/man/bundle-remove.1.ronn +16 -0
- data/lib/bundler/man/bundle-show.1 +16 -0
- data/lib/bundler/man/bundle-show.1.ronn +21 -0
- data/lib/bundler/man/bundle-update.1 +284 -0
- data/lib/bundler/man/bundle-update.1.ronn +367 -0
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle.1 +93 -0
- data/lib/bundler/man/bundle.1.ronn +107 -0
- data/lib/bundler/man/gemfile.5 +503 -0
- data/lib/bundler/man/gemfile.5.ronn +586 -0
- data/lib/bundler/man/index.txt +31 -0
- data/lib/bundler/match_metadata.rb +30 -0
- data/lib/bundler/match_platform.rb +42 -0
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/materialization.rb +59 -0
- data/lib/bundler/mirror.rb +221 -0
- data/lib/bundler/plugin/api/source.rb +330 -0
- data/lib/bundler/plugin/api.rb +81 -0
- data/lib/bundler/plugin/dsl.rb +53 -0
- data/lib/bundler/plugin/events.rb +85 -0
- data/lib/bundler/plugin/index.rb +203 -0
- data/lib/bundler/plugin/installer/git.rb +34 -0
- data/lib/bundler/plugin/installer/path.rb +26 -0
- data/lib/bundler/plugin/installer/rubygems.rb +19 -0
- data/lib/bundler/plugin/installer.rb +123 -0
- data/lib/bundler/plugin/source_list.rb +31 -0
- data/lib/bundler/plugin/unloaded_source.rb +25 -0
- data/lib/bundler/plugin.rb +387 -0
- data/lib/bundler/process_lock.rb +20 -0
- data/lib/bundler/remote_specification.rb +126 -0
- data/lib/bundler/resolver/base.rb +127 -0
- data/lib/bundler/resolver/candidate.rb +85 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +95 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +74 -0
- data/lib/bundler/resolver/strategy.rb +43 -0
- data/lib/bundler/resolver.rb +603 -0
- data/lib/bundler/retry.rb +92 -0
- data/lib/bundler/ruby_dsl.rb +67 -0
- data/lib/bundler/ruby_version.rb +135 -0
- data/lib/bundler/rubygems_ext.rb +503 -0
- data/lib/bundler/rubygems_gem_installer.rb +206 -0
- data/lib/bundler/rubygems_integration.rb +456 -0
- data/lib/bundler/runtime.rb +331 -0
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +197 -0
- data/lib/bundler/settings/validator.rb +86 -0
- data/lib/bundler/settings.rb +585 -0
- data/lib/bundler/setup.rb +39 -0
- data/lib/bundler/shared_helpers.rb +392 -0
- data/lib/bundler/source/gemspec.rb +19 -0
- data/lib/bundler/source/git/git_proxy.rb +509 -0
- data/lib/bundler/source/git.rb +451 -0
- data/lib/bundler/source/metadata.rb +67 -0
- data/lib/bundler/source/path/installer.rb +53 -0
- data/lib/bundler/source/path.rb +256 -0
- data/lib/bundler/source/rubygems/remote.rb +86 -0
- data/lib/bundler/source/rubygems.rb +606 -0
- data/lib/bundler/source/rubygems_aggregate.rb +71 -0
- data/lib/bundler/source.rb +120 -0
- data/lib/bundler/source_list.rb +240 -0
- data/lib/bundler/source_map.rb +72 -0
- data/lib/bundler/spec_set.rb +390 -0
- data/lib/bundler/stub_specification.rb +147 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +14 -0
- data/lib/bundler/templates/Gemfile +5 -0
- data/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +10 -0
- data/lib/bundler/templates/newgem/Cargo.toml.tt +13 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +24 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +21 -0
- data/lib/bundler/templates/newgem/README.md.tt +49 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +72 -0
- data/lib/bundler/templates/newgem/bin/console.tt +11 -0
- data/lib/bundler/templates/newgem/bin/setup.tt +8 -0
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +37 -0
- data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +22 -0
- data/lib/bundler/templates/newgem/ext/newgem/build.rs.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +23 -0
- data/lib/bundler/templates/newgem/github/workflows/build-gems.yml.tt +69 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +48 -0
- data/lib/bundler/templates/newgem/gitignore.tt +23 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +27 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +15 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +58 -0
- data/lib/bundler/templates/newgem/rspec.tt +3 -0
- data/lib/bundler/templates/newgem/rubocop.yml.tt +8 -0
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +19 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +15 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/test_helper.rb.tt +6 -0
- data/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +19 -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/ui/rg_proxy.rb +19 -0
- data/lib/bundler/ui/shell.rb +191 -0
- data/lib/bundler/ui/silent.rb +96 -0
- data/lib/bundler/ui.rb +9 -0
- data/lib/bundler/uri_credentials_filter.rb +43 -0
- data/lib/bundler/uri_normalizer.rb +23 -0
- 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 +227 -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 +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +230 -0
- data/lib/bundler/vendor/fileutils/COPYING +56 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +2701 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +41 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +65 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +80 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1153 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +169 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/strategy.rb +42 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +423 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +236 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/securerandom/COPYING +56 -0
- data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +61 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +108 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +143 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +407 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +130 -0
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +340 -0
- data/lib/bundler/vendor/thor/lib/thor/base.rb +825 -0
- data/lib/bundler/vendor/thor/lib/thor/command.rb +151 -0
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +107 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +106 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +292 -0
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +37 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +86 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +195 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +178 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +294 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +72 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +335 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +384 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +112 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +118 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/lib/thor/util.rb +285 -0
- data/lib/bundler/vendor/thor/lib/thor/version.rb +3 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +674 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/COPYING +56 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +922 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1592 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +137 -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 +22 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +547 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +206 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendored_fileutils.rb +4 -0
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +11 -0
- data/lib/bundler/vendored_pub_grub.rb +4 -0
- data/lib/bundler/vendored_securerandom.rb +12 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/vendored_uri.rb +21 -0
- data/lib/bundler/version.rb +21 -0
- data/lib/bundler/vlad.rb +4 -0
- data/lib/bundler/worker.rb +125 -0
- data/lib/bundler/yaml_serializer.rb +98 -0
- data/lib/bundler.rb +691 -0
- metadata +409 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bundler::PubGrub
|
|
4
|
+
class VersionUnion
|
|
5
|
+
attr_reader :ranges
|
|
6
|
+
|
|
7
|
+
def self.normalize_ranges(ranges)
|
|
8
|
+
ranges = ranges.flat_map do |range|
|
|
9
|
+
range.ranges
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
ranges.reject!(&:empty?)
|
|
13
|
+
|
|
14
|
+
return [] if ranges.empty?
|
|
15
|
+
|
|
16
|
+
mins, ranges = ranges.partition { |r| !r.min }
|
|
17
|
+
original_ranges = mins + ranges.sort_by { |r| [r.min, r.include_min ? 0 : 1] }
|
|
18
|
+
ranges = [original_ranges.shift]
|
|
19
|
+
original_ranges.each do |range|
|
|
20
|
+
if ranges.last.contiguous_to?(range)
|
|
21
|
+
ranges << ranges.pop.span(range)
|
|
22
|
+
else
|
|
23
|
+
ranges << range
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
ranges
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.union(ranges, normalize: true)
|
|
31
|
+
ranges = normalize_ranges(ranges) if normalize
|
|
32
|
+
|
|
33
|
+
if ranges.size == 0
|
|
34
|
+
VersionRange.empty
|
|
35
|
+
elsif ranges.size == 1
|
|
36
|
+
ranges[0]
|
|
37
|
+
else
|
|
38
|
+
new(ranges)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def initialize(ranges)
|
|
43
|
+
raise ArgumentError unless ranges.all? { |r| r.instance_of?(VersionRange) }
|
|
44
|
+
@ranges = ranges
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def hash
|
|
48
|
+
ranges.hash
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def eql?(other)
|
|
52
|
+
ranges.eql?(other.ranges)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def include?(version)
|
|
56
|
+
!!ranges.bsearch {|r| r.compare_version(version) }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def select_versions(all_versions)
|
|
60
|
+
versions = []
|
|
61
|
+
ranges.inject(all_versions) do |acc, range|
|
|
62
|
+
_, matching, higher = range.partition_versions(acc)
|
|
63
|
+
versions.concat matching
|
|
64
|
+
higher
|
|
65
|
+
end
|
|
66
|
+
versions
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def intersects?(other)
|
|
70
|
+
my_ranges = ranges.dup
|
|
71
|
+
other_ranges = other.ranges.dup
|
|
72
|
+
|
|
73
|
+
my_range = my_ranges.shift
|
|
74
|
+
other_range = other_ranges.shift
|
|
75
|
+
while my_range && other_range
|
|
76
|
+
if my_range.intersects?(other_range)
|
|
77
|
+
return true
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if !my_range.max || other_range.empty? || (other_range.max && other_range.max < my_range.max)
|
|
81
|
+
other_range = other_ranges.shift
|
|
82
|
+
else
|
|
83
|
+
my_range = my_ranges.shift
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
alias_method :allows_any?, :intersects?
|
|
88
|
+
|
|
89
|
+
def allows_all?(other)
|
|
90
|
+
my_ranges = ranges.dup
|
|
91
|
+
|
|
92
|
+
my_range = my_ranges.shift
|
|
93
|
+
|
|
94
|
+
other.ranges.all? do |other_range|
|
|
95
|
+
while my_range
|
|
96
|
+
break if my_range.allows_all?(other_range)
|
|
97
|
+
my_range = my_ranges.shift
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
!!my_range
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def empty?
|
|
105
|
+
false
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def any?
|
|
109
|
+
false
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def intersect(other)
|
|
113
|
+
my_ranges = ranges.dup
|
|
114
|
+
other_ranges = other.ranges.dup
|
|
115
|
+
new_ranges = []
|
|
116
|
+
|
|
117
|
+
my_range = my_ranges.shift
|
|
118
|
+
other_range = other_ranges.shift
|
|
119
|
+
while my_range && other_range
|
|
120
|
+
new_ranges << my_range.intersect(other_range)
|
|
121
|
+
|
|
122
|
+
if !my_range.max || other_range.empty? || (other_range.max && other_range.max < my_range.max)
|
|
123
|
+
other_range = other_ranges.shift
|
|
124
|
+
else
|
|
125
|
+
my_range = my_ranges.shift
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
new_ranges.reject!(&:empty?)
|
|
129
|
+
VersionUnion.union(new_ranges, normalize: false)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def upper_invert
|
|
133
|
+
ranges.last.upper_invert
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def invert
|
|
137
|
+
ranges.map(&:invert).inject(:intersect)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def union(other)
|
|
141
|
+
VersionUnion.union([self, other])
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def to_s
|
|
145
|
+
output = []
|
|
146
|
+
|
|
147
|
+
ranges = self.ranges.dup
|
|
148
|
+
while !ranges.empty?
|
|
149
|
+
ne = []
|
|
150
|
+
range = ranges.shift
|
|
151
|
+
while !ranges.empty? && ranges[0].min.to_s == range.max.to_s
|
|
152
|
+
ne << range.max
|
|
153
|
+
range = range.span(ranges.shift)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
ne.map! {|x| "!= #{x}" }
|
|
157
|
+
if ne.empty?
|
|
158
|
+
output << range.to_s
|
|
159
|
+
elsif range.any?
|
|
160
|
+
output << ne.join(', ')
|
|
161
|
+
else
|
|
162
|
+
output << "#{range}, #{ne.join(', ')}"
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
output.join(" OR ")
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def inspect
|
|
170
|
+
"#<#{self.class} #{to_s}>"
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def ==(other)
|
|
174
|
+
self.class == other.class &&
|
|
175
|
+
self.ranges == other.ranges
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require_relative "pub_grub/package"
|
|
2
|
+
require_relative "pub_grub/static_package_source"
|
|
3
|
+
require_relative "pub_grub/term"
|
|
4
|
+
require_relative "pub_grub/version_range"
|
|
5
|
+
require_relative "pub_grub/version_constraint"
|
|
6
|
+
require_relative "pub_grub/version_union"
|
|
7
|
+
require_relative "pub_grub/version_solver"
|
|
8
|
+
require_relative "pub_grub/incompatibility"
|
|
9
|
+
require_relative 'pub_grub/solve_failure'
|
|
10
|
+
require_relative 'pub_grub/failure_writer'
|
|
11
|
+
require_relative 'pub_grub/version'
|
|
12
|
+
|
|
13
|
+
module Bundler::PubGrub
|
|
14
|
+
class << self
|
|
15
|
+
attr_writer :logger
|
|
16
|
+
|
|
17
|
+
def logger
|
|
18
|
+
@logger || default_logger
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def default_logger
|
|
24
|
+
require "logger"
|
|
25
|
+
|
|
26
|
+
logger = ::Logger.new(STDERR)
|
|
27
|
+
logger.level = $DEBUG ? ::Logger::DEBUG : ::Logger::WARN
|
|
28
|
+
@logger = logger
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# -*- coding: us-ascii -*-
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'random/formatter'
|
|
5
|
+
|
|
6
|
+
# == Secure random number generator interface.
|
|
7
|
+
#
|
|
8
|
+
# This library is an interface to secure random number generators which are
|
|
9
|
+
# suitable for generating session keys in HTTP cookies, etc.
|
|
10
|
+
#
|
|
11
|
+
# You can use this library in your application by requiring it:
|
|
12
|
+
#
|
|
13
|
+
# require 'bundler/vendor/securerandom/lib/securerandom'
|
|
14
|
+
#
|
|
15
|
+
# It supports the following secure random number generators:
|
|
16
|
+
#
|
|
17
|
+
# * openssl
|
|
18
|
+
# * /dev/urandom
|
|
19
|
+
# * Win32
|
|
20
|
+
#
|
|
21
|
+
# Bundler::SecureRandom is extended by the Random::Formatter module which
|
|
22
|
+
# defines the following methods:
|
|
23
|
+
#
|
|
24
|
+
# * alphanumeric
|
|
25
|
+
# * base64
|
|
26
|
+
# * choose
|
|
27
|
+
# * gen_random
|
|
28
|
+
# * hex
|
|
29
|
+
# * rand
|
|
30
|
+
# * random_bytes
|
|
31
|
+
# * random_number
|
|
32
|
+
# * urlsafe_base64
|
|
33
|
+
# * uuid
|
|
34
|
+
#
|
|
35
|
+
# These methods are usable as class methods of Bundler::SecureRandom such as
|
|
36
|
+
# +Bundler::SecureRandom.hex+.
|
|
37
|
+
#
|
|
38
|
+
# If a secure random number generator is not available,
|
|
39
|
+
# +NotImplementedError+ is raised.
|
|
40
|
+
|
|
41
|
+
module Bundler::SecureRandom
|
|
42
|
+
|
|
43
|
+
# The version
|
|
44
|
+
VERSION = "0.4.1"
|
|
45
|
+
|
|
46
|
+
class << self
|
|
47
|
+
# Returns a random binary string containing +size+ bytes.
|
|
48
|
+
#
|
|
49
|
+
# See Random.bytes
|
|
50
|
+
def bytes(n)
|
|
51
|
+
return gen_random(n)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Compatibility methods for Ruby 3.2, we can remove this after dropping to support Ruby 3.2
|
|
55
|
+
def alphanumeric(n = nil, chars: ALPHANUMERIC)
|
|
56
|
+
n = 16 if n.nil?
|
|
57
|
+
choose(chars, n)
|
|
58
|
+
end if RUBY_VERSION < '3.3'
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
# :stopdoc:
|
|
63
|
+
|
|
64
|
+
# Implementation using OpenSSL
|
|
65
|
+
def gen_random_openssl(n)
|
|
66
|
+
return OpenSSL::Random.random_bytes(n)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Implementation using system random device
|
|
70
|
+
def gen_random_urandom(n)
|
|
71
|
+
ret = Random.urandom(n)
|
|
72
|
+
unless ret
|
|
73
|
+
raise NotImplementedError, "No random device"
|
|
74
|
+
end
|
|
75
|
+
unless ret.length == n
|
|
76
|
+
raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
|
|
77
|
+
end
|
|
78
|
+
ret
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
begin
|
|
82
|
+
# Check if Random.urandom is available
|
|
83
|
+
Random.urandom(1)
|
|
84
|
+
alias gen_random gen_random_urandom
|
|
85
|
+
rescue RuntimeError
|
|
86
|
+
begin
|
|
87
|
+
require 'openssl'
|
|
88
|
+
rescue NoMethodError
|
|
89
|
+
raise NotImplementedError, "No random device"
|
|
90
|
+
else
|
|
91
|
+
alias gen_random gen_random_openssl
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# :startdoc:
|
|
96
|
+
|
|
97
|
+
# Generate random data bytes for Random::Formatter
|
|
98
|
+
public :gen_random
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
Bundler::SecureRandom.extend(Random::Formatter)
|
|
@@ -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.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require_relative "empty_directory"
|
|
2
|
+
|
|
3
|
+
class Bundler::Thor
|
|
4
|
+
module Actions
|
|
5
|
+
# Create a new file relative to the destination root with the given data,
|
|
6
|
+
# which is the return value of a block or a data string.
|
|
7
|
+
#
|
|
8
|
+
# ==== Parameters
|
|
9
|
+
# destination<String>:: the relative path to the destination root.
|
|
10
|
+
# data<String|NilClass>:: the data to append to the file.
|
|
11
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
|
12
|
+
#
|
|
13
|
+
# ==== Examples
|
|
14
|
+
#
|
|
15
|
+
# create_file "lib/fun_party.rb" do
|
|
16
|
+
# hostname = ask("What is the virtual hostname I should use?")
|
|
17
|
+
# "vhost.name = #{hostname}"
|
|
18
|
+
# end
|
|
19
|
+
#
|
|
20
|
+
# create_file "config/apache.conf", "your apache config"
|
|
21
|
+
#
|
|
22
|
+
def create_file(destination, *args, &block)
|
|
23
|
+
config = args.last.is_a?(Hash) ? args.pop : {}
|
|
24
|
+
data = args.first
|
|
25
|
+
action CreateFile.new(self, destination, block || data.to_s, config)
|
|
26
|
+
end
|
|
27
|
+
alias_method :add_file, :create_file
|
|
28
|
+
|
|
29
|
+
# CreateFile is a subset of Template, which instead of rendering a file with
|
|
30
|
+
# ERB, it gets the content from the user.
|
|
31
|
+
#
|
|
32
|
+
class CreateFile < EmptyDirectory #:nodoc:
|
|
33
|
+
attr_reader :data
|
|
34
|
+
|
|
35
|
+
def initialize(base, destination, data, config = {})
|
|
36
|
+
@data = data
|
|
37
|
+
super(base, destination, config)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
|
41
|
+
#
|
|
42
|
+
# ==== Returns
|
|
43
|
+
# Boolean:: true if it is identical, false otherwise.
|
|
44
|
+
#
|
|
45
|
+
def identical?
|
|
46
|
+
# binread uses ASCII-8BIT, so to avoid false negatives, the string must use the same
|
|
47
|
+
exists? && File.binread(destination) == String.new(render).force_encoding("ASCII-8BIT")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Holds the content to be added to the file.
|
|
51
|
+
#
|
|
52
|
+
def render
|
|
53
|
+
@render ||= if data.is_a?(Proc)
|
|
54
|
+
data.call
|
|
55
|
+
else
|
|
56
|
+
data
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def invoke!
|
|
61
|
+
invoke_with_conflict_check do
|
|
62
|
+
require "fileutils"
|
|
63
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
|
64
|
+
File.open(destination, "wb", config[:perm]) { |f| f.write render }
|
|
65
|
+
end
|
|
66
|
+
given_destination
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
protected
|
|
70
|
+
|
|
71
|
+
# Now on conflict we check if the file is identical or not.
|
|
72
|
+
#
|
|
73
|
+
def on_conflict_behavior(&block)
|
|
74
|
+
if identical?
|
|
75
|
+
say_status :identical, :blue
|
|
76
|
+
else
|
|
77
|
+
options = base.options.merge(config)
|
|
78
|
+
force_or_skip_or_conflict(options[:force], options[:skip], &block)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# If force is true, run the action, otherwise check if it's not being
|
|
83
|
+
# skipped. If both are false, show the file_collision menu, if the menu
|
|
84
|
+
# returns true, force it, otherwise skip.
|
|
85
|
+
#
|
|
86
|
+
def force_or_skip_or_conflict(force, skip, &block)
|
|
87
|
+
if force
|
|
88
|
+
say_status :force, :yellow
|
|
89
|
+
yield unless pretend?
|
|
90
|
+
elsif skip
|
|
91
|
+
say_status :skip, :yellow
|
|
92
|
+
else
|
|
93
|
+
say_status :conflict, :red
|
|
94
|
+
force_or_skip_or_conflict(force_on_collision?, true, &block)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Shows the file collision menu to the user and gets the result.
|
|
99
|
+
#
|
|
100
|
+
def force_on_collision?
|
|
101
|
+
base.shell.file_collision(destination) { render }
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require_relative "create_file"
|
|
2
|
+
|
|
3
|
+
class Bundler::Thor
|
|
4
|
+
module Actions
|
|
5
|
+
# Create a new file relative to the destination root from the given source.
|
|
6
|
+
#
|
|
7
|
+
# ==== Parameters
|
|
8
|
+
# destination<String>:: the relative path to the destination root.
|
|
9
|
+
# source<String|NilClass>:: the relative path to the source root.
|
|
10
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
|
11
|
+
# :: give :symbolic => false for hard link.
|
|
12
|
+
#
|
|
13
|
+
# ==== Examples
|
|
14
|
+
#
|
|
15
|
+
# create_link "config/apache.conf", "/etc/apache.conf"
|
|
16
|
+
#
|
|
17
|
+
def create_link(destination, *args)
|
|
18
|
+
config = args.last.is_a?(Hash) ? args.pop : {}
|
|
19
|
+
source = args.first
|
|
20
|
+
action CreateLink.new(self, destination, source, config)
|
|
21
|
+
end
|
|
22
|
+
alias_method :add_link, :create_link
|
|
23
|
+
|
|
24
|
+
# CreateLink is a subset of CreateFile, which instead of taking a block of
|
|
25
|
+
# data, just takes a source string from the user.
|
|
26
|
+
#
|
|
27
|
+
class CreateLink < CreateFile #:nodoc:
|
|
28
|
+
attr_reader :data
|
|
29
|
+
|
|
30
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
|
31
|
+
#
|
|
32
|
+
# ==== Returns
|
|
33
|
+
# Boolean:: true if it is identical, false otherwise.
|
|
34
|
+
#
|
|
35
|
+
def identical?
|
|
36
|
+
source = File.expand_path(render, File.dirname(destination))
|
|
37
|
+
exists? && File.identical?(source, destination)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def invoke!
|
|
41
|
+
invoke_with_conflict_check do
|
|
42
|
+
require "fileutils"
|
|
43
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
|
44
|
+
# Create a symlink by default
|
|
45
|
+
config[:symbolic] = true if config[:symbolic].nil?
|
|
46
|
+
File.unlink(destination) if exists?
|
|
47
|
+
if config[:symbolic]
|
|
48
|
+
File.symlink(render, destination)
|
|
49
|
+
else
|
|
50
|
+
File.link(render, destination)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
given_destination
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def exists?
|
|
57
|
+
super || File.symlink?(destination)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
require_relative "empty_directory"
|
|
2
|
+
|
|
3
|
+
class Bundler::Thor
|
|
4
|
+
module Actions
|
|
5
|
+
# Copies recursively the files from source directory to root directory.
|
|
6
|
+
# If any of the files finishes with .tt, it's considered to be a template
|
|
7
|
+
# and is placed in the destination without the extension .tt. If any
|
|
8
|
+
# empty directory is found, it's copied and all .empty_directory files are
|
|
9
|
+
# ignored. If any file name is wrapped within % signs, the text within
|
|
10
|
+
# the % signs will be executed as a method and replaced with the returned
|
|
11
|
+
# value. Let's suppose a doc directory with the following files:
|
|
12
|
+
#
|
|
13
|
+
# doc/
|
|
14
|
+
# components/.empty_directory
|
|
15
|
+
# README
|
|
16
|
+
# rdoc.rb.tt
|
|
17
|
+
# %app_name%.rb
|
|
18
|
+
#
|
|
19
|
+
# When invoked as:
|
|
20
|
+
#
|
|
21
|
+
# directory "doc"
|
|
22
|
+
#
|
|
23
|
+
# It will create a doc directory in the destination with the following
|
|
24
|
+
# files (assuming that the `app_name` method returns the value "blog"):
|
|
25
|
+
#
|
|
26
|
+
# doc/
|
|
27
|
+
# components/
|
|
28
|
+
# README
|
|
29
|
+
# rdoc.rb
|
|
30
|
+
# blog.rb
|
|
31
|
+
#
|
|
32
|
+
# <b>Encoded path note:</b> Since Bundler::Thor internals use Object#respond_to? to check if it can
|
|
33
|
+
# expand %something%, this `something` should be a public method in the class calling
|
|
34
|
+
# #directory. If a method is private, Bundler::Thor stack raises PrivateMethodEncodedError.
|
|
35
|
+
#
|
|
36
|
+
# ==== Parameters
|
|
37
|
+
# source<String>:: the relative path to the source root.
|
|
38
|
+
# destination<String>:: the relative path to the destination root.
|
|
39
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
|
40
|
+
# If :recursive => false, does not look for paths recursively.
|
|
41
|
+
# If :mode => :preserve, preserve the file mode from the source.
|
|
42
|
+
# If :exclude_pattern => /regexp/, prevents copying files that match that regexp.
|
|
43
|
+
#
|
|
44
|
+
# ==== Examples
|
|
45
|
+
#
|
|
46
|
+
# directory "doc"
|
|
47
|
+
# directory "doc", "docs", :recursive => false
|
|
48
|
+
#
|
|
49
|
+
def directory(source, *args, &block)
|
|
50
|
+
config = args.last.is_a?(Hash) ? args.pop : {}
|
|
51
|
+
destination = args.first || source
|
|
52
|
+
action Directory.new(self, source, destination || source, config, &block)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class Directory < EmptyDirectory #:nodoc:
|
|
56
|
+
attr_reader :source
|
|
57
|
+
|
|
58
|
+
def initialize(base, source, destination = nil, config = {}, &block)
|
|
59
|
+
@source = File.expand_path(Dir[Util.escape_globs(base.find_in_source_paths(source.to_s))].first)
|
|
60
|
+
@block = block
|
|
61
|
+
super(base, destination, {recursive: true}.merge(config))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def invoke!
|
|
65
|
+
base.empty_directory given_destination, config
|
|
66
|
+
execute!
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def revoke!
|
|
70
|
+
execute!
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
protected
|
|
74
|
+
|
|
75
|
+
def execute!
|
|
76
|
+
lookup = Util.escape_globs(source)
|
|
77
|
+
lookup = config[:recursive] ? File.join(lookup, "**") : lookup
|
|
78
|
+
lookup = file_level_lookup(lookup)
|
|
79
|
+
|
|
80
|
+
files(lookup).sort.each do |file_source|
|
|
81
|
+
next if File.directory?(file_source)
|
|
82
|
+
next if config[:exclude_pattern] && file_source.match(config[:exclude_pattern])
|
|
83
|
+
file_destination = File.join(given_destination, file_source.gsub(source, "."))
|
|
84
|
+
file_destination.gsub!("/./", "/")
|
|
85
|
+
|
|
86
|
+
case file_source
|
|
87
|
+
when /\.empty_directory$/
|
|
88
|
+
dirname = File.dirname(file_destination).gsub(%r{/\.$}, "")
|
|
89
|
+
next if dirname == given_destination
|
|
90
|
+
base.empty_directory(dirname, config)
|
|
91
|
+
when /#{TEMPLATE_EXTNAME}$/
|
|
92
|
+
base.template(file_source, file_destination[0..-4], config, &@block)
|
|
93
|
+
else
|
|
94
|
+
base.copy_file(file_source, file_destination, config, &@block)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def file_level_lookup(previous_lookup)
|
|
100
|
+
File.join(previous_lookup, "*")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def files(lookup)
|
|
104
|
+
Dir.glob(lookup, File::FNM_DOTMATCH)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|