Class: CouchPack::CLI
- Inherits:
-
Thor
- Object
- Thor
- CouchPack::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/couchpack/cli.rb
Instance Method Summary collapse
- #document(document_url, outfile) ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
18 19 20 21 22 23 24 |
# File 'lib/couchpack/cli.rb', line 18 def initialize(*) super if [:version] say "couchpack #{::CouchPack::VERSION}", :green exit end end |
Instance Method Details
#document(document_url, outfile) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/couchpack/cli.rb', line 27 def document(document_url, outfile) auto = [:auto] # pack now ::CouchPack::CouchPack::pack_document(document_url, outfile) # watch for changes if auto couch_watcher = CouchWatcher::CouchWatcher.new() couch_watcher.add_document_watcher(document_url, false) {|url, id, rev| ::CouchPack::CouchPack::pack_document(document_url, outfile)} couch_watcher.start_watching(false) # keep the watcher running while(true) sleep(1000) end end end |