vagrant-unbundled 1.9.7.1 → 1.9.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/Gemfile.lock +10 -6
- data/contrib/bash/completion.sh +1 -1
- data/contrib/sudoers/linux-ubuntu +3 -4
- data/lib/vagrant/errors.rb +8 -0
- data/lib/vagrant/machine.rb +2 -0
- data/lib/vagrant/util/platform.rb +1 -1
- data/lib/vagrant/util/powershell.rb +42 -13
- data/lib/vagrant/util/safe_exec.rb +13 -2
- data/lib/vagrant/util/ssh.rb +11 -1
- data/plugins/commands/box/command/update.rb +12 -7
- data/plugins/commands/login/client.rb +15 -6
- data/plugins/commands/login/command.rb +13 -3
- data/plugins/commands/up/command.rb +9 -0
- data/plugins/commands/validate/command.rb +4 -4
- data/plugins/guests/darwin/cap/shell_expand_guest_path.rb +2 -2
- data/plugins/guests/freebsd/cap/configure_networks.rb +1 -1
- data/plugins/guests/freebsd/cap/shell_expand_guest_path.rb +2 -2
- data/plugins/guests/linux/cap/shell_expand_guest_path.rb +2 -2
- data/plugins/guests/netbsd/cap/shell_expand_guest_path.rb +2 -2
- data/plugins/guests/openbsd/cap/shell_expand_guest_path.rb +2 -2
- data/plugins/guests/windows/cap/public_key.rb +21 -45
- data/plugins/kernel_v2/config/ssh_connect.rb +3 -0
- data/plugins/providers/docker/config.rb +4 -0
- data/plugins/providers/docker/driver/compose.rb +11 -4
- data/plugins/providers/hyperv/action/wait_for_ip_address.rb +15 -11
- data/plugins/providers/hyperv/scripts/get_network_config.ps1 +24 -9
- data/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +18 -0
- data/plugins/provisioners/ansible/provisioner/host.rb +1 -1
- data/plugins/provisioners/chef/cap/debian/chef_install.rb +2 -2
- data/plugins/provisioners/chef/cap/freebsd/chef_install.rb +2 -2
- data/plugins/provisioners/chef/cap/omnios/chef_install.rb +2 -2
- data/plugins/provisioners/chef/cap/redhat/chef_install.rb +2 -2
- data/plugins/provisioners/chef/cap/suse/chef_install.rb +2 -2
- data/plugins/provisioners/chef/cap/windows/chef_install.rb +2 -2
- data/plugins/provisioners/chef/config/base.rb +17 -0
- data/plugins/provisioners/chef/config/chef_zero.rb +7 -0
- data/plugins/provisioners/chef/installer.rb +8 -7
- data/plugins/provisioners/chef/omnibus.rb +4 -6
- data/plugins/provisioners/chef/provisioner/base.rb +1 -0
- data/plugins/provisioners/chef/provisioner/chef_solo.rb +2 -1
- data/plugins/provisioners/file/provisioner.rb +18 -2
- data/plugins/provisioners/puppet/provisioner/puppet.rb +0 -2
- data/plugins/provisioners/salt/bootstrap-salt.sh +9 -5
- data/plugins/provisioners/shell/provisioner.rb +1 -1
- data/plugins/synced_folders/rsync/command/rsync_auto.rb +6 -1
- data/plugins/synced_folders/rsync/helper.rb +10 -0
- data/templates/locales/en.yml +27 -1
- data/templates/locales/providers_docker.yml +2 -0
- data/test/unit/base.rb +1 -3
- data/test/unit/plugins/commands/box/command/add_test.rb +3 -3
- data/test/unit/plugins/commands/box/command/remove_test.rb +6 -6
- data/test/unit/plugins/commands/box/command/repackage_test.rb +2 -4
- data/test/unit/plugins/commands/box/command/update_test.rb +36 -14
- data/test/unit/plugins/commands/init/command_test.rb +1 -1
- data/test/unit/plugins/commands/list-commands/command_test.rb +2 -2
- data/test/unit/plugins/commands/login/client_test.rb +5 -1
- data/test/unit/plugins/commands/package/command_test.rb +1 -1
- data/test/unit/plugins/commands/plugin/action/expunge_plugins_test.rb +1 -1
- data/test/unit/plugins/commands/plugin/action/install_gem_test.rb +3 -3
- data/test/unit/plugins/commands/plugin/action/plugin_exists_check_test.rb +3 -3
- data/test/unit/plugins/commands/plugin/action/uninstall_plugin_test.rb +1 -1
- data/test/unit/plugins/commands/plugin/action/update_gems_test.rb +2 -2
- data/test/unit/plugins/commands/port/command_test.rb +3 -3
- data/test/unit/plugins/commands/push/command_test.rb +1 -1
- data/test/unit/plugins/commands/snapshot/command/list_test.rb +2 -3
- data/test/unit/plugins/commands/ssh_config/command_test.rb +1 -1
- data/test/unit/plugins/commands/up/command_test.rb +69 -2
- data/test/unit/plugins/commands/validate/command_test.rb +47 -1
- data/test/unit/plugins/communicators/ssh/communicator_test.rb +5 -5
- data/test/unit/plugins/communicators/winrm/communicator_test.rb +6 -6
- data/test/unit/plugins/communicators/winrm/helper_test.rb +24 -23
- data/test/unit/plugins/communicators/winssh/communicator_test.rb +5 -5
- data/test/unit/plugins/guests/darwin/cap/shell_expand_guest_path_test.rb +43 -0
- data/test/unit/plugins/guests/freebsd/cap/configure_networks_test.rb +1 -1
- data/test/unit/plugins/guests/freebsd/cap/shell_expand_guest_path_test.rb +44 -0
- data/test/unit/plugins/guests/linux/cap/shell_expand_guest_path_test.rb +43 -0
- data/test/unit/plugins/guests/netbsd/cap/shell_expand_guest_path_test.rb +43 -0
- data/test/unit/plugins/guests/omnios/cap/mount_nfs_folder_test.rb +1 -3
- data/test/unit/plugins/guests/openbsd/cap/shell_expand_guest_path_test.rb +43 -0
- data/test/unit/plugins/guests/smartos/cap/change_host_name_test.rb +2 -2
- data/test/unit/plugins/guests/smartos/cap/configure_networks_test.rb +2 -2
- data/test/unit/plugins/guests/smartos/cap/halt_test.rb +2 -2
- data/test/unit/plugins/guests/smartos/cap/insert_public_key_test.rb +1 -1
- data/test/unit/plugins/guests/smartos/cap/mount_nfs_test.rb +2 -2
- data/test/unit/plugins/guests/smartos/cap/rsync_test.rb +2 -2
- data/test/unit/plugins/guests/windows/cap/insert_public_key_test.rb +2 -2
- data/test/unit/plugins/guests/windows/cap/remove_public_key_test.rb +4 -3
- data/test/unit/plugins/guests/windows/config_test.rb +1 -1
- data/test/unit/plugins/guests/windows/guest_network_test.rb +2 -2
- data/test/unit/plugins/hosts/linux/cap/nfs_test.rb +2 -0
- data/test/unit/plugins/kernel_v2/config/push_test.rb +1 -1
- data/test/unit/plugins/kernel_v2/config/vm_test.rb +7 -7
- data/test/unit/plugins/providers/docker/action/create_test.rb +1 -1
- data/test/unit/plugins/providers/docker/command/exec_test.rb +1 -1
- data/test/unit/plugins/providers/docker/config_test.rb +23 -4
- data/test/unit/plugins/providers/docker/driver_compose_test.rb +60 -30
- data/test/unit/plugins/providers/docker/driver_test.rb +31 -31
- data/test/unit/plugins/providers/docker/synced_folder_test.rb +3 -3
- data/test/unit/plugins/providers/hyperv/provider_test.rb +19 -19
- data/test/unit/plugins/providers/virtualbox/action/network_fix_ipv6_test.rb +2 -2
- data/test/unit/plugins/providers/virtualbox/action/network_test.rb +1 -1
- data/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +34 -8
- data/test/unit/plugins/providers/virtualbox/action/prepare_nfs_valid_ids_test.rb +3 -3
- data/test/unit/plugins/providers/virtualbox/cap_test.rb +2 -2
- data/test/unit/plugins/providers/virtualbox/config_test.rb +6 -6
- data/test/unit/plugins/providers/virtualbox/synced_folder_test.rb +6 -8
- data/test/unit/plugins/provisioners/ansible/config/guest_test.rb +1 -1
- data/test/unit/plugins/provisioners/ansible/config/host_test.rb +4 -4
- data/test/unit/plugins/provisioners/ansible/config/shared.rb +2 -2
- data/test/unit/plugins/provisioners/ansible/provisioner_test.rb +165 -157
- data/test/unit/plugins/provisioners/chef/command_builder_test.rb +2 -2
- data/test/unit/plugins/provisioners/chef/config/base_test.rb +13 -0
- data/test/unit/plugins/provisioners/chef/config/chef_zero_test.rb +11 -0
- data/test/unit/plugins/provisioners/chef/omnibus_test.rb +17 -7
- data/test/unit/plugins/provisioners/docker/config_test.rb +2 -1
- data/test/unit/plugins/provisioners/docker/provisioner_test.rb +13 -13
- data/test/unit/plugins/provisioners/file/provisioner_test.rb +32 -14
- data/test/unit/plugins/provisioners/puppet/provisioner/puppet_test.rb +51 -0
- data/test/unit/plugins/provisioners/salt/provisioner_test.rb +5 -5
- data/test/unit/plugins/provisioners/shell/provisioner_test.rb +35 -4
- data/test/unit/plugins/pushes/ftp/adapter_test.rb +1 -0
- data/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb +1 -1
- data/test/unit/plugins/synced_folders/nfs/config_test.rb +1 -1
- data/test/unit/plugins/synced_folders/rsync/command/rsync_auto_test.rb +44 -12
- data/test/unit/plugins/synced_folders/rsync/command/rsync_test.rb +5 -5
- data/test/unit/plugins/synced_folders/rsync/helper_test.rb +47 -29
- data/test/unit/plugins/synced_folders/rsync/synced_folder_test.rb +5 -5
- data/test/unit/vagrant/action/builtin/box_add_test.rb +27 -27
- data/test/unit/vagrant/action/builtin/box_check_outdated_test.rb +10 -10
- data/test/unit/vagrant/action/builtin/box_remove_test.rb +15 -15
- data/test/unit/vagrant/action/builtin/confirm_test.rb +1 -1
- data/test/unit/vagrant/action/builtin/graceful_halt_test.rb +2 -2
- data/test/unit/vagrant/action/builtin/handle_box_test.rb +8 -8
- data/test/unit/vagrant/action/builtin/handle_forwarded_port_collisions_test.rb +1 -1
- data/test/unit/vagrant/action/builtin/is_env_set_test.rb +2 -2
- data/test/unit/vagrant/action/builtin/is_state_test.rb +6 -6
- data/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb +6 -6
- data/test/unit/vagrant/action/builtin/provision_test.rb +1 -1
- data/test/unit/vagrant/action/builtin/provisioner_cleanup_test.rb +1 -1
- data/test/unit/vagrant/action/builtin/synced_folder_cleanup_test.rb +6 -6
- data/test/unit/vagrant/action/builtin/synced_folders_test.rb +3 -3
- data/test/unit/vagrant/batch_action_test.rb +2 -2
- data/test/unit/vagrant/box_collection_test.rb +1 -1
- data/test/unit/vagrant/box_test.rb +6 -6
- data/test/unit/vagrant/capability_host_test.rb +3 -3
- data/test/unit/vagrant/cli_test.rb +3 -3
- data/test/unit/vagrant/environment_test.rb +21 -20
- data/test/unit/vagrant/guest_test.rb +7 -7
- data/test/unit/vagrant/machine_index_test.rb +4 -4
- data/test/unit/vagrant/machine_test.rb +28 -17
- data/test/unit/vagrant/plugin/manager_test.rb +12 -12
- data/test/unit/vagrant/plugin/state_file_test.rb +2 -2
- data/test/unit/vagrant/plugin/v1/command_test.rb +9 -8
- data/test/unit/vagrant/plugin/v2/command_test.rb +54 -43
- data/test/unit/vagrant/plugin/v2/plugin_test.rb +4 -3
- data/test/unit/vagrant/plugin/v2/provider_test.rb +3 -3
- data/test/unit/vagrant/shared_helpers_test.rb +6 -6
- data/test/unit/vagrant/ui_test.rb +21 -21
- data/test/unit/vagrant/util/downloader_test.rb +7 -7
- data/test/unit/vagrant/util/ssh_test.rb +41 -5
- data/test/unit/vagrant/util/subprocess_test.rb +7 -7
- data/test/unit/vagrant_test.rb +9 -9
- data/vagrant.gemspec +3 -2
- data/vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-af86757912f7/vagrant-spec.gemspec +1 -1
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/.gitignore +7 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/.rspec +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/.travis.yml +5 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/CONTRIBUTORS.md +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/Gemfile +12 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/Gemfile.lock +44 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/Guardfile +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/README.md +134 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/Rakefile +10 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/fake_ftp.gemspec +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/lib/fake_ftp.rb +5 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/lib/fake_ftp/file.rb +34 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/lib/fake_ftp/server.rb +340 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/lib/fake_ftp/version.rb +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/fixtures/invisible_bike.jpg +0 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/fixtures/text_file.txt +1 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/functional/server_spec.rb +468 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/integration/server_spec.rb +81 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/models/fake_ftp/file_spec.rb +102 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/models/fake_ftp/server_spec.rb +76 -0
- data/vendor/bundle/ruby/2.4.0/gems/fake_ftp-0.1.1/spec/spec_helper.rb +18 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.gitignore +14 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.rubocop.yml +57 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/.travis.yml +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/CONTRIBUTING.rdoc +36 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/Gemfile +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/History.rdoc +2247 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/README.rdoc +156 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/Rakefile +38 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/appveyor.yml +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/bin/console +7 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/bin/setup +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/jamis.rb +591 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/rake.1 +156 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/rakefile.rdoc +622 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/exe/rake +27 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake.rb +70 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/application.rb +785 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/backtrace.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/clean.rb +77 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/cpu_counter.rb +106 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/default_loader.rb +14 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/dsl_definition.rb +194 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/early_time.rb +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/ext/core.rb +25 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/ext/string.rb +175 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_list.rb +434 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_utils.rb +136 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/file_utils_ext.rb +144 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/invocation_chain.rb +56 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/late_time.rb +17 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/linked_list.rb +111 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/loaders/makefile.rb +53 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/multi_task.rb +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/name_space.rb +37 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/packagetask.rb +210 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/phony.rb +15 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/promise.rb +99 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/rake_module.rb +38 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/rake_test_loader.rb +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/rule_recursion_overflow_error.rb +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/scope.rb +42 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task.rb +390 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task_arguments.rb +108 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/task_manager.rb +303 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/tasklib.rb +11 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/testtask.rb +222 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/thread_pool.rb +162 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/version.rb +9 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/lib/rake/win32.rb +50 -0
- data/vendor/bundle/ruby/2.4.0/gems/rake-12.0.0/rake.gemspec +39 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/.gitignore +19 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/.rspec +3 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/.travis.yml +24 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/Changelog.md +49 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/Gemfile +26 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/LICENSE.txt +27 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/README.md +72 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/Rakefile +16 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/cucumber.yml +2 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/features/its.feature +125 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/features/step_definitions/additional_cli_steps.rb +21 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/features/support/env.rb +23 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/lib/rspec/its.rb +149 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/lib/rspec/its/version.rb +5 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/rspec-its.gemspec +28 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/script/test_all +20 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/spec/rspec/its_spec.rb +237 -0
- data/vendor/bundle/ruby/2.4.0/gems/rspec-its-1.2.0/spec/spec_helper.rb +15 -0
- data/vendor/bundle/ruby/2.4.0/specifications/fake_ftp-0.1.1.gemspec +20 -0
- data/vendor/bundle/ruby/2.4.0/specifications/rake-12.0.0.gemspec +43 -0
- data/vendor/bundle/ruby/2.4.0/specifications/rspec-its-1.2.0.gemspec +47 -0
- data/version.txt +1 -1
- metadata +137 -7
- data/2.14.0 +0 -5
@@ -0,0 +1,25 @@
|
|
1
|
+
class Module
|
2
|
+
# Check for an existing method in the current class before extending. If
|
3
|
+
# the method already exists, then a warning is printed and the extension is
|
4
|
+
# not added. Otherwise the block is yielded and any definitions in the
|
5
|
+
# block will take effect.
|
6
|
+
#
|
7
|
+
# Usage:
|
8
|
+
#
|
9
|
+
# class String
|
10
|
+
# rake_extension("xyz") do
|
11
|
+
# def xyz
|
12
|
+
# ...
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
def rake_extension(method) # :nodoc:
|
18
|
+
if method_defined?(method)
|
19
|
+
$stderr.puts "WARNING: Possible conflict with Rake extension: " +
|
20
|
+
"#{self}##{method} already exists"
|
21
|
+
else
|
22
|
+
yield
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
require "rake/ext/core"
|
2
|
+
|
3
|
+
class String
|
4
|
+
|
5
|
+
rake_extension("ext") do
|
6
|
+
# Replace the file extension with +newext+. If there is no extension on
|
7
|
+
# the string, append the new extension to the end. If the new extension
|
8
|
+
# is not given, or is the empty string, remove any existing extension.
|
9
|
+
#
|
10
|
+
# +ext+ is a user added method for the String class.
|
11
|
+
#
|
12
|
+
# This String extension comes from Rake
|
13
|
+
def ext(newext="")
|
14
|
+
return self.dup if [".", ".."].include? self
|
15
|
+
if newext != ""
|
16
|
+
newext = "." + newext unless newext =~ /^\./
|
17
|
+
end
|
18
|
+
self.chomp(File.extname(self)) << newext
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
rake_extension("pathmap") do
|
23
|
+
# Explode a path into individual components. Used by +pathmap+.
|
24
|
+
#
|
25
|
+
# This String extension comes from Rake
|
26
|
+
def pathmap_explode
|
27
|
+
head, tail = File.split(self)
|
28
|
+
return [self] if head == self
|
29
|
+
return [tail] if head == "." || tail == "/"
|
30
|
+
return [head, tail] if head == "/"
|
31
|
+
return head.pathmap_explode + [tail]
|
32
|
+
end
|
33
|
+
protected :pathmap_explode
|
34
|
+
|
35
|
+
# Extract a partial path from the path. Include +n+ directories from the
|
36
|
+
# front end (left hand side) if +n+ is positive. Include |+n+|
|
37
|
+
# directories from the back end (right hand side) if +n+ is negative.
|
38
|
+
#
|
39
|
+
# This String extension comes from Rake
|
40
|
+
def pathmap_partial(n)
|
41
|
+
dirs = File.dirname(self).pathmap_explode
|
42
|
+
partial_dirs =
|
43
|
+
if n > 0
|
44
|
+
dirs[0...n]
|
45
|
+
elsif n < 0
|
46
|
+
dirs.reverse[0...-n].reverse
|
47
|
+
else
|
48
|
+
"."
|
49
|
+
end
|
50
|
+
File.join(partial_dirs)
|
51
|
+
end
|
52
|
+
protected :pathmap_partial
|
53
|
+
|
54
|
+
# Perform the pathmap replacement operations on the given path. The
|
55
|
+
# patterns take the form 'pat1,rep1;pat2,rep2...'.
|
56
|
+
#
|
57
|
+
# This String extension comes from Rake
|
58
|
+
def pathmap_replace(patterns, &block)
|
59
|
+
result = self
|
60
|
+
patterns.split(";").each do |pair|
|
61
|
+
pattern, replacement = pair.split(",")
|
62
|
+
pattern = Regexp.new(pattern)
|
63
|
+
if replacement == "*" && block_given?
|
64
|
+
result = result.sub(pattern, &block)
|
65
|
+
elsif replacement
|
66
|
+
result = result.sub(pattern, replacement)
|
67
|
+
else
|
68
|
+
result = result.sub(pattern, "")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
result
|
72
|
+
end
|
73
|
+
protected :pathmap_replace
|
74
|
+
|
75
|
+
# Map the path according to the given specification. The specification
|
76
|
+
# controls the details of the mapping. The following special patterns are
|
77
|
+
# recognized:
|
78
|
+
#
|
79
|
+
# <tt>%p</tt> :: The complete path.
|
80
|
+
# <tt>%f</tt> :: The base file name of the path, with its file extension,
|
81
|
+
# but without any directories.
|
82
|
+
# <tt>%n</tt> :: The file name of the path without its file extension.
|
83
|
+
# <tt>%d</tt> :: The directory list of the path.
|
84
|
+
# <tt>%x</tt> :: The file extension of the path. An empty string if there
|
85
|
+
# is no extension.
|
86
|
+
# <tt>%X</tt> :: Everything *but* the file extension.
|
87
|
+
# <tt>%s</tt> :: The alternate file separator if defined, otherwise use #
|
88
|
+
# the standard file separator.
|
89
|
+
# <tt>%%</tt> :: A percent sign.
|
90
|
+
#
|
91
|
+
# The <tt>%d</tt> specifier can also have a numeric prefix (e.g. '%2d').
|
92
|
+
# If the number is positive, only return (up to) +n+ directories in the
|
93
|
+
# path, starting from the left hand side. If +n+ is negative, return (up
|
94
|
+
# to) +n+ directories from the right hand side of the path.
|
95
|
+
#
|
96
|
+
# Examples:
|
97
|
+
#
|
98
|
+
# 'a/b/c/d/file.txt'.pathmap("%2d") => 'a/b'
|
99
|
+
# 'a/b/c/d/file.txt'.pathmap("%-2d") => 'c/d'
|
100
|
+
#
|
101
|
+
# Also the <tt>%d</tt>, <tt>%p</tt>, <tt>%f</tt>, <tt>%n</tt>,
|
102
|
+
# <tt>%x</tt>, and <tt>%X</tt> operators can take a pattern/replacement
|
103
|
+
# argument to perform simple string substitutions on a particular part of
|
104
|
+
# the path. The pattern and replacement are separated by a comma and are
|
105
|
+
# enclosed by curly braces. The replacement spec comes after the %
|
106
|
+
# character but before the operator letter. (e.g. "%{old,new}d").
|
107
|
+
# Multiple replacement specs should be separated by semi-colons (e.g.
|
108
|
+
# "%{old,new;src,bin}d").
|
109
|
+
#
|
110
|
+
# Regular expressions may be used for the pattern, and back refs may be
|
111
|
+
# used in the replacement text. Curly braces, commas and semi-colons are
|
112
|
+
# excluded from both the pattern and replacement text (let's keep parsing
|
113
|
+
# reasonable).
|
114
|
+
#
|
115
|
+
# For example:
|
116
|
+
#
|
117
|
+
# "src/org/onestepback/proj/A.java".pathmap("%{^src,class}X.class")
|
118
|
+
#
|
119
|
+
# returns:
|
120
|
+
#
|
121
|
+
# "class/org/onestepback/proj/A.class"
|
122
|
+
#
|
123
|
+
# If the replacement text is '*', then a block may be provided to perform
|
124
|
+
# some arbitrary calculation for the replacement.
|
125
|
+
#
|
126
|
+
# For example:
|
127
|
+
#
|
128
|
+
# "/path/to/file.TXT".pathmap("%X%{.*,*}x") { |ext|
|
129
|
+
# ext.downcase
|
130
|
+
# }
|
131
|
+
#
|
132
|
+
# Returns:
|
133
|
+
#
|
134
|
+
# "/path/to/file.txt"
|
135
|
+
#
|
136
|
+
# This String extension comes from Rake
|
137
|
+
def pathmap(spec=nil, &block)
|
138
|
+
return self if spec.nil?
|
139
|
+
result = ""
|
140
|
+
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
|
141
|
+
case frag
|
142
|
+
when "%f"
|
143
|
+
result << File.basename(self)
|
144
|
+
when "%n"
|
145
|
+
result << File.basename(self).ext
|
146
|
+
when "%d"
|
147
|
+
result << File.dirname(self)
|
148
|
+
when "%x"
|
149
|
+
result << File.extname(self)
|
150
|
+
when "%X"
|
151
|
+
result << self.ext
|
152
|
+
when "%p"
|
153
|
+
result << self
|
154
|
+
when "%s"
|
155
|
+
result << (File::ALT_SEPARATOR || File::SEPARATOR)
|
156
|
+
when "%-"
|
157
|
+
# do nothing
|
158
|
+
when "%%"
|
159
|
+
result << "%"
|
160
|
+
when /%(-?\d+)d/
|
161
|
+
result << pathmap_partial($1.to_i)
|
162
|
+
when /^%\{([^}]*)\}(\d*[dpfnxX])/
|
163
|
+
patterns, operator = $1, $2
|
164
|
+
result << pathmap("%" + operator).pathmap_replace(patterns, &block)
|
165
|
+
when /^%/
|
166
|
+
fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
|
167
|
+
else
|
168
|
+
result << frag
|
169
|
+
end
|
170
|
+
end
|
171
|
+
result
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "rake/file_task"
|
2
|
+
require "rake/early_time"
|
3
|
+
|
4
|
+
module Rake
|
5
|
+
|
6
|
+
# A FileCreationTask is a file task that when used as a dependency will be
|
7
|
+
# needed if and only if the file has not been created. Once created, it is
|
8
|
+
# not re-triggered if any of its dependencies are newer, nor does trigger
|
9
|
+
# any rebuilds of tasks that depend on it whenever it is updated.
|
10
|
+
#
|
11
|
+
class FileCreationTask < FileTask
|
12
|
+
# Is this file task needed? Yes if it doesn't exist.
|
13
|
+
def needed?
|
14
|
+
! File.exist?(name)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Time stamp for file creation task. This time stamp is earlier
|
18
|
+
# than any other time stamp.
|
19
|
+
def timestamp
|
20
|
+
Rake::EARLY
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,434 @@
|
|
1
|
+
require "rake/cloneable"
|
2
|
+
require "rake/file_utils_ext"
|
3
|
+
require "rake/ext/string"
|
4
|
+
|
5
|
+
module Rake
|
6
|
+
|
7
|
+
##
|
8
|
+
# A FileList is essentially an array with a few helper methods defined to
|
9
|
+
# make file manipulation a bit easier.
|
10
|
+
#
|
11
|
+
# FileLists are lazy. When given a list of glob patterns for possible files
|
12
|
+
# to be included in the file list, instead of searching the file structures
|
13
|
+
# to find the files, a FileList holds the pattern for latter use.
|
14
|
+
#
|
15
|
+
# This allows us to define a number of FileList to match any number of
|
16
|
+
# files, but only search out the actual files when then FileList itself is
|
17
|
+
# actually used. The key is that the first time an element of the
|
18
|
+
# FileList/Array is requested, the pending patterns are resolved into a real
|
19
|
+
# list of file names.
|
20
|
+
#
|
21
|
+
class FileList
|
22
|
+
|
23
|
+
include Cloneable
|
24
|
+
|
25
|
+
# == Method Delegation
|
26
|
+
#
|
27
|
+
# The lazy evaluation magic of FileLists happens by implementing all the
|
28
|
+
# array specific methods to call +resolve+ before delegating the heavy
|
29
|
+
# lifting to an embedded array object (@items).
|
30
|
+
#
|
31
|
+
# In addition, there are two kinds of delegation calls. The regular kind
|
32
|
+
# delegates to the @items array and returns the result directly. Well,
|
33
|
+
# almost directly. It checks if the returned value is the @items object
|
34
|
+
# itself, and if so will return the FileList object instead.
|
35
|
+
#
|
36
|
+
# The second kind of delegation call is used in methods that normally
|
37
|
+
# return a new Array object. We want to capture the return value of these
|
38
|
+
# methods and wrap them in a new FileList object. We enumerate these
|
39
|
+
# methods in the +SPECIAL_RETURN+ list below.
|
40
|
+
|
41
|
+
# List of array methods (that are not in +Object+) that need to be
|
42
|
+
# delegated.
|
43
|
+
ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).map(&:to_s)
|
44
|
+
|
45
|
+
# List of additional methods that must be delegated.
|
46
|
+
MUST_DEFINE = %w[inspect <=>]
|
47
|
+
|
48
|
+
# List of methods that should not be delegated here (we define special
|
49
|
+
# versions of them explicitly below).
|
50
|
+
MUST_NOT_DEFINE = %w[to_a to_ary partition * <<]
|
51
|
+
|
52
|
+
# List of delegated methods that return new array values which need
|
53
|
+
# wrapping.
|
54
|
+
SPECIAL_RETURN = %w[
|
55
|
+
map collect sort sort_by select find_all reject grep
|
56
|
+
compact flatten uniq values_at
|
57
|
+
+ - & |
|
58
|
+
]
|
59
|
+
|
60
|
+
DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).map(&:to_s).sort.uniq
|
61
|
+
|
62
|
+
# Now do the delegation.
|
63
|
+
DELEGATING_METHODS.each do |sym|
|
64
|
+
if SPECIAL_RETURN.include?(sym)
|
65
|
+
ln = __LINE__ + 1
|
66
|
+
class_eval %{
|
67
|
+
def #{sym}(*args, &block)
|
68
|
+
resolve
|
69
|
+
result = @items.send(:#{sym}, *args, &block)
|
70
|
+
self.class.new.import(result)
|
71
|
+
end
|
72
|
+
}, __FILE__, ln
|
73
|
+
else
|
74
|
+
ln = __LINE__ + 1
|
75
|
+
class_eval %{
|
76
|
+
def #{sym}(*args, &block)
|
77
|
+
resolve
|
78
|
+
result = @items.send(:#{sym}, *args, &block)
|
79
|
+
result.object_id == @items.object_id ? self : result
|
80
|
+
end
|
81
|
+
}, __FILE__, ln
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
GLOB_PATTERN = %r{[*?\[\{]}
|
86
|
+
|
87
|
+
# Create a file list from the globbable patterns given. If you wish to
|
88
|
+
# perform multiple includes or excludes at object build time, use the
|
89
|
+
# "yield self" pattern.
|
90
|
+
#
|
91
|
+
# Example:
|
92
|
+
# file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
|
93
|
+
#
|
94
|
+
# pkg_files = FileList.new('lib/**/*') do |fl|
|
95
|
+
# fl.exclude(/\bCVS\b/)
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
def initialize(*patterns)
|
99
|
+
@pending_add = []
|
100
|
+
@pending = false
|
101
|
+
@exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
|
102
|
+
@exclude_procs = DEFAULT_IGNORE_PROCS.dup
|
103
|
+
@items = []
|
104
|
+
patterns.each { |pattern| include(pattern) }
|
105
|
+
yield self if block_given?
|
106
|
+
end
|
107
|
+
|
108
|
+
# Add file names defined by glob patterns to the file list. If an array
|
109
|
+
# is given, add each element of the array.
|
110
|
+
#
|
111
|
+
# Example:
|
112
|
+
# file_list.include("*.java", "*.cfg")
|
113
|
+
# file_list.include %w( math.c lib.h *.o )
|
114
|
+
#
|
115
|
+
def include(*filenames)
|
116
|
+
# TODO: check for pending
|
117
|
+
filenames.each do |fn|
|
118
|
+
if fn.respond_to? :to_ary
|
119
|
+
include(*fn.to_ary)
|
120
|
+
else
|
121
|
+
@pending_add << Rake.from_pathname(fn)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
@pending = true
|
125
|
+
self
|
126
|
+
end
|
127
|
+
alias :add :include
|
128
|
+
|
129
|
+
# Register a list of file name patterns that should be excluded from the
|
130
|
+
# list. Patterns may be regular expressions, glob patterns or regular
|
131
|
+
# strings. In addition, a block given to exclude will remove entries that
|
132
|
+
# return true when given to the block.
|
133
|
+
#
|
134
|
+
# Note that glob patterns are expanded against the file system. If a file
|
135
|
+
# is explicitly added to a file list, but does not exist in the file
|
136
|
+
# system, then an glob pattern in the exclude list will not exclude the
|
137
|
+
# file.
|
138
|
+
#
|
139
|
+
# Examples:
|
140
|
+
# FileList['a.c', 'b.c'].exclude("a.c") => ['b.c']
|
141
|
+
# FileList['a.c', 'b.c'].exclude(/^a/) => ['b.c']
|
142
|
+
#
|
143
|
+
# If "a.c" is a file, then ...
|
144
|
+
# FileList['a.c', 'b.c'].exclude("a.*") => ['b.c']
|
145
|
+
#
|
146
|
+
# If "a.c" is not a file, then ...
|
147
|
+
# FileList['a.c', 'b.c'].exclude("a.*") => ['a.c', 'b.c']
|
148
|
+
#
|
149
|
+
def exclude(*patterns, &block)
|
150
|
+
patterns.each do |pat|
|
151
|
+
if pat.respond_to? :to_ary
|
152
|
+
exclude(*pat.to_ary)
|
153
|
+
else
|
154
|
+
@exclude_patterns << Rake.from_pathname(pat)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
@exclude_procs << block if block_given?
|
158
|
+
resolve_exclude unless @pending
|
159
|
+
self
|
160
|
+
end
|
161
|
+
|
162
|
+
# Clear all the exclude patterns so that we exclude nothing.
|
163
|
+
def clear_exclude
|
164
|
+
@exclude_patterns = []
|
165
|
+
@exclude_procs = []
|
166
|
+
self
|
167
|
+
end
|
168
|
+
|
169
|
+
# A FileList is equal through array equality.
|
170
|
+
def ==(array)
|
171
|
+
to_ary == array
|
172
|
+
end
|
173
|
+
|
174
|
+
# Return the internal array object.
|
175
|
+
def to_a
|
176
|
+
resolve
|
177
|
+
@items
|
178
|
+
end
|
179
|
+
|
180
|
+
# Return the internal array object.
|
181
|
+
def to_ary
|
182
|
+
to_a
|
183
|
+
end
|
184
|
+
|
185
|
+
# Lie about our class.
|
186
|
+
def is_a?(klass)
|
187
|
+
klass == Array || super(klass)
|
188
|
+
end
|
189
|
+
alias kind_of? is_a?
|
190
|
+
|
191
|
+
# Redefine * to return either a string or a new file list.
|
192
|
+
def *(other)
|
193
|
+
result = @items * other
|
194
|
+
case result
|
195
|
+
when Array
|
196
|
+
self.class.new.import(result)
|
197
|
+
else
|
198
|
+
result
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def <<(obj)
|
203
|
+
resolve
|
204
|
+
@items << Rake.from_pathname(obj)
|
205
|
+
self
|
206
|
+
end
|
207
|
+
|
208
|
+
# Resolve all the pending adds now.
|
209
|
+
def resolve
|
210
|
+
if @pending
|
211
|
+
@pending = false
|
212
|
+
@pending_add.each do |fn| resolve_add(fn) end
|
213
|
+
@pending_add = []
|
214
|
+
resolve_exclude
|
215
|
+
end
|
216
|
+
self
|
217
|
+
end
|
218
|
+
|
219
|
+
def resolve_add(fn) # :nodoc:
|
220
|
+
case fn
|
221
|
+
when GLOB_PATTERN
|
222
|
+
add_matching(fn)
|
223
|
+
else
|
224
|
+
self << fn
|
225
|
+
end
|
226
|
+
end
|
227
|
+
private :resolve_add
|
228
|
+
|
229
|
+
def resolve_exclude # :nodoc:
|
230
|
+
reject! { |fn| excluded_from_list?(fn) }
|
231
|
+
self
|
232
|
+
end
|
233
|
+
private :resolve_exclude
|
234
|
+
|
235
|
+
# Return a new FileList with the results of running +sub+ against each
|
236
|
+
# element of the original list.
|
237
|
+
#
|
238
|
+
# Example:
|
239
|
+
# FileList['a.c', 'b.c'].sub(/\.c$/, '.o') => ['a.o', 'b.o']
|
240
|
+
#
|
241
|
+
def sub(pat, rep)
|
242
|
+
inject(self.class.new) { |res, fn| res << fn.sub(pat, rep) }
|
243
|
+
end
|
244
|
+
|
245
|
+
# Return a new FileList with the results of running +gsub+ against each
|
246
|
+
# element of the original list.
|
247
|
+
#
|
248
|
+
# Example:
|
249
|
+
# FileList['lib/test/file', 'x/y'].gsub(/\//, "\\")
|
250
|
+
# => ['lib\\test\\file', 'x\\y']
|
251
|
+
#
|
252
|
+
def gsub(pat, rep)
|
253
|
+
inject(self.class.new) { |res, fn| res << fn.gsub(pat, rep) }
|
254
|
+
end
|
255
|
+
|
256
|
+
# Same as +sub+ except that the original file list is modified.
|
257
|
+
def sub!(pat, rep)
|
258
|
+
each_with_index { |fn, i| self[i] = fn.sub(pat, rep) }
|
259
|
+
self
|
260
|
+
end
|
261
|
+
|
262
|
+
# Same as +gsub+ except that the original file list is modified.
|
263
|
+
def gsub!(pat, rep)
|
264
|
+
each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }
|
265
|
+
self
|
266
|
+
end
|
267
|
+
|
268
|
+
# Apply the pathmap spec to each of the included file names, returning a
|
269
|
+
# new file list with the modified paths. (See String#pathmap for
|
270
|
+
# details.)
|
271
|
+
def pathmap(spec=nil, &block)
|
272
|
+
collect { |fn| fn.pathmap(spec, &block) }
|
273
|
+
end
|
274
|
+
|
275
|
+
# Return a new FileList with <tt>String#ext</tt> method applied to
|
276
|
+
# each member of the array.
|
277
|
+
#
|
278
|
+
# This method is a shortcut for:
|
279
|
+
#
|
280
|
+
# array.collect { |item| item.ext(newext) }
|
281
|
+
#
|
282
|
+
# +ext+ is a user added method for the Array class.
|
283
|
+
def ext(newext="")
|
284
|
+
collect { |fn| fn.ext(newext) }
|
285
|
+
end
|
286
|
+
|
287
|
+
# Grep each of the files in the filelist using the given pattern. If a
|
288
|
+
# block is given, call the block on each matching line, passing the file
|
289
|
+
# name, line number, and the matching line of text. If no block is given,
|
290
|
+
# a standard emacs style file:linenumber:line message will be printed to
|
291
|
+
# standard out. Returns the number of matched items.
|
292
|
+
def egrep(pattern, *options)
|
293
|
+
matched = 0
|
294
|
+
each do |fn|
|
295
|
+
begin
|
296
|
+
open(fn, "r", *options) do |inf|
|
297
|
+
count = 0
|
298
|
+
inf.each do |line|
|
299
|
+
count += 1
|
300
|
+
if pattern.match(line)
|
301
|
+
matched += 1
|
302
|
+
if block_given?
|
303
|
+
yield fn, count, line
|
304
|
+
else
|
305
|
+
puts "#{fn}:#{count}:#{line}"
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
rescue StandardError => ex
|
311
|
+
$stderr.puts "Error while processing '#{fn}': #{ex}"
|
312
|
+
end
|
313
|
+
end
|
314
|
+
matched
|
315
|
+
end
|
316
|
+
|
317
|
+
# Return a new file list that only contains file names from the current
|
318
|
+
# file list that exist on the file system.
|
319
|
+
def existing
|
320
|
+
select { |fn| File.exist?(fn) }
|
321
|
+
end
|
322
|
+
|
323
|
+
# Modify the current file list so that it contains only file name that
|
324
|
+
# exist on the file system.
|
325
|
+
def existing!
|
326
|
+
resolve
|
327
|
+
@items = @items.select { |fn| File.exist?(fn) }
|
328
|
+
self
|
329
|
+
end
|
330
|
+
|
331
|
+
# FileList version of partition. Needed because the nested arrays should
|
332
|
+
# be FileLists in this version.
|
333
|
+
def partition(&block) # :nodoc:
|
334
|
+
resolve
|
335
|
+
result = @items.partition(&block)
|
336
|
+
[
|
337
|
+
self.class.new.import(result[0]),
|
338
|
+
self.class.new.import(result[1]),
|
339
|
+
]
|
340
|
+
end
|
341
|
+
|
342
|
+
# Convert a FileList to a string by joining all elements with a space.
|
343
|
+
def to_s
|
344
|
+
resolve
|
345
|
+
self.join(" ")
|
346
|
+
end
|
347
|
+
|
348
|
+
# Add matching glob patterns.
|
349
|
+
def add_matching(pattern)
|
350
|
+
self.class.glob(pattern).each do |fn|
|
351
|
+
self << fn unless excluded_from_list?(fn)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
private :add_matching
|
355
|
+
|
356
|
+
# Should the given file name be excluded from the list?
|
357
|
+
#
|
358
|
+
# NOTE: This method was formerly named "exclude?", but Rails
|
359
|
+
# introduced an exclude? method as an array method and setup a
|
360
|
+
# conflict with file list. We renamed the method to avoid
|
361
|
+
# confusion. If you were using "FileList#exclude?" in your user
|
362
|
+
# code, you will need to update.
|
363
|
+
def excluded_from_list?(fn)
|
364
|
+
return true if @exclude_patterns.any? do |pat|
|
365
|
+
case pat
|
366
|
+
when Regexp
|
367
|
+
fn =~ pat
|
368
|
+
when GLOB_PATTERN
|
369
|
+
flags = File::FNM_PATHNAME
|
370
|
+
# Ruby <= 1.9.3 does not support File::FNM_EXTGLOB
|
371
|
+
flags |= File::FNM_EXTGLOB if defined? File::FNM_EXTGLOB
|
372
|
+
File.fnmatch?(pat, fn, flags)
|
373
|
+
else
|
374
|
+
fn == pat
|
375
|
+
end
|
376
|
+
end
|
377
|
+
@exclude_procs.any? { |p| p.call(fn) }
|
378
|
+
end
|
379
|
+
|
380
|
+
DEFAULT_IGNORE_PATTERNS = [
|
381
|
+
/(^|[\/\\])CVS([\/\\]|$)/,
|
382
|
+
/(^|[\/\\])\.svn([\/\\]|$)/,
|
383
|
+
/\.bak$/,
|
384
|
+
/~$/
|
385
|
+
]
|
386
|
+
DEFAULT_IGNORE_PROCS = [
|
387
|
+
proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
|
388
|
+
]
|
389
|
+
|
390
|
+
def import(array) # :nodoc:
|
391
|
+
@items = array
|
392
|
+
self
|
393
|
+
end
|
394
|
+
|
395
|
+
class << self
|
396
|
+
# Create a new file list including the files listed. Similar to:
|
397
|
+
#
|
398
|
+
# FileList.new(*args)
|
399
|
+
def [](*args)
|
400
|
+
new(*args)
|
401
|
+
end
|
402
|
+
|
403
|
+
# Get a sorted list of files matching the pattern. This method
|
404
|
+
# should be preferred to Dir[pattern] and Dir.glob(pattern) because
|
405
|
+
# the files returned are guaranteed to be sorted.
|
406
|
+
def glob(pattern, *args)
|
407
|
+
Dir.glob(pattern, *args).sort
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
413
|
+
module Rake
|
414
|
+
class << self
|
415
|
+
|
416
|
+
# Yield each file or directory component.
|
417
|
+
def each_dir_parent(dir) # :nodoc:
|
418
|
+
old_length = nil
|
419
|
+
while dir != "." && dir.length != old_length
|
420
|
+
yield(dir)
|
421
|
+
old_length = dir.length
|
422
|
+
dir = File.dirname(dir)
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
# Convert Pathname and Pathname-like objects to strings;
|
427
|
+
# leave everything else alone
|
428
|
+
def from_pathname(path) # :nodoc:
|
429
|
+
path = path.to_path if path.respond_to?(:to_path)
|
430
|
+
path = path.to_str if path.respond_to?(:to_str)
|
431
|
+
path
|
432
|
+
end
|
433
|
+
end
|
434
|
+
end # module Rake
|