tty-which 0.4.1 → 0.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28bb6c00cc9d895af4e45eff2515742d885e9802a818f4284e86d62e58349f7b
4
- data.tar.gz: ca9edb0dcddcbe41a82c1051fc32d042bf7884cb110aed9587d5f53ba82bf8bc
3
+ metadata.gz: f0c9e4e31be53ac50bc5cae7cb0ada9335ddd14ae698f41f646584181e799cd8
4
+ data.tar.gz: bfec7279db13dc7ed6c19ce3043a19efa8c1ea30d9d61eb23f48f15a8e2298b9
5
5
  SHA512:
6
- metadata.gz: 699c7e3f38c4224c208d10a3606ec55225b1f5090aad687b5703d05eb34e71adf85f69762e33e34f171a0083559788d939a96110c8ac09624d23cf402492dca1
7
- data.tar.gz: 81e2585a49a45366df93ff57b7e2f38ea8adeb0b1086ac39c00fb4b2b3b5ffa889b900a8d25d627e6e0b9b1b27ab028d6e6acf7828772cfd6d31a8159bb91554
6
+ metadata.gz: 8842d553c6dae6e17eb10eb2fde70910664b1065f99743f67797f743ae5170d42a2aa3b73f3e77ebd3e4ae376fbb4c7f8bf162e9c90dc9993eebb6a8cfca83ee
7
+ data.tar.gz: a8b6d035ddf86104de1847365c01a0e8128944e1aa862314b1807e3028bcf097b38426ed0a5b01a491cf955a414dac55f7e9c4bc82cbec42e3abe2aed202a34f
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.4.2] - 2020-01-20
4
+
5
+ ### Changed
6
+ * Change gemspec to add metadata and remove test artifacts
7
+
3
8
  ## [v0.4.1] - 2019-06-02
4
9
 
5
10
  ### Changed
@@ -50,6 +55,7 @@
50
55
 
51
56
  * Initial implementation and release
52
57
 
58
+ [v0.4.2]: https://github.com/piotrmurach/tty-which/compare/v0.4.1...v0.4.2
53
59
  [v0.4.1]: https://github.com/piotrmurach/tty-which/compare/v0.4.0...v0.4.1
54
60
  [v0.4.0]: https://github.com/piotrmurach/tty-which/compare/v0.3.0...v0.4.0
55
61
  [v0.3.0]: https://github.com/piotrmurach/tty-which/compare/v0.2.2...v0.3.0
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Which
5
- VERSION = "0.4.1"
5
+ VERSION = "0.4.2"
6
6
  end # Which
7
7
  end # TTY
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-which
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-02 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,33 +54,28 @@ dependencies:
54
54
  version: '0'
55
55
  description: Platform independent implementation of Unix which command.
56
56
  email:
57
- - me@piotrmurach.com
57
+ - piotr@piotrmurach.com
58
58
  executables: []
59
59
  extensions: []
60
- extra_rdoc_files: []
60
+ extra_rdoc_files:
61
+ - README.md
61
62
  files:
62
63
  - CHANGELOG.md
63
64
  - LICENSE.txt
64
65
  - README.md
65
- - Rakefile
66
66
  - lib/tty-which.rb
67
67
  - lib/tty/which.rb
68
68
  - lib/tty/which/version.rb
69
- - spec/spec_helper.rb
70
- - spec/unit/executable_file_spec.rb
71
- - spec/unit/exist_spec.rb
72
- - spec/unit/extensions_spec.rb
73
- - spec/unit/file_with_exec_ext_spec.rb
74
- - spec/unit/search_paths_spec.rb
75
- - spec/unit/which_spec.rb
76
- - tasks/console.rake
77
- - tasks/coverage.rake
78
- - tasks/spec.rake
79
- - tty-which.gemspec
80
- homepage: http://piotrmurach.github.io/tty/
69
+ homepage: https://ttytoolkit.org
81
70
  licenses:
82
71
  - MIT
83
- metadata: {}
72
+ metadata:
73
+ allowed_push_host: https://rubygems.org
74
+ bug_tracker_uri: https://github.com/piotrmurach/tty-which/issues
75
+ changelog_uri: https://github.com/piotrmurach/tty-which/blob/master/CHANGELOG.md
76
+ documentation_uri: https://www.rubydoc.info/gems/tty-which
77
+ homepage_uri: https://ttytoolkit.org
78
+ source_code_uri: https://github.com/piotrmurach/tty-which
84
79
  post_install_message:
85
80
  rdoc_options: []
86
81
  require_paths:
@@ -96,15 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
91
  - !ruby/object:Gem::Version
97
92
  version: '0'
98
93
  requirements: []
99
- rubygems_version: 3.0.3
94
+ rubygems_version: 3.1.2
100
95
  signing_key:
101
96
  specification_version: 4
102
97
  summary: Platform independent implementation of Unix which command.
103
- test_files:
104
- - spec/spec_helper.rb
105
- - spec/unit/executable_file_spec.rb
106
- - spec/unit/exist_spec.rb
107
- - spec/unit/extensions_spec.rb
108
- - spec/unit/file_with_exec_ext_spec.rb
109
- - spec/unit/search_paths_spec.rb
110
- - spec/unit/which_spec.rb
98
+ test_files: []
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- FileList['tasks/**/*.rake'].each(&method(:import))
4
-
5
- desc 'Run all specs'
6
- task ci: %w[ spec ]
7
-
8
- task default: :spec
@@ -1,45 +0,0 @@
1
- # coding: utf-8
2
-
3
- if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
4
- require 'simplecov'
5
- require 'coveralls'
6
-
7
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
8
- SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter
10
- ]
11
-
12
- SimpleCov.start do
13
- command_name 'spec'
14
- add_filter 'spec'
15
- end
16
- end
17
-
18
- require 'tty-which'
19
-
20
- RSpec.configure do |config|
21
- config.expect_with :rspec do |expectations|
22
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
23
- end
24
-
25
- config.mock_with :rspec do |mocks|
26
- mocks.verify_partial_doubles = true
27
- end
28
-
29
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
30
- config.disable_monkey_patching!
31
-
32
- # This setting enables warnings. It's recommended, but in some cases may
33
- # be too noisy due to issues in dependencies.
34
- config.warnings = true
35
-
36
- if config.files_to_run.one?
37
- config.default_formatter = 'doc'
38
- end
39
-
40
- config.profile_examples = 2
41
-
42
- config.order = :random
43
-
44
- Kernel.srand config.seed
45
- end
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
-
3
- RSpec.describe TTY::Which, '#executable_file?' do
4
- it "checks if file is executable" do
5
- allow(::File).to receive(:join).with('/usr/local/bin', 'ruby').
6
- and_return('/usr/local/bin/ruby')
7
-
8
- allow(::File).to receive(:file?).and_return(true)
9
- allow(::File).to receive(:executable?).with('/usr/local/bin/ruby').and_return(true)
10
-
11
- expect(TTY::Which.executable_file?('ruby', '/usr/local/bin')).to eq(true)
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal
2
-
3
- RSpec.describe TTY::Which, '#exist?' do
4
- it "finds executable in the path" do
5
- allow(TTY::Which).to receive(:which).with('ruby', a_hash_including(:paths)).
6
- and_return('/usr/loca/bin/ruby')
7
-
8
- expect(TTY::Which.exist?('ruby')).to be(true)
9
- end
10
-
11
- it "fails to find executable in the path" do
12
- allow(TTY::Which).to receive(:which).with('ruby', a_hash_including(:paths)).and_return(nil)
13
-
14
- expect(TTY::Which.exist?('ruby')).to be(false)
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Which, '#extensions' do
4
- it "provides extensions" do
5
- exts = [".COM", ".EXE", ".BAT", ".CMD", ".VBS", ".RB", ".RBW"]
6
- exts_path = exts.join(::File::PATH_SEPARATOR)
7
- allow(ENV).to receive(:[]).with('PATHEXT').and_return(exts_path)
8
-
9
- expect(TTY::Which.extensions).to eq(exts)
10
- end
11
-
12
- it "finds no extensions" do
13
- allow(ENV).to receive(:[]).with('PATHEXT').and_return(nil)
14
- expect(TTY::Which.extensions).to eq([''])
15
- end
16
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Which, "#file_with_exec_ext?" do
4
- it "detects executable extension" do
5
- filename = 'file.exe'
6
- allow(TTY::Which).to receive(:extensions).and_return(['.EXE', '.BAT', '.CMD'])
7
-
8
- expect(TTY::Which.file_with_exec_ext?(filename)).to eq(true)
9
- end
10
-
11
- it "fails to detect executable extension" do
12
- filename = 'file.unknown'
13
- allow(TTY::Which).to receive(:extensions).and_return(['.EXE', '.BAT'])
14
-
15
- expect(TTY::Which.file_with_exec_ext?(filename)).to eq(false)
16
- end
17
- end
18
-
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Which, '#search_paths' do
4
- it "defauls search paths" do
5
- allow(ENV).to receive(:[]).with('PATH').and_return([])
6
- allow(Dir).to receive(:exist?).and_return(true)
7
-
8
- expect(TTY::Which.search_paths).to eq([
9
- '/usr/local/bin', '/usr/ucb', '/usr/bin', '/bin'])
10
- end
11
-
12
- it "finds paths in path environment" do
13
- paths = ['/bin', '/usr/bin', '/usr/local/bin', '/opt/local/bin']
14
- path = paths.join(::File::PATH_SEPARATOR)
15
- allow(ENV).to receive(:[]).with('PATH').and_return(path)
16
- allow(Dir).to receive(:exist?).and_return(true)
17
-
18
- expect(TTY::Which.search_paths).to eq(paths)
19
- end
20
-
21
- it "accepts paths to search as an argument" do
22
- paths = ['/bin', '/usr/bin', '/usr/local/bin', '/opt/local/bin']
23
- path = paths.join(::File::PATH_SEPARATOR)
24
- allow(Dir).to receive(:exist?).and_return(true)
25
-
26
- expect(TTY::Which.search_paths(path)).to eq(paths)
27
- end
28
- end
@@ -1,126 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe TTY::Which, '#which' do
4
-
5
- before { stub_const("Which", described_class) }
6
-
7
- context "without extension" do
8
- let(:path) { "/bin:/usr/bin:/usr/local/bin:/opt/local/bin" }
9
- let(:cmds) { %w(/usr/bin/ls /bin/sh /usr/bin/ruby /usr/local/git/bin/git) }
10
-
11
- before do
12
- allow(ENV).to receive(:[]).with('PATHEXT').and_return(nil)
13
- allow(ENV).to receive(:[]).with('PATH').and_return(path)
14
- stub_const("::File::PATH_SEPARATOR", ':')
15
- stub_const("::File::SEPARATOR", '/')
16
- allow(Dir).to receive(:exist?) { true }
17
- end
18
-
19
- it "handles path with executable file /bin/sh" do
20
- allow(Which).to receive(:file_with_path?) { true }
21
- allow(Which).to receive(:executable_file?) { true }
22
-
23
- expect(Which.which('/bin/sh')).to eq('/bin/sh')
24
- end
25
-
26
- it "fails to find path executable" do
27
- allow(Which).to receive(:file_with_path?) { true }
28
- allow(Which).to receive(:executable_file?) { false }
29
-
30
- expect(Which.which('/bin/sh')).to eq(nil)
31
- end
32
-
33
- it "searches executable file git" do
34
- dir_path = "/usr/local/bin"
35
- cmd = "git"
36
- expected_path = "#{dir_path}/#{cmd}"
37
- allow(Which).to receive(:file_with_path?) { false }
38
- allow(Which).to receive(:file_with_exec_ext?) { false }
39
-
40
- allow(::File).to receive(:join)
41
- allow(::File).to receive(:join).with(dir_path, cmd).and_return(expected_path)
42
- allow(Which).to receive(:executable_file?) { false }
43
- allow(Which).to receive(:executable_file?).with(expected_path) { true }
44
- allow(::File).to receive(:absolute_path).with(expected_path).
45
- and_return(expected_path)
46
-
47
- expect(Which.which(cmd)).to eq(expected_path)
48
- end
49
-
50
- it "allows to search through custom paths" do
51
- paths = %w(/usr/local/bin /usr/bin /bin)
52
- allow(Which).to receive(:executable_file?).with('/usr/local/bin/ruby') { false }
53
- allow(Which).to receive(:executable_file?).with('/usr/bin/ruby') { true }
54
- allow(::File).to receive(:absolute_path).with('/usr/bin/ruby').and_return('/usr/bin/ruby')
55
-
56
- expect(TTY::Which.which('ruby', paths: paths)).to eq('/usr/bin/ruby')
57
- end
58
- end
59
-
60
- context "with extension" do
61
- let(:path) { "C:\\Program Files\\Git\\bin;" }
62
- let(:exts) { ".com;.exe;.bat;.cmd" }
63
-
64
- before do
65
- allow(ENV).to receive(:[]).with('PATHEXT').and_return(exts)
66
- allow(ENV).to receive(:[]).with('PATH').and_return(path)
67
- stub_const("::File::PATH_SEPARATOR", ';')
68
- stub_const("::File::SEPARATOR", '\\')
69
- allow(Dir).to receive(:exist?) { true }
70
- end
71
-
72
- it "handles path with executable file C:\\Program Files\\Git\\bin\\git" do
73
- allow(Which).to receive(:file_with_path?) { true }
74
- allow(Which).to receive(:executable_file?).with(any_args) { false }
75
-
76
- path_with_exe_file = 'C:\Program Files\Git\bin\git'
77
- expected_path = "#{path_with_exe_file}.exe"
78
-
79
- allow(::File).to receive(:join).with(path_with_exe_file, any_args).
80
- and_return(path_with_exe_file)
81
- allow(::File).to receive(:join).with(path_with_exe_file, '.exe').
82
- and_return(expected_path)
83
- allow(Which).to receive(:executable_file?).with(expected_path) { true }
84
- allow(::File).to receive(:absolute_path).and_return(expected_path)
85
-
86
- expect(Which.which(path_with_exe_file)).to eq(expected_path)
87
- end
88
-
89
- it "searches path for executable git.exe" do
90
- dir_path = "C:\\Program Files\\Git\\bin"
91
- cmd = 'git.exe'
92
- expected_path = "#{dir_path}\\#{cmd}"
93
- allow(Which).to receive(:file_with_path?) { false }
94
- allow(Which).to receive(:file_with_exec_ext?).with(cmd) { true }
95
-
96
- allow(::File).to receive(:join).with(dir_path, any_args)
97
- allow(::File).to receive(:join).with(dir_path, cmd).and_return(expected_path)
98
- allow(Which).to receive(:executable_file?).with(any_args) { false }
99
- allow(Which).to receive(:executable_file?).with(expected_path) { true }
100
- allow(::File).to receive(:absolute_path).with(expected_path).
101
- and_return(expected_path)
102
-
103
- expect(Which.which(cmd)).to eq(expected_path)
104
- expect(::File).to have_received(:absolute_path).with(expected_path)
105
- end
106
-
107
- it "searches path for executable git" do
108
- dir_path = "C:\\Program Files\\Git\\bin"
109
- cmd = 'git'
110
- expected_path = "#{dir_path}\\#{cmd}.exe"
111
- allow(Which).to receive(:file_with_path?) { false }
112
- allow(Which).to receive(:file_with_exec_ext?).with(cmd) { false }
113
-
114
- allow(::File).to receive(:join).with(dir_path, any_args)
115
- allow(::File).to receive(:join).with(dir_path, "#{cmd}.exe").
116
- and_return(expected_path)
117
- allow(Which).to receive(:executable_file?).with(any_args) { false }
118
- allow(Which).to receive(:executable_file?).with(expected_path) { true }
119
- allow(::File).to receive(:absolute_path).with(expected_path).
120
- and_return(expected_path)
121
-
122
- expect(Which.which(cmd)).to eq(expected_path)
123
- expect(::File).to have_received(:absolute_path).with(expected_path)
124
- end
125
- end
126
- end
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Load gem inside irb console'
4
- task :console do
5
- require 'irb'
6
- require 'irb/completion'
7
- require File.join(__FILE__, '../../lib/tty-which')
8
- ARGV.clear
9
- IRB.start
10
- end
11
- task c: %w[ console ]
@@ -1,11 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc 'Measure code coverage'
4
- task :coverage do
5
- begin
6
- original, ENV['COVERAGE'] = ENV['COVERAGE'], 'true'
7
- Rake::Task['spec'].invoke
8
- ensure
9
- ENV['COVERAGE'] = original
10
- end
11
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- begin
4
- require 'rspec/core/rake_task'
5
-
6
- desc 'Run all specs'
7
- RSpec::Core::RakeTask.new(:spec) do |task|
8
- task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
9
- end
10
-
11
- namespace :spec do
12
- desc 'Run unit specs'
13
- RSpec::Core::RakeTask.new(:unit) do |task|
14
- task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
15
- end
16
-
17
- desc 'Run integration specs'
18
- RSpec::Core::RakeTask.new(:integration) do |task|
19
- task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
20
- end
21
- end
22
-
23
- rescue LoadError
24
- %w[spec spec:unit spec:integration].each do |name|
25
- task name do
26
- $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
- end
28
- end
29
- end
@@ -1,27 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'tty/which/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "tty-which"
7
- spec.version = TTY::Which::VERSION
8
- spec.authors = ["Piotr Murach"]
9
- spec.email = ["me@piotrmurach.com"]
10
- spec.summary = %q{Platform independent implementation of Unix which command.}
11
- spec.description = %q{Platform independent implementation of Unix which command.}
12
- spec.homepage = "http://piotrmurach.github.io/tty/"
13
- spec.license = "MIT"
14
-
15
- spec.files = Dir['{lib,spec}/**/*.rb']
16
- spec.files += Dir['tasks/*', 'tty-which.gemspec']
17
- spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(spec)/})
20
- spec.require_paths = ["lib"]
21
-
22
- spec.required_ruby_version = '>= 2.0.0'
23
-
24
- spec.add_development_dependency 'bundler', '>= 1.5.0'
25
- spec.add_development_dependency 'rspec', '~> 3.1'
26
- spec.add_development_dependency 'rake'
27
- end