Class: CouchShell::CoreEditPlugin
- Defined in:
- lib/couch-shell-plugin/core_edit.rb
Instance Method Summary collapse
Methods inherited from Plugin
inherited, #initialize, #plugin_info, #plugin_name, #shell, #variables_object
Methods included from PluginUtils
#continue?, #dbname!, #editfile!, #edittext!, #ensure_at_database, #request!
Constructor Details
This class inherits a constructor from CouchShell::Plugin
Instance Method Details
#execute_edit(argstr) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/couch-shell-plugin/core_edit.rb', line 20 def execute_edit(argstr) url = shell.interpolate(argstr) res = request! "GET", url, nil, false doc = res.json_value.to_s(true) new_doc = edittext!(doc) if new_doc == doc shell.msg "Document hasn't changed. Nothing to submit." return end continue? "Press ENTER to PUT updated document on server " + "or CTRL+C to cancel " unless shell.request("PUT", url, new_doc).ok? shell.msg "recover document text with `print edittext'" end end |
#lookup_edittext ⇒ Object
14 15 16 |
# File 'lib/couch-shell-plugin/core_edit.rb', line 14 def lookup_edittext @edittext or raise VarNotSet end |
#plugin_initialization ⇒ Object
9 10 11 |
# File 'lib/couch-shell-plugin/core_edit.rb', line 9 def plugin_initialization @edittext = nil end |