Skip to content

Instantly share code, notes, and snippets.

@kelvinst
Created December 11, 2014 20:57
Show Gist options
  • Select an option

  • Save kelvinst/7c1b53e28e7a6168c2fb to your computer and use it in GitHub Desktop.

Select an option

Save kelvinst/7c1b53e28e7a6168c2fb to your computer and use it in GitHub Desktop.

Revisions

  1. kelvinst revised this gist Dec 11, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ruby-cli-deps.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ O projeto é este: [https://github.com/yaauie/cliver](https://github.com/yaauie/

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

    ```
    ```ruby
    # no version requirements
    Cliver.detect('subl')
    # => '/Users/yaauie/.bin/subl'
  2. kelvinst created this gist Dec 11, 2014.
    41 changes: 41 additions & 0 deletions ruby-cli-deps.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    # 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](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.