You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/08/01 18:56:09 UTC

[1/2] git commit: updated refs/heads/1867-feature-plugins to b43465e

Updated Branches:
  refs/heads/1867-feature-plugins c2ef525ec -> b43465e3e


register plugins at _config/plugins/pluginname with their version number


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e0dce975
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e0dce975
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e0dce975

Branch: refs/heads/1867-feature-plugins
Commit: e0dce975ddb7f263169caa457c98cb69607bd611
Parents: c2ef525
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 18:44:45 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Aug 1 18:44:45 2013 +0200

----------------------------------------------------------------------
 src/couch_plugins/README.md             |  2 +-
 src/couch_plugins/src/couch_plugins.erl | 13 +++++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e0dce975/src/couch_plugins/README.md
----------------------------------------------------------------------
diff --git a/src/couch_plugins/README.md b/src/couch_plugins/README.md
index 8851794..081788d 100644
--- a/src/couch_plugins/README.md
+++ b/src/couch_plugins/README.md
@@ -48,13 +48,13 @@ Here’s a list of things this first iterations does and doesn’t do:
 - Only installs if Erlang version matches.
 - No security checking of binaries.
 - No identity checking of binaries.
+- Register installed plugins in the config system.
 
 Here are a few things I want to add before I call it MVP*:
 
 - Uninstall a plugin via Futon (or HTTP call). Admin only.
 - Only installs if CouchDB version matches.
 - Binaries must be published on *.apache.org.
-- Register installed plugins in the config system.
 - Make sure plugins start with the next restart of CouchDB.
 - Show when a particular plugin is installed.
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/e0dce975/src/couch_plugins/src/couch_plugins.erl
----------------------------------------------------------------------
diff --git a/src/couch_plugins/src/couch_plugins.erl b/src/couch_plugins/src/couch_plugins.erl
index a7680c3..bbfa1e4 100644
--- a/src/couch_plugins/src/couch_plugins.erl
+++ b/src/couch_plugins/src/couch_plugins.erl
@@ -39,12 +39,21 @@ install({Name, _BaseUrl, Version, Checksums}=Plugin) ->
   ok = add_code_path(Name, Version),
   log("added code path"),
 
-  ok = load_config(Name, Version),
-  load_plugin(Name),
+  ok = register_plugin(Name, Version),
+  log("registered plugin"),
 
+  ok = load_plugin(Name),
   log("loaded plugin"),
+
+  load_config(Name, Version),
+  log("loaded config"),
+
   ok.
 
+-spec register_plugin(string(), string()) -> ok.
+register_plugin(Name, Version) ->
+  couch_config:set("plugins", Name, Version).
+
 -spec load_config(string(), string()) -> ok.
 load_config(Name, Version) ->
     lists:foreach(


[2/2] git commit: updated refs/heads/1867-feature-plugins to b43465e

Posted by ja...@apache.org.
check if plugins are already installed& better install feedback


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b43465e3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b43465e3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b43465e3

Branch: refs/heads/1867-feature-plugins
Commit: b43465e3e35b7515b4ed8b4a2165f98c8de5cd03
Parents: e0dce97
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 18:56:07 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Aug 1 18:56:07 2013 +0200

----------------------------------------------------------------------
 share/www/plugins.html | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b43465e3/share/www/plugins.html
----------------------------------------------------------------------
diff --git a/share/www/plugins.html b/share/www/plugins.html
index 473531d..b42ed2e 100644
--- a/share/www/plugins.html
+++ b/share/www/plugins.html
@@ -42,7 +42,7 @@ specific language governing permissions and limitations under the License.
           </ul>
         </p>
         <p>
-          <button href="#" class="install_plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"QVKzRsQGKhSdLkLTdHtgUYtr0wU="}' data-name="geocouch" data-version="couchdb1.2.x_v0.3.0-12-g4ea0bea">Install GeoCouch Now</button>
+          <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"QVKzRsQGKhSdLkLTdHtgUYtr0wU="}' data-name="geocouch" data-version="couchdb1.2.x_v0.3.0-12-g4ea0bea">Install GeoCouch Now</button>
         </p>
       </div>
       <div class="row">
@@ -56,13 +56,28 @@ specific language governing permissions and limitations under the License.
           </ul>
         </p>
         <p>
-          <button href="#" class="install_plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"2IvVuihCBAE4SIN3qgjofx23wJs="}' data-name="couchperuser" data-version="1.0.0">Install CouchPerUser Now</button>
+          <button href="#" class="install-plugin" data-url="http://people.apache.org/~jan" data-checksums='{"R15B03":"2IvVuihCBAE4SIN3qgjofx23wJs="}' data-name="couchperuser" data-version="1.0.0">Install CouchPerUser Now</button>
         </p>
       </div>
     </div>
   </div></body>
   <script>
-    $('.install_plugin').click(function(event) {
+    $('.install-plugin').each(function() {
+      var button = $(this);
+      var name = button.data('name');
+      var version = button.data('version');
+      $.get("/_config/plugins/" + name + "/", function(body, textStatus) {
+        body = JSON.parse(body);
+        if(body == version) {
+          button.html("Already Installed");
+        } else {
+          button.html("Other Version Installed: " + body);
+        }
+        button.attr("disabled", true);
+      });
+    });
+
+    $('.install-plugin').click(function(event) {
       var button = $(this);
       var plugin_spec = JSON.stringify({
         name: button.data('name'),
@@ -79,7 +94,12 @@ specific language governing permissions and limitations under the License.
         dataType: 'json', // expected from the server
         processData: false, // keep our precious JSON
         success: function(data, textStatus, jqXhr) {
-          button.html(textStatus);
+          if(textStatus == "success") {
+            button.html("Sucessfully Installed");
+            button.attr("disabled", true);
+          } else {
+            button.html(textStatus);
+          }
         },
         beforeSend: function(xhr) {
           xhr.setRequestHeader('Accept', 'application/json');