Giter VIP home page Giter VIP logo

cliver's People

Contributors

hsbt avatar miyucy avatar route avatar yaauie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cliver's Issues

break version detection out & make it simpler

The current method of supplying version-detection is somewhat cumbersome with its Regexps and capture groups. Make it less sucky.

Current thoughts:

  • Supplied detector should respond to #to_proc, with argument of the executable name, and return a string, dot-separated version number.
  • supply some default detectors for the most common patterns.
  • supply a generator that takes argument, regexp-with-capture-groups to keep that interface.

Favor matchier versions...

Since the current version matcher pattern prettymuch matches numbers in general, let's favor things that match more of the cues (e.g., if it is prefixed with version, or is composed of several parts that are dot-separated).

Please feel free to supply STDOUT and STDERR for your app's --version output, along with the expected match version so I can add tests to ensure.

Can't verify on Windows with space in pathname

Using Go, installed at C:\Program Files (x86)\Go Agent..., when I put the binary for PhantomJS in the working folder (C:\Program Files (x86)\Go Agent\pipelines\my_project...) clover can not properly deduce the version.

Escaping the spaces on the path doesn't help. When I quote the executable_path then I wind up with an EACCES error. I've been unable to patch the issue or I'd simply post a PR.

Original error:

Could not find an executable at given path 'C:\Program Files (x86)\Go Agent\pipelines\Local_Scenarios\features\support\phantomjs.EXE'.If this path was not specified explicitly, it is probably a bug in Cliver. (Cliver::Dependency::NotFound)

Quoting executable_path:

def detect_version(executable_path)
      executable_path = "#\"{executable_path}\"" unless executable_path.index(" ").nil?
          ...
end

error: Permission denied - "C:/Program\ Files\ (x86)/Go\ Agent/pipelines/Local_Scenarios/features/support/phantomjs.EXE" --version (Errno::EACCES)

Clivefile & cliver executable

Create a Clivefile format & pair it with a cliver executable that executes the underlying command with a matching executable.

Example:

Cliver::Specification.new do
  add_dependency 'python', '~> 2.0', as: 'py2'
  add_dependency 'pygments', '~ >7.8', '>= 7.8.1'
end

Usage:
Locates appropriate executable, then replaces self process with it and all given arguments. Possible opportunity for Clivefile.lock file for optimization here, but you know, cache invalidation.

$ cliver pygments -i foo.txt -f

Windows vs. Absolute Path

See teampoltergeist/poltergeist#389

irb(main):002:0> require 'cliver'
# => true
irb(main):003:0> Cliver.detect('notepad')
# => "C:/Windows/system32/notepad.exe"
irb(main):004:0> Cliver.detect('C:/Windows/system32/notepad.exe')
# => nil
irb(main):005:0> Cliver.detect('C:\Windows\system32\notepad.exe')
# => nil
irb(main):006:0> Cliver.detect('/C/Windows/system32/notepad.exe')
# => nil

Cliver unable to detect PhantamJS version on Windows machine

I'm trying to run tests using Poltergeist on a windows machine. When running the tests, I encounter the error below, which is trying to find the Node installation. It also fails when trying to find the Windows distribution as well.

Cliver::Dependency::NotFound: Could not find an executable at given path 'C:/.../bin/phantomjs.CMD'. If this path was not specified explicitly, it is probably a bug in [Cliver] (https://github.com/yaauie/cliver/issues).

occurred at C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/cliver-0.3.2/lib/cliver/detector.rb:45:in `detect_version'

Symlink detected as a exec

With the following setup:

> ls -la /opt/hello/bin
total 0
drwxr-xr-x  2 root  root   68 Aug 29 10:16 ./
drwxr-xr-x  4 root  root  136 Aug 29 10:16 ../
-rwxr-xr-x  1 root  root    0 Aug 29 10:17 hello

and

lrwxrwxrwx 1 root root 28 Apr 16  2013 /usr/local/bin/hello -> /opt/hello

Cliver detects the symlink /usr/local/bin/hello as my hello exectuable

EDIT: the relevant part of my $PATH is /usr/local/bin/hello/bin:/usr/local/bin

Ignore STDERR on version detection

In
https://github.com/yaauie/cliver/blob/develop/lib/cliver/detector.rb#L89
STDERR is redirected to STDOUT and also used for the version detection. This causes problems for me.

Some gem tries to find out the version of phantomjs. It's version output looks like this:

$ phantomjs --version
STDERR: Fontconfig error: "local.conf", line 18: invalid attribute 'target'
STDOUT: 1.8.1

Cliver reports that phantomjs version 18 is installed.

Two possible solutions:

  • Ignore STDERR
  • Evaluate the two output streams separately and prefer the result from STDOUT

If you tell me which of the solutions you favor, I'll provide you with a pull request for it.

ArgumentError with constants

Cliver.detect! appears to fail when passed a constant.

module TestModule

    CMD = 'gpsbabel'

    def self.test

        # Works
        Cliver.detect!('gpsbabel')

        # ArgumentError:
        #   Relative-path executable requirements are not supported.
        Cliver.detect!(CMD)

    end
end

Some systems failing to resolve version?

@mschuerig opened teampoltergeist/poltergeist#415 with the following:


Here's what I get:

irb(main):009:0> phantomjs_path = Cliver.detect('phantomjs', '~> 1.8', '>= 1.8.1')
=> nil
irb(main):010:0> phantomjs_path = Cliver.detect('phantomjs', '~> 1.8')
=> nil
irb(main):011:0> phantomjs_path = Cliver.detect('phantomjs', '>= 1.8.1')
=> "/usr/bin/phantomjs"
irb(main):012:0> `#{phantomjs_path} --version`.chomp
=> "1.9.0"

Also of interest:

irb(main):013:0> Cliver::VERSION
=> "0.2.2"
irb(main):016:0> RUBY_DESCRIPTION
=> "ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]"

The system is a current Debian unstable/sid with phantomjs package 1.9.0-1.


I cannot repro this in 0.2.2 or the current 0.3.1:

 phantomjs_path = Cliver.detect!('phantomjs', '~>1.8', '>=1.8.1')
# => "/usr/local/bin/phantomjs"
`#{phantomjs_path} --version`.chomp
# => "1.9.0"

@mschuerig can you try the Cliver.detect! method? It'll raise an informative exception when the dependency cannot be met.

Add Cliver::detect

WIP notes

Sometimes just making sure that the first executable on your path is the right version isn't enough; we should be able to look for an executable that satisfies the requirements, not just make sure that the first one on the path is ok. A perfect example of this is python, with the 2/3 split, where many users must have both installed.

The interface should be pretty similar to the existing Cliver::assert, but should have an explicit return value of the full path to the executable. If no appropriate executable can be detected, this will raise like Cliver::assert does, except that the message needs to have information about many found-and-not-good-enough binaries.

executable_path = Cliver::detect(executable, *requirements, options = {})

npm phantomjs-prebuilt: "failed to detect theversion" on ubuntu hiding source error

I am using docker for my CI, and running cucumber inside the ubuntu container is failing to find phantomjs version that was installed with npm.

cliver: /var/lib/gems/2.3.0/gems/cliver-0.3.2/lib/cliver.rb

The detector #<struct Cliver::Detector command_arg=nil, version_pattern=nil> failed to detect theversion of the executable at '/app/node_modules/phantomjs-prebuilt/bin/phantomjs'

I'm using phantomjs-prebuilt:

root@5036dec3f7b6:/app# npm ls phantomjs-prebuilt
[email protected] /app
+-- [email protected] 

It seems my environment wasn't properly setup with libfontconfig as I couldn't run:

root@6c2f2f7605a3:/app# /app/node_modules/phantomjs-prebuilt/bin/phantomjs --version

After my docker image was fixed with the dependency, I had no problem. Perhaps the error raised could be modified with the underlying stderr so one could more easily see the source of the problem?

Cannot find the PhantomJS.EXE file

Breakout Case of #19 for Windows Machines on Normal Ruby (Issue previously was for JRuby)

When running tests I get the error:

Cliver::Dependency::NotFound: Could not find an executable at given path 'C:/Webdrivers for RubyMine/phantomjs.EXE'.If this path was not specified explicitly, it is probably a bug in [Cliver](https://github.com/yaauie/cliver/issues).
  • This is on a Windows machine (Win7), running Ruby on RubyMine trying to do Automation.
  • All the remedies by elcubo and yauiie have so far not worked. However the Monkeypatch does then allow me to use poltergeist.
  • I only have Cliver 0.3.2 in my Gemfile / .lock

One possible issue is it wants phantomJS to have an upper case .EXE
SYSTEM PATH:

C:\Ruby22\bin

ENV PATH:

C:\ProgramData\Oracle\Java\javapath; 
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;
C:\Program Files (x86)\Skype\Phone\;
C:\Webdrivers for RubyMine\;
C:\Webdrivers;
%android_home%\platform-tools\;
C:\Program Files (x86)\Brackets\command

Luke

check_compatibility! breaks if @executables contains Pathname objects

This is what we encountered:

Poltergeist uses cliver since 1.4.0. We set
poltergeist_options[:phantomjs] =
With a pathname object, leading to a lot of errors:

 NoMethodError: undefined method `[]' for #<Pathname:0x007ff093b69028>
 occurred at /Users/djungowski/.rvm/gems/ruby-2.0.0-p247/gems/cliver-0.3.2/lib/cliver/dependency.rb:71:in `block in check_compatibility!'

This is because the check_compatibility! method expects a string. It would be good if the method either supports the Pathname object (which would be useful) or uses a .to_s

Switch to pure-ruby which (actually windows-like where)

This is a pre-requisite for #2. I may want to also be able to supply a PATH-like string manually instead of relying on ENV['PATH']

    # Analog of Windows `where` command, or a `which` that finds *all*
    # matching executables on the supplied path.
    # @param cmd [String] - the command to find
    # @return [Enumerable<String>] - the executables found, lazily.
    def find_executables(cmd)
      return enum_for(:find_executables, cmd) unless block_given?

      exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
      ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
        exts.each do |ext|
          exe = File.join(path, "#{cmd}#{ext}")
          yield exe if File.executable? exe
        end
      end
    end

Cannot find phantomjs.exe on Windows

While running tests using JRuby, Capybara and Poltergeist, I get the following error:

Cliver::Dependency::NotFound: Could not find an executable at given path 'c:/utils/phantomjs-2.1.1-windows/bin/phantomjs.EXE'.If this path was not specified explicitly, it is probably a bug in [Cliver](https://github.com/yaauie/cliver/issues).

The path to phantomjs.exe is correct and it is also part of my Windows path. Running phantomjs --version from the command prompt returns "2.1.1", so there is no doubt that the exe file is present and working.

Is there some kind of workaround that I can use to get around this problem (if it is indeed a bug, like the error message says)? Is the cause of the bug known, and are there any countermeasures? I'd really appreciate some help, as I am quite stuck.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.