whiches 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmRjMDJlMTNhMTBjYzVjZDUwOWY4YjM3Zjg3MTlhMWFlMTJlYTUzNA==
5
+ data.tar.gz: !binary |-
6
+ MzE5ZDE3ZDkzNzAwZWM3OGZlYTAyMDk2NjEyNTM0N2RiYzUzNDk1NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NDRkZTU0NjJmYmQ3MjQxMzEzMDlhYTY2ZWE2NzIyY2U4MGE4YTNjNTQ5Yzhk
10
+ ZTIyMWE4ZGVkNjIxYjdiMmVjMzUxMWMxNzcwMTBiMzBkOGIwYTkzMzI5OTQ5
11
+ YmNiMzg5NDFjOTI5ODQ3NWU3ZjlhMzgxNjI1ZWEzNjU0NTRlNTM=
12
+ data.tar.gz: !binary |-
13
+ OGFkODg1OGVjNTIyZTA2ZDU1MWIyNDgwMzU3ZjBjNDhiODNkMzRkMDhlNmZi
14
+ YzZkOGM4NmMyNWE1MDY2MWJlMWU5MTQyMzEwMThmYmFhZDFjNTYwNDdhYmJm
15
+ NWY0NWIzOGZjMDhlYThhZTJjN2Q0ODhkYjExM2IyZDMzNzljMDA=
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in whiches.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Alain Achkar
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,68 @@
1
+ # Whiches
2
+
3
+ Find executables in all the paths in $PATH.
4
+
5
+ Cross-platform way of finding executables in all the paths in $PATH.
6
+
7
+ This is similar to the Unix 'which' command, however, instead of finding the first
8
+ occurence of the executable in $PATH, it finds all occurences in $PATH. This could be useful if you installed something that modified your PATH and now you're executing a different version but can't figure out what happened.
9
+
10
+ Example:
11
+
12
+ On OS X, OpenSSL is installed in /usr/bin/openssl
13
+
14
+ % which openssl
15
+ ==> /usr/bin/openssl
16
+
17
+ After installing PostgreSQL:
18
+
19
+ % which openssl
20
+ ==> /Applications/Postgres.app/Contents/MacOS/bin/openssl
21
+
22
+ If you're trying to diagnose what happened, you can use:
23
+
24
+ % whiches openssl
25
+ ==>
26
+ [
27
+ [0] "/Applications/Postgres.app/Contents/MacOS/bin/openssl",
28
+ [1] "/usr/bin/openssl"
29
+ ]
30
+
31
+ This will show you that the first one that is found in the PATH is the one from Postgres, so if you want to get back your original one, you have to modify your PATH accordingly.
32
+
33
+ ## URL
34
+ <https://github.com/simplytech/whiches>
35
+
36
+ ## Installation
37
+
38
+ Add this line to your application's Gemfile:
39
+
40
+ gem 'whiches'
41
+
42
+ And then execute:
43
+
44
+ $ bundle
45
+
46
+ Or install it yourself as:
47
+
48
+ $ gem install whiches
49
+
50
+ ## Usage
51
+
52
+ whiches [executables]
53
+
54
+ ## License
55
+
56
+ Copyright (c) 2013 Alain Achkar
57
+
58
+ MIT License
59
+
60
+ See the LICENSE file in the source code.
61
+
62
+ ## Contributing
63
+
64
+ 1. Fork it
65
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
66
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
67
+ 4. Push to the branch (`git push origin my-new-feature`)
68
+ 5. Create new Pull Request
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Cross-platform way of finding an executable in all the paths in $PATH.
4
+
5
+ require 'awesome_print'
6
+ require 'whiches'
7
+
8
+ ARGV.each do |exe|
9
+ ap Whiches.whiches(exe)
10
+ end
11
+
12
+ # ap Whiches.whiches('ruby')
13
+
14
+ # Whiches.whiches('ruby').each do |l|
15
+ # puts l
16
+ # end
17
+
@@ -0,0 +1,20 @@
1
+ require "whiches/version"
2
+
3
+ module Whiches
4
+ def Whiches.whiches(cmd)
5
+ exes = []
6
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
7
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
8
+ exts.each { |ext|
9
+ exe = File.join(path, "#{cmd}#{ext}")
10
+ exes << exe if File.executable? exe
11
+ }
12
+ end
13
+
14
+ if exes == []
15
+ return nil
16
+ else
17
+ return exes
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module Whiches
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/whiches/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Alain Achkar"]
6
+ gem.email = ["aa@simplytech.com"]
7
+
8
+ gem.summary = 'Find executables in all the paths in $PATH.'
9
+ gem.description = <<-EOF
10
+ Cross-platform way of finding executables in all the paths in $PATH.
11
+
12
+ This is similar to the Unix 'which' command, however, instead of finding the first
13
+ occurence of the executable in $PATH, it finds all occurences in $PATH.
14
+ This could be useful if you installed something that modified your PATH and now you're
15
+ executing a different version but can't figure out what happened.
16
+ Example:
17
+ On OS X, OpenSSL is installed in /usr/bin/openssl
18
+ % which openssl
19
+ ==> /usr/bin/openssl
20
+ After installing PostgreSQL:
21
+ % which openssl
22
+ ==> /Applications/Postgres.app/Contents/MacOS/bin/openssl
23
+ If you're trying to diagnose what happened, you can use:
24
+ % whiches openssl
25
+ ==>
26
+ [
27
+ [0] "/Applications/Postgres.app/Contents/MacOS/bin/openssl",
28
+ [1] "/usr/bin/openssl"
29
+ ]
30
+ This will show you that the first one that is found in the PATH is the one from Postgres,
31
+ so if you want to get back your original one, you have to modify your PATH accordingly.
32
+ EOF
33
+ gem.homepage = "https://github.com/simplytech/whiches"
34
+
35
+ gem.files = `git ls-files`.split($\)
36
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
37
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
38
+ gem.name = "whiches"
39
+ gem.require_paths = ["lib"]
40
+ gem.version = Whiches::VERSION
41
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: whiches
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alain Achkar
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: ! " Cross-platform way of finding executables in all the paths in
14
+ $PATH.\n \n This is similar to the Unix 'which' command, however, instead
15
+ of finding the first\n occurence of the executable in $PATH, it finds all occurences
16
+ in $PATH.\n This could be useful if you installed something that modified your
17
+ PATH and now you're\n executing a different version but can't figure out what
18
+ happened.\n Example:\n On OS X, OpenSSL is installed in /usr/bin/openssl\n
19
+ \ % which openssl\n ==> /usr/bin/openssl\n After installing PostgreSQL:\n
20
+ \ % which openssl\n ==> /Applications/Postgres.app/Contents/MacOS/bin/openssl\n
21
+ \ If you're trying to diagnose what happened, you can use:\n % whiches openssl\n
22
+ \ ==>\n [\n [0] \"/Applications/Postgres.app/Contents/MacOS/bin/openssl\",\n
23
+ \ [1] \"/usr/bin/openssl\"\n ] \n This will show you that the first
24
+ one that is found in the PATH is the one from Postgres,\n so if you want to get
25
+ back your original one, you have to modify your PATH accordingly. \n"
26
+ email:
27
+ - aa@simplytech.com
28
+ executables:
29
+ - whiches
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - Gemfile
35
+ - LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - bin/whiches
39
+ - lib/whiches.rb
40
+ - lib/whiches/version.rb
41
+ - whiches.gemspec
42
+ homepage: https://github.com/simplytech/whiches
43
+ licenses: []
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.0.3
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Find executables in all the paths in $PATH.
65
+ test_files: []