From 314f5670531dfda9b3d708fce8b0161a098cf134 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 8 Apr 2012 20:50:11 -0400 Subject: [PATCH] Restructure the lib directory to avoid name collisions. --- bin/mailshears | 12 +----------- lib/mailshears.rb | 11 +++++++++++ lib/{ => mailshears}/errors.rb | 0 lib/{ => mailshears}/exit_codes.rb | 0 lib/{ => mailshears}/filesystem.rb | 0 lib/{ => mailshears}/mailstore.rb | 0 lib/{ => mailshears}/plugin.rb | 0 lib/{ => mailshears}/plugins/dovecot_mailstore.rb | 11 +++++++---- lib/{ => mailshears}/plugins/roundcube_db.rb | 0 lib/{ => mailshears}/postfixadmin_db.rb | 0 10 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 lib/mailshears.rb rename lib/{ => mailshears}/errors.rb (100%) rename lib/{ => mailshears}/exit_codes.rb (100%) rename lib/{ => mailshears}/filesystem.rb (100%) rename lib/{ => mailshears}/mailstore.rb (100%) rename lib/{ => mailshears}/plugin.rb (100%) rename lib/{ => mailshears}/plugins/dovecot_mailstore.rb (95%) rename lib/{ => mailshears}/plugins/roundcube_db.rb (100%) rename lib/{ => mailshears}/postfixadmin_db.rb (100%) diff --git a/bin/mailshears b/bin/mailshears index 5a8ee0a..96a3c30 100755 --- a/bin/mailshears +++ b/bin/mailshears @@ -13,21 +13,11 @@ # filesystem, but not the database. # -# Needed for rm_rf. -require 'fileutils' +require 'mailshears' # Load our config file. require 'configuration' -# And the necessary classes. -require 'errors.rb' -require 'exit_codes.rb' -require 'postfixadmin_db' - -Configuration::PLUGINS.each do |plugin_file| - require "plugins/#{plugin_file}" -end - pgadb = PostfixadminDb.new(Configuration::DBHOST, Configuration::DBPORT, Configuration::DBOPTS, diff --git a/lib/mailshears.rb b/lib/mailshears.rb new file mode 100644 index 0000000..75e38f0 --- /dev/null +++ b/lib/mailshears.rb @@ -0,0 +1,11 @@ +# Load the rest of the code we'll use. + +# And the necessary classes. +require 'mailshears/errors.rb' +require 'mailshears/exit_codes.rb' +require 'mailshears/postfixadmin_db' + +Configuration::PLUGINS.each do |plugin_file| + require "mailshears/plugins/#{plugin_file}" +end + diff --git a/lib/errors.rb b/lib/mailshears/errors.rb similarity index 100% rename from lib/errors.rb rename to lib/mailshears/errors.rb diff --git a/lib/exit_codes.rb b/lib/mailshears/exit_codes.rb similarity index 100% rename from lib/exit_codes.rb rename to lib/mailshears/exit_codes.rb diff --git a/lib/filesystem.rb b/lib/mailshears/filesystem.rb similarity index 100% rename from lib/filesystem.rb rename to lib/mailshears/filesystem.rb diff --git a/lib/mailstore.rb b/lib/mailshears/mailstore.rb similarity index 100% rename from lib/mailstore.rb rename to lib/mailshears/mailstore.rb diff --git a/lib/plugin.rb b/lib/mailshears/plugin.rb similarity index 100% rename from lib/plugin.rb rename to lib/mailshears/plugin.rb diff --git a/lib/plugins/dovecot_mailstore.rb b/lib/mailshears/plugins/dovecot_mailstore.rb similarity index 95% rename from lib/plugins/dovecot_mailstore.rb rename to lib/mailshears/plugins/dovecot_mailstore.rb index df541b8..c50b117 100644 --- a/lib/plugins/dovecot_mailstore.rb +++ b/lib/mailshears/plugins/dovecot_mailstore.rb @@ -1,7 +1,10 @@ -require 'errors' -require 'filesystem' -require 'mailstore' -require 'plugin' +# Needed for rm_rf. +require 'fileutils' + +require 'mailshears/errors' +require 'mailshears/filesystem' +require 'mailshears/mailstore' +require 'mailshears/plugin' class DovecotMailstore < Mailstore diff --git a/lib/plugins/roundcube_db.rb b/lib/mailshears/plugins/roundcube_db.rb similarity index 100% rename from lib/plugins/roundcube_db.rb rename to lib/mailshears/plugins/roundcube_db.rb diff --git a/lib/postfixadmin_db.rb b/lib/mailshears/postfixadmin_db.rb similarity index 100% rename from lib/postfixadmin_db.rb rename to lib/mailshears/postfixadmin_db.rb -- 2.44.2