Skip to content

Instantly share code, notes, and snippets.

@kelvinst
Created December 11, 2014 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelvinst/7c1b53e28e7a6168c2fb to your computer and use it in GitHub Desktop.
Save kelvinst/7c1b53e28e7a6168c2fb to your computer and use it in GitHub Desktop.
Controlando suas dependências de command line tools no ruby

Controlando suas dependências de command line tools no ruby

Nesse post gostaria de compartilhar sobre um projeto bem interessante.

Quando vi essa gem, achei bem interessante... Se todo mundo usasse teríamos mensagens mais claras que qual lib que está faltando para rodar a gem...

Exemplo? O poltergeist (que é a gem para executar ) obviamente depende do phantom.js. Mas quando você instala ele e não tem phantom instalado, ocorre uma mensagem bem pouco diagnosticável. Com essa gem os nossos problemas acabaram!

O projeto é este: https://github.com/yaauie/cliver.

Segundo a própria documentação, é bem fácil usar:

# no version requirements
Cliver.detect('subl')
# => '/Users/yaauie/.bin/subl'

# one version requirement
Cliver.detect('bzip2', '~> 1.0.6')
# => '/usr/bin/bzip2'

# many version requirements
Cliver.detect('racc', '>= 1.0', '< 1.4.9')
# => '/Users/yaauie/.rbenv/versions/1.9.3-p194/bin/racc'

# dependency not met
Cliver.detect('racc', '~> 10.4.9')
# => nil

# detect! raises Cliver::Dependency::NotMet exceptions when the dependency
# cannot be met.
Cliver.detect!('ruby', '1.8.5')
#  Cliver::Dependency::VersionMismatch
#    Could not find an executable ruby that matched the
#    requirements '1.8.5'. Found versions were {'/usr/bin/ruby'=> '1.8.7'}
Cliver.detect!('asdfasdf')
#  Cliver::Dependency::NotFound
#    Could not find an executable asdfasdf on your path

Espero que seja útil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment