]> gitweb.michael.orlitzky.com - mailshears.git/commitdiff
Factor out common code that can be used to mv (rename) accounts.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 18:38:35 +0000 (14:38 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 19 Mar 2013 18:38:35 +0000 (14:38 -0400)
Separate Plugin/RmPlugin modules.

12 files changed:
lib/common/configuration.rb [moved from lib/mailshears/configuration.rb with 100% similarity]
lib/common/errors.rb [moved from lib/mailshears/errors.rb with 100% similarity]
lib/common/exit_codes.rb [moved from lib/mailshears/exit_codes.rb with 100% similarity]
lib/common/filesystem.rb [moved from lib/mailshears/filesystem.rb with 100% similarity]
lib/common/mailstore.rb [moved from lib/mailshears/mailstore.rb with 100% similarity]
lib/common/plugin.rb [moved from lib/mailshears/plugin.rb with 59% similarity]
lib/mailshears.rb
lib/mailshears/plugins/agendav.rb
lib/mailshears/plugins/davical.rb
lib/mailshears/plugins/dovecot_mailstore.rb
lib/mailshears/plugins/roundcube_db.rb
lib/mailshears/rm_plugin.rb [new file with mode: 0644]

similarity index 59%
rename from lib/mailshears/plugin.rb
rename to lib/common/plugin.rb
index 2e868c2762da7f5a46f99add6fb081750cef74d2..0687989fe03169e3aa2e4d9c256f30bf9cbe8b67 100644 (file)
@@ -28,25 +28,4 @@ module Plugin
     raise NotImplementedError
   end
 
     raise NotImplementedError
   end
 
-  def delete_domain(domain)
-    # Delete the given domain.
-    raise NotImplementedError
-  end
-
-  def delete_account(account)
-    # Delete the given account.
-    raise NotImplementedError
-  end
-
-  def get_leftover_domains(db_domains)
-    # Given a list of domains, determine which domains belonging to
-    # this plugin are not contained in the given list.
-    raise NotImplementedError
-  end
-
-  def get_leftover_accounts(db_accounts)
-    # Given a list of accounts, determine which accounts belonging to
-    # this plugin are not contained in the given list.
-    raise NotImplementedError
-  end
 end
 end
index 287ee2b9619ef3b2c7466000e147e5a101a6f675..cb8e43cdf16631ff834ee2cd57eee0a5e51aa012 100644 (file)
@@ -1,9 +1,10 @@
-# Load the rest of the code we'll use.
+# Load the rest of the code we'll use. This loads what we'll need in
+# the executables; the library files are supposed to require what they
+# need.
 
 
-# And the necessary classes.
-require 'mailshears/configuration'
-require 'mailshears/errors'
-require 'mailshears/exit_codes'
+require 'common/configuration'
+require 'common/errors'
+require 'common/exit_codes'
 require 'mailshears/postfixadmin_db'
 
 cfg = Configuration.new()
 require 'mailshears/postfixadmin_db'
 
 cfg = Configuration.new()
index 9746f1ce91e7db76cec65dbe46c79e1fdbd69d2e..35783022564121555c8b55a098bb31e3366bfe9d 100644 (file)
@@ -1,8 +1,12 @@
 require 'pg'
 
 require 'pg'
 
+require 'common/plugin'
+require 'mailshears/rm_plugin'
+
 class AgendavDb
 
   include Plugin
 class AgendavDb
 
   include Plugin
+  include RmPlugin
 
   def initialize()
     cfg = Configuration.new()
 
   def initialize()
     cfg = Configuration.new()
index 0c63ee2f60da764a1d10fbdc42ca354a2c2f2f07..2091529f64ffd6e6cb6b57856b8c44922853f043 100644 (file)
@@ -1,11 +1,15 @@
 require 'pg'
 
 require 'pg'
 
+require 'common/plugin'
+require 'mailshears/rm_plugin'
+
 class DavicalDb
   #
   # DAViCal only supports Postgres, so even if we ever are
   # database-agnostic, this plugin can't be.
   #
   include Plugin
 class DavicalDb
   #
   # DAViCal only supports Postgres, so even if we ever are
   # database-agnostic, this plugin can't be.
   #
   include Plugin
+  include RmPlugin
 
   def initialize()
     cfg = Configuration.new()
 
   def initialize()
     cfg = Configuration.new()
index cf4711c31c20b941ebc26c797163aa7017859e07..635d6efe6ffed1e10a5031f3018e9558fefa827d 100644 (file)
@@ -1,15 +1,15 @@
 # Needed for rm_rf.
 require 'fileutils'
 
 # Needed for rm_rf.
 require 'fileutils'
 
-require 'mailshears/configuration'
-require 'mailshears/errors'
-require 'mailshears/filesystem'
-require 'mailshears/mailstore'
-require 'mailshears/plugin'
+require 'common/filesystem'
+require 'common/mailstore'
+require 'common/plugin'
+require 'mailshears/rm_plugin'
 
 class DovecotMailstore < Mailstore
 
   include Plugin
 
 class DovecotMailstore < Mailstore
 
   include Plugin
+  include RmPlugin
 
   def initialize
     cfg = Configuration.new()
 
   def initialize
     cfg = Configuration.new()
index 7d1a037623ecf75092162d7cdf77c30897b7c092..a930189e7d48dd87b2663ae79db2c1387b5a801b 100644 (file)
@@ -1,8 +1,12 @@
 require 'pg'
 
 require 'pg'
 
+require 'common/plugin'
+require 'mailshears/rm_plugin'
+
 class RoundcubeDb
 
   include Plugin
 class RoundcubeDb
 
   include Plugin
+  include RmPlugin
 
   def initialize()
     cfg = Configuration.new()
 
   def initialize()
     cfg = Configuration.new()
diff --git a/lib/mailshears/rm_plugin.rb b/lib/mailshears/rm_plugin.rb
new file mode 100644 (file)
index 0000000..0c155a1
--- /dev/null
@@ -0,0 +1,27 @@
+module RmPlugin
+  #
+  # Plugins for the removal of accounts.
+  #
+
+  def delete_domain(domain)
+    # Delete the given domain.
+    raise NotImplementedError
+  end
+
+  def delete_account(account)
+    # Delete the given account.
+    raise NotImplementedError
+  end
+
+  def get_leftover_domains(db_domains)
+    # Given a list of domains, determine which domains belonging to
+    # this plugin are not contained in the given list.
+    raise NotImplementedError
+  end
+
+  def get_leftover_accounts(db_accounts)
+    # Given a list of accounts, determine which accounts belonging to
+    # this plugin are not contained in the given list.
+    raise NotImplementedError
+  end
+end