Module: Kuu
- Defined in:
- lib/kuu.rb
Defined Under Namespace
Classes: CliFailed, CliNotFound, Error
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.parse(definition_json, args) ⇒ Object
Parse args against a kuu wire-format definition (JSON string), returning the outcome JSON produced by
kuu parse. -
.run(*args) ⇒ Object
Run kuu-cli with raw arguments, returning stdout on success.
- .version ⇒ Object
Class Method Details
.parse(definition_json, args) ⇒ Object
Parse args against a kuu wire-format definition (JSON string),
returning the outcome JSON produced by kuu parse.
33 34 35 36 37 38 39 |
# File 'lib/kuu.rb', line 33 def self.parse(definition_json, args) Tempfile.create(["kuu-def", ".json"]) do |f| f.write(definition_json) f.flush return run("parse", f.path, "--", *args) end end |
.run(*args) ⇒ Object
Run kuu-cli with raw arguments, returning stdout on success.
23 24 25 26 27 28 29 |
# File 'lib/kuu.rb', line 23 def self.run(*args) out, err, status = Open3.capture3("kuu-cli", *args) raise CliFailed, err unless status.success? out rescue Errno::ENOENT raise CliNotFound end |
.version ⇒ Object
18 19 20 |
# File 'lib/kuu.rb', line 18 def self.version VERSION end |