cliver 0.1.1 → 0.1.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.
@@ -0,0 +1,16 @@
1
+ ---
2
+ language: ruby
3
+ before_install: "gem install bundler"
4
+ script: "bundle exec rake spec"
5
+ rvm:
6
+ - 2.0.0
7
+ - 1.9.3
8
+ - jruby-19mode # JRuby in 1.9 mode
9
+ - rbx-19mode
10
+ branches:
11
+ only:
12
+ - develop
13
+ - master
14
+ - /^release\/-.*$/
15
+ - /^support\/-.*$/
16
+ - /^hotfix\/-.*$/
data/README.md CHANGED
@@ -54,6 +54,12 @@ end
54
54
  Since `Cliver` uses `Gem::Requirement` for version comparrisons, it obeys all
55
55
  the same rules including pre-release semantics.
56
56
 
57
+ ## Supported Platforms
58
+
59
+ The goal is to have full support for all platforms running ruby >= 1.9.2,
60
+ including rubinius and jruby implementations. Windows has support
61
+ but is not available as a build target in [travis_ci][].
62
+
57
63
  ## See Also:
58
64
 
59
65
  - [YARD Documentation][yard-docs]
@@ -63,3 +69,4 @@ the same rules including pre-release semantics.
63
69
 
64
70
  [rubygems/requirements]: https://github.com/rubygems/rubygems/blob/master/lib/rubygems/requirement.rb
65
71
  [yard-docs]: http://yaauie.github.io/cliver/
72
+ [travis-ci]: https://travis-ci.org/yaauie/cliver
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'open3'
2
+ require 'shellwords'
3
3
 
4
4
  module Cliver
5
5
  # The interface for Cliver::Detector classes.
@@ -28,7 +28,9 @@ module Cliver
28
28
  # @param executable [String] - the path to the executable to test
29
29
  # @return [String] - should be Gem::Version-parsable.
30
30
  def detect_version(executable)
31
- output, _ = Open3.capture2e(*version_command(executable))
31
+ command_parts = version_command(executable)
32
+ escaped_command_parts = command_parts.map(&Shellwords.method(:escape))
33
+ output = `#{escaped_command_parts.join(' ')} 2>&1`
32
34
  ver = output.scan(version_pattern)
33
35
  ver && ver.first
34
36
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Cliver
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- require 'open3'
2
+ require 'shellwords'
4
3
 
5
4
  module Cliver
6
5
  module Which
@@ -10,11 +9,12 @@ module Cliver
10
9
  # @param executable [String]
11
10
  # @return [nil,String] - path to found executable
12
11
  def which(executable)
13
- # command -v is the POSIX-specified implementation behind which.
14
- # http://pubs.opengroup.org/onlinepubs/009695299/utilities/command.html
15
- which, status = Open3.capture2e('command', '-v', executable)
16
- return nil unless status.success?
17
- which.chomp
12
+ which = `which #{Shellwords.escape executable} 2>&1`
13
+ executable_path = which.chomp
14
+ return nil if executable_path.empty?
15
+ executable_path
16
+ rescue Errno::ENOENT
17
+ raise '"which" must be on your path to use Cliver on this system.'
18
18
  end
19
19
  end
20
20
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
-
3
- require 'open3'
2
+ require 'shellwords'
4
3
 
5
4
  module Cliver
6
5
  module Which
@@ -12,11 +11,13 @@ module Cliver
12
11
  def which(executable)
13
12
  # `where` returns newline-separated files found on path, but doesn't
14
13
  # ensure that they are executable as commands.
15
- where, _ = Open3.capture2e('where', executable)
14
+ where = `where #{Shellwords.escape executable} 2>&1`
16
15
  where.split("\n").find do |found|
17
16
  next if found.empty?
18
17
  File.executable?(found)
19
18
  end
19
+ rescue Errno::ENOENT
20
+ raise '"where" must be on your path to use Cliver on Windows.'
20
21
  end
21
22
  end
22
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -116,6 +116,7 @@ extra_rdoc_files: []
116
116
  files:
117
117
  - .githooks/pre-commit/ruby-appraiser
118
118
  - .gitignore
119
+ - .travis.yml
119
120
  - CONTRIBUTING.md
120
121
  - Gemfile
121
122
  - LICENSE.txt