pax_global_header 0000666 0000000 0000000 00000000064 14105021211 0014475 g ustar 00root root 0000000 0000000 52 comment=84b2d354527a8ee497410c5af369f7c8a9916f64 tty-which-0.5.0/ 0000775 0000000 0000000 00000000000 14105021211 0013417 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/.editorconfig 0000664 0000000 0000000 00000000226 14105021211 0016074 0 ustar 00root root 0000000 0000000 root = true [*.rb] charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space indent_size = 2 trim_trailing_whitespace = true tty-which-0.5.0/.github/ 0000775 0000000 0000000 00000000000 14105021211 0014757 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/.github/FUNDING.yml 0000664 0000000 0000000 00000000024 14105021211 0016570 0 ustar 00root root 0000000 0000000 github: piotrmurach tty-which-0.5.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14105021211 0017142 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/.github/ISSUE_TEMPLATE/BUG_REPORT.md 0000664 0000000 0000000 00000000767 14105021211 0021206 0 ustar 00root root 0000000 0000000 --- name: Bug report about: Report something not working correctly or as expected title: '' labels: bug assignees: '' --- ### Describe the problem A brief description of the issue. ### Steps to reproduce the problem ``` Your code here to reproduce the issue ``` ### Actual behaviour What happened? This could be a description, log output, error raised etc. ### Expected behaviour What did you expect to happen? ### Describe your environment * OS version: * Ruby version: * TTY::Which version: tty-which-0.5.0/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md 0000664 0000000 0000000 00000000564 14105021211 0021774 0 ustar 00root root 0000000 0000000 --- name: Feature request about: Suggest new functionality title: '' labels: enhancement assignees: '' --- ### Describe the problem A brief description of the problem you're trying to solve. ### How would the new feature work? A short explanation of the new feature. ``` Example code that shows possible usage ``` ### Drawbacks Can you see any potential drawbacks? tty-which-0.5.0/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000000272 14105021211 0021133 0 ustar 00root root 0000000 0000000 blank_issues_enabled: false contact_links: - name: TTY Community Discussions url: https://github.com/piotrmurach/tty/discussions about: Suggest ideas, ask and answer questions tty-which-0.5.0/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000000762 14105021211 0020565 0 ustar 00root root 0000000 0000000 ### Describe the change What does this Pull Request do? ### Why are we doing this? Any related context as to why is this is a desirable change. ### Benefits How will the library improve? ### Drawbacks Possible drawbacks applying this change. ### Requirements - [ ] Tests written & passing locally? - [ ] Code style checked? - [ ] Rebased with `master` branch? - [ ] Documentation updated? - [ ] Changelog updated? tty-which-0.5.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14105021211 0017014 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000002702 14105021211 0020133 0 ustar 00root root 0000000 0000000 --- name: CI on: push: branches: - master paths-ignore: - "*.md" pull_request: branches: - master paths-ignore: - "*.md" jobs: tests: name: Ruby ${{ matrix.ruby }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: - ubuntu-latest ruby: - 2.3 - 2.4 - 2.5 - 2.6 - 3.0 - ruby-head - jruby-9.2.13.0 - jruby-head - truffleruby-head include: - ruby: 2.0 os: ubuntu-latest coverage: false bundler: 1 - ruby: 2.1 os: ubuntu-latest coverage: false bundler: 1 - ruby: 2.2 os: ubuntu-latest coverage: false bundler: 1 - ruby: 2.7 os: ubuntu-latest coverage: true bundler: latest env: COVERAGE: ${{ matrix.coverage }} COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} continue-on-error: ${{ endsWith(matrix.ruby, 'head') }} steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler: ${{ matrix.bundler }} - name: Install dependencies run: bundle install --jobs 4 --retry 3 - name: Run tests run: bundle exec rake ci tty-which-0.5.0/.gitignore 0000664 0000000 0000000 00000000271 14105021211 0015407 0 ustar 00root root 0000000 0000000 *.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp *.bundle *.so *.o *.a mkmf.log tty-which-0.5.0/.rspec 0000664 0000000 0000000 00000000051 14105021211 0014530 0 ustar 00root root 0000000 0000000 --color --require spec_helper --warnings tty-which-0.5.0/.rubocop.yml 0000664 0000000 0000000 00000001436 14105021211 0015675 0 ustar 00root root 0000000 0000000 AllCops: NewCops: enable Layout/FirstArrayElementIndentation: Enabled: false Layout/LineLength: Max: 82 Layout/SpaceInsideHashLiteralBraces: EnforcedStyle: no_space Metrics/AbcSize: Max: 35 Metrics/BlockLength: CountComments: true Max: 25 IgnoredMethods: [] Exclude: - "spec/**/*" Metrics/ClassLength: Max: 1500 Metrics/CyclomaticComplexity: Max: 10 Metrics/MethodLength: Max: 20 Metrics/PerceivedComplexity: Max: 10 Naming/FileName: Exclude: - "lib/tty-which.rb" Style/AsciiComments: Enabled: false Style/BlockDelimiters: Enabled: false Style/CommentedKeyword: Enabled: false Style/LambdaCall: EnforcedStyle: braces Style/StringLiterals: EnforcedStyle: double_quotes Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes tty-which-0.5.0/CHANGELOG.md 0000664 0000000 0000000 00000004064 14105021211 0015234 0 ustar 00root root 0000000 0000000 # Change log ## [v0.5.0] - 2021-08-11 ### Changed * Change to use double-quoted strings * Remove bundler as development dependency ### Fixed * Fix to stop joining absolute path and extension with a file path separator ## [v0.4.2] - 2020-01-20 ### Changed * Change gemspec to add metadata and remove test artifacts ## [v0.4.1] - 2019-06-02 ### Changed * Change to relax bundler dependency version ## [v0.4.0] - 2018-10-13 ### Added * Add ability to specify search paths for #which and #exist? calls ### Changed * Change to freeze all strings * Change gemspec to require Ruby >= 2.0.0 * Change gemspec to load files without calling git * Change gemspec to add rspec as dev dependency ## [v0.3.0] - 2017-03-20 ### Changed * Change #extensions to use file path separator * Change files loading * Remove search paths caching ## [v0.2.2] - 2017-02-06 ### Fixed * Fix File namespacing issue ## [v0.2.1] - 2016-12-26 ### Changed * Change to stop shadowing path var in Which#search_paths ## [v0.2.0] - 2016-07-01 ### Added * Add Which#exist? to check if file exists based on found path ### Changed * Change Which#search_paths to allow for paths argument * Rename Which#executable_file_with_ext? to #file_with_exec_ext? * Rename Which#path_with_executable_file? to #file_with_path? ### Fixed * Fix bug with Which#file_with_exec_ext? when comparing extensions ## [v0.1.0] - 2015-05-30 * Initial implementation and release [v0.5.0]: https://github.com/piotrmurach/tty-which/compare/v0.4.2...v0.5.0 [v0.4.2]: https://github.com/piotrmurach/tty-which/compare/v0.4.1...v0.4.2 [v0.4.1]: https://github.com/piotrmurach/tty-which/compare/v0.4.0...v0.4.1 [v0.4.0]: https://github.com/piotrmurach/tty-which/compare/v0.3.0...v0.4.0 [v0.3.0]: https://github.com/piotrmurach/tty-which/compare/v0.2.2...v0.3.0 [v0.2.2]: https://github.com/piotrmurach/tty-which/compare/v0.2.1...v0.2.2 [v0.2.1]: https://github.com/piotrmurach/tty-which/compare/v0.2.0...v0.2.1 [v0.2.0]: https://github.com/piotrmurach/tty-which/compare/v0.1.0...v0.2.0 [v0.1.0]: https://github.com/piotrmurach/tty-which/compare/v0.1.0 tty-which-0.5.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000012143 14105021211 0016217 0 ustar 00root root 0000000 0000000 # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at piotr@piotrmurach.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. tty-which-0.5.0/Gemfile 0000664 0000000 0000000 00000000460 14105021211 0014712 0 ustar 00root root 0000000 0000000 source "https://rubygems.org" gemspec gem "json", "2.4.1" if RUBY_VERSION == "2.0.0" group :test do if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5.0") gem "coveralls_reborn", "~> 0.22.0" gem "simplecov", "~> 0.21.0" end end group :metrics do gem "yardstick", "~> 0.9.9" end tty-which-0.5.0/LICENSE.txt 0000664 0000000 0000000 00000002077 14105021211 0015250 0 ustar 00root root 0000000 0000000 Copyright (c) 2015 Piotr Murach (piotrmurach.com) MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. tty-which-0.5.0/README.md 0000664 0000000 0000000 00000006234 14105021211 0014703 0 ustar 00root root 0000000 0000000
# TTY::Which [][gitter] [][gem] [][gh_actions_ci] [][appveyor] [][codeclimate] [][coveralls] [][inchpages] [gitter]: https://gitter.im/piotrmurach/tty [gem]: https://badge.fury.io/rb/tty-which [gh_actions_ci]: https://github.com/piotrmurach/tty-which/actions?query=workflow%3ACI [appveyor]: https://ci.appveyor.com/project/piotrmurach/tty-which [codeclimate]: https://codeclimate.com/github/piotrmurach/tty-which [coveralls]: https://coveralls.io/github/piotrmurach/tty-which [inchpages]: https://inch-ci.org/github/piotrmurach/tty-which > Platform independent implementation of Unix `which` utility that searches for executable file in the path variable. **TTY::Which** provides cross-platform executables search component for [TTY](https://github.com/piotrmurach/tty) toolkit. ## Installation Add this line to your application's Gemfile: gem "tty-which" And then execute: $ bundle Or install it yourself as: $ gem install tty-which ## Usage **TTY::Which** has `which` method that searches set of directories for an executable file based on the `PATH` environment variable. When the path to an executable program exists, an absolute path is returned, otherwise `nil`. For example, to find location for an executable program do: ```ruby TTY::Which.which("less") # => "/usr/bin/less" TTY::Which.which("git") # => "C:\Program Files\Git\bin\git" ``` You can also check an absolute path to executable: ```ruby TTY::Which.which("/usr/bin/ruby") # => "/usr/bin/ruby" ``` You can also specify directly the paths to search using `:paths` keyword: ```ruby TTY::Which.which("ruby", paths: ["/usr/local/bin", "/usr/bin", "/bin"]) # => "/usr/local/bin/ruby" ``` When you're only interesting in knowing that an executable exists on the system use the `exist?` call: ```ruby TTY::Which.exist?("ruby") # => true ``` ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/piotrmurach/tty-which. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. 1. Fork it ( https://github.com/piotrmurach/tty-which/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request ## Copyright Copyright (c) 2015 Piotr Murach. See LICENSE for further details. tty-which-0.5.0/Rakefile 0000664 0000000 0000000 00000000254 14105021211 0015065 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true require "bundler/gem_tasks" FileList["tasks/**/*.rake"].each(&method(:import)) desc "Run all specs" task ci: %w[spec] task default: :spec tty-which-0.5.0/appveyor.yml 0000664 0000000 0000000 00000001146 14105021211 0016011 0 ustar 00root root 0000000 0000000 --- install: - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - gem install bundler -v '< 2.0' - bundle install before_test: - ruby -v - gem -v - bundle -v build: off test_script: - bundle exec rake ci environment: matrix: - ruby_version: "200" - ruby_version: "200-x64" - ruby_version: "21" - ruby_version: "21-x64" - ruby_version: "22" - ruby_version: "22-x64" - ruby_version: "23" - ruby_version: "23-x64" - ruby_version: "24" - ruby_version: "24-x64" - ruby_version: "25" - ruby_version: "25-x64" - ruby_version: "26" - ruby_version: "26-x64" tty-which-0.5.0/lib/ 0000775 0000000 0000000 00000000000 14105021211 0014165 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/lib/tty-which.rb 0000664 0000000 0000000 00000000074 14105021211 0016433 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true require_relative "tty/which" tty-which-0.5.0/lib/tty/ 0000775 0000000 0000000 00000000000 14105021211 0015005 5 ustar 00root root 0000000 0000000 tty-which-0.5.0/lib/tty/which.rb 0000664 0000000 0000000 00000010515 14105021211 0016436 0 ustar 00root root 0000000 0000000 # frozen_string_literal: true require_relative "which/version" module TTY # A class responsible for finding an executable in the PATH module Which # Find an executable in a platform independent way # # @param [String] cmd # the command to search for # @param [Array