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/02 22:08:58 UTC

[44/49] git commit: updated refs/heads/1867-feature-plugins to d269b53

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/afd7602e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/afd7602e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/afd7602e

Branch: refs/heads/1867-feature-plugins
Commit: afd7602e776ef86e8ae9d127d17143e32836b6a6
Parents: 4bff3b0
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 18:44:45 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Fri Aug 2 21:17:05 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/afd7602e/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/afd7602e/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(