From 3dd0206b48fc047b0085716c726590389c5d925a Mon Sep 17 00:00:00 2001 From: James Hillyerd Date: Sat, 20 Oct 2012 16:40:25 -0700 Subject: [PATCH] New directory layout - DOES NOT COMPILE --- app/inbucket/datastore.go => datastore.go | 0 app/inbucket/mime.go => mime.go | 0 app/inbucket/mime_test.go => mime_test.go | 0 {app/smtpd => smtpd}/handler.go | 0 {app/smtpd => smtpd}/listener.go | 0 .../integral/public}/images/favicon.png | Bin .../integral/public}/images/img01.gif | Bin .../integral/public}/images/img02.gif | Bin .../integral/public}/images/img03.gif | Bin .../integral/public}/images/img04.gif | Bin .../integral/public}/images/img05.gif | Bin .../integral/public}/images/img06.gif | Bin .../integral/public}/images/img07.gif | Bin .../integral/public}/images/img08.gif | Bin .../integral/public}/images/img09.gif | Bin .../integral/public}/images/img10.jpg | Bin .../integral/public}/images/img11.gif | Bin .../integral/public}/jquery-1.5.2.min.js | 0 .../integral/public}/main.css | 0 .../templates}/Application/Index.html | 0 .../integral/templates}/Mailbox/Html.html | 0 .../integral/templates}/Mailbox/Index.html | 0 .../integral/templates}/Mailbox/List.html | 0 .../integral/templates}/Mailbox/Show.html | 0 .../integral/templates}/errors.html | 0 .../integral/templates}/errors/404.html | 0 .../integral/templates}/errors/500.html | 0 .../integral/templates}/footer.html | 0 .../integral/templates}/header.html | 0 .../integral/templates}/menu.html | 0 app/inbucket/utils.go => utils.go | 33 +++++++++--------- app/inbucket/utils_test.go => utils_test.go | 1 - {app/controllers => web}/app.go | 0 {app/controllers => web}/helpers.go | 0 {app/controllers => web}/mailbox.go | 0 35 files changed, 16 insertions(+), 18 deletions(-) rename app/inbucket/datastore.go => datastore.go (100%) rename app/inbucket/mime.go => mime.go (100%) rename app/inbucket/mime_test.go => mime_test.go (100%) rename {app/smtpd => smtpd}/handler.go (100%) rename {app/smtpd => smtpd}/listener.go (100%) rename {public => themes/integral/public}/images/favicon.png (100%) rename {public => themes/integral/public}/images/img01.gif (100%) rename {public => themes/integral/public}/images/img02.gif (100%) rename {public => themes/integral/public}/images/img03.gif (100%) rename {public => themes/integral/public}/images/img04.gif (100%) rename {public => themes/integral/public}/images/img05.gif (100%) rename {public => themes/integral/public}/images/img06.gif (100%) rename {public => themes/integral/public}/images/img07.gif (100%) rename {public => themes/integral/public}/images/img08.gif (100%) rename {public => themes/integral/public}/images/img09.gif (100%) rename {public => themes/integral/public}/images/img10.jpg (100%) rename {public => themes/integral/public}/images/img11.gif (100%) rename {public/js => themes/integral/public}/jquery-1.5.2.min.js (100%) rename {public/stylesheets => themes/integral/public}/main.css (100%) rename {app/views => themes/integral/templates}/Application/Index.html (100%) rename {app/views => themes/integral/templates}/Mailbox/Html.html (100%) rename {app/views => themes/integral/templates}/Mailbox/Index.html (100%) rename {app/views => themes/integral/templates}/Mailbox/List.html (100%) rename {app/views => themes/integral/templates}/Mailbox/Show.html (100%) rename {app/views => themes/integral/templates}/errors.html (100%) rename {app/views => themes/integral/templates}/errors/404.html (100%) rename {app/views => themes/integral/templates}/errors/500.html (100%) rename {app/views => themes/integral/templates}/footer.html (100%) rename {app/views => themes/integral/templates}/header.html (100%) rename {app/views => themes/integral/templates}/menu.html (100%) rename app/inbucket/utils.go => utils.go (61%) rename app/inbucket/utils_test.go => utils_test.go (99%) rename {app/controllers => web}/app.go (100%) rename {app/controllers => web}/helpers.go (100%) rename {app/controllers => web}/mailbox.go (100%) diff --git a/app/inbucket/datastore.go b/datastore.go similarity index 100% rename from app/inbucket/datastore.go rename to datastore.go diff --git a/app/inbucket/mime.go b/mime.go similarity index 100% rename from app/inbucket/mime.go rename to mime.go diff --git a/app/inbucket/mime_test.go b/mime_test.go similarity index 100% rename from app/inbucket/mime_test.go rename to mime_test.go diff --git a/app/smtpd/handler.go b/smtpd/handler.go similarity index 100% rename from app/smtpd/handler.go rename to smtpd/handler.go diff --git a/app/smtpd/listener.go b/smtpd/listener.go similarity index 100% rename from app/smtpd/listener.go rename to smtpd/listener.go diff --git a/public/images/favicon.png b/themes/integral/public/images/favicon.png similarity index 100% rename from public/images/favicon.png rename to themes/integral/public/images/favicon.png diff --git a/public/images/img01.gif b/themes/integral/public/images/img01.gif similarity index 100% rename from public/images/img01.gif rename to themes/integral/public/images/img01.gif diff --git a/public/images/img02.gif b/themes/integral/public/images/img02.gif similarity index 100% rename from public/images/img02.gif rename to themes/integral/public/images/img02.gif diff --git a/public/images/img03.gif b/themes/integral/public/images/img03.gif similarity index 100% rename from public/images/img03.gif rename to themes/integral/public/images/img03.gif diff --git a/public/images/img04.gif b/themes/integral/public/images/img04.gif similarity index 100% rename from public/images/img04.gif rename to themes/integral/public/images/img04.gif diff --git a/public/images/img05.gif b/themes/integral/public/images/img05.gif similarity index 100% rename from public/images/img05.gif rename to themes/integral/public/images/img05.gif diff --git a/public/images/img06.gif b/themes/integral/public/images/img06.gif similarity index 100% rename from public/images/img06.gif rename to themes/integral/public/images/img06.gif diff --git a/public/images/img07.gif b/themes/integral/public/images/img07.gif similarity index 100% rename from public/images/img07.gif rename to themes/integral/public/images/img07.gif diff --git a/public/images/img08.gif b/themes/integral/public/images/img08.gif similarity index 100% rename from public/images/img08.gif rename to themes/integral/public/images/img08.gif diff --git a/public/images/img09.gif b/themes/integral/public/images/img09.gif similarity index 100% rename from public/images/img09.gif rename to themes/integral/public/images/img09.gif diff --git a/public/images/img10.jpg b/themes/integral/public/images/img10.jpg similarity index 100% rename from public/images/img10.jpg rename to themes/integral/public/images/img10.jpg diff --git a/public/images/img11.gif b/themes/integral/public/images/img11.gif similarity index 100% rename from public/images/img11.gif rename to themes/integral/public/images/img11.gif diff --git a/public/js/jquery-1.5.2.min.js b/themes/integral/public/jquery-1.5.2.min.js similarity index 100% rename from public/js/jquery-1.5.2.min.js rename to themes/integral/public/jquery-1.5.2.min.js diff --git a/public/stylesheets/main.css b/themes/integral/public/main.css similarity index 100% rename from public/stylesheets/main.css rename to themes/integral/public/main.css diff --git a/app/views/Application/Index.html b/themes/integral/templates/Application/Index.html similarity index 100% rename from app/views/Application/Index.html rename to themes/integral/templates/Application/Index.html diff --git a/app/views/Mailbox/Html.html b/themes/integral/templates/Mailbox/Html.html similarity index 100% rename from app/views/Mailbox/Html.html rename to themes/integral/templates/Mailbox/Html.html diff --git a/app/views/Mailbox/Index.html b/themes/integral/templates/Mailbox/Index.html similarity index 100% rename from app/views/Mailbox/Index.html rename to themes/integral/templates/Mailbox/Index.html diff --git a/app/views/Mailbox/List.html b/themes/integral/templates/Mailbox/List.html similarity index 100% rename from app/views/Mailbox/List.html rename to themes/integral/templates/Mailbox/List.html diff --git a/app/views/Mailbox/Show.html b/themes/integral/templates/Mailbox/Show.html similarity index 100% rename from app/views/Mailbox/Show.html rename to themes/integral/templates/Mailbox/Show.html diff --git a/app/views/errors.html b/themes/integral/templates/errors.html similarity index 100% rename from app/views/errors.html rename to themes/integral/templates/errors.html diff --git a/app/views/errors/404.html b/themes/integral/templates/errors/404.html similarity index 100% rename from app/views/errors/404.html rename to themes/integral/templates/errors/404.html diff --git a/app/views/errors/500.html b/themes/integral/templates/errors/500.html similarity index 100% rename from app/views/errors/500.html rename to themes/integral/templates/errors/500.html diff --git a/app/views/footer.html b/themes/integral/templates/footer.html similarity index 100% rename from app/views/footer.html rename to themes/integral/templates/footer.html diff --git a/app/views/header.html b/themes/integral/templates/header.html similarity index 100% rename from app/views/header.html rename to themes/integral/templates/header.html diff --git a/app/views/menu.html b/themes/integral/templates/menu.html similarity index 100% rename from app/views/menu.html rename to themes/integral/templates/menu.html diff --git a/app/inbucket/utils.go b/utils.go similarity index 61% rename from app/inbucket/utils.go rename to utils.go index 85047a0..bf7ab0c 100644 --- a/app/inbucket/utils.go +++ b/utils.go @@ -1,30 +1,30 @@ package inbucket import ( - "crypto/sha1" - "fmt" - "html" - "io" - "strings" + "crypto/sha1" + "fmt" + "html" + "io" + "strings" ) // Take "user+ext@host.com" and return "user", aka the mailbox we'll store it in func ParseMailboxName(emailAddress string) (result string) { - result = strings.ToLower(emailAddress) - if idx := strings.Index(result, "@"); idx > -1 { - result = result[0:idx] - } - if idx := strings.Index(result, "+"); idx > -1 { - result = result[0:idx] - } - return result + result = strings.ToLower(emailAddress) + if idx := strings.Index(result, "@"); idx > -1 { + result = result[0:idx] + } + if idx := strings.Index(result, "+"); idx > -1 { + result = result[0:idx] + } + return result } // Take a mailbox name and hash it into the directory we'll store it in func HashMailboxName(mailbox string) string { - h := sha1.New() - io.WriteString(h, mailbox) - return fmt.Sprintf("%x", h.Sum(nil)) + h := sha1.New() + io.WriteString(h, mailbox) + return fmt.Sprintf("%x", h.Sum(nil)) } // TextToHtml takes plain text, escapes it and tries to pretty it up for @@ -34,4 +34,3 @@ func TextToHtml(text string) string { replacer := strings.NewReplacer("\r\n", "
\n", "\r", "
\n", "\n", "
\n") return replacer.Replace(text) } - diff --git a/app/inbucket/utils_test.go b/utils_test.go similarity index 99% rename from app/inbucket/utils_test.go rename to utils_test.go index 0d6f9f3..92a2035 100644 --- a/app/inbucket/utils_test.go +++ b/utils_test.go @@ -41,4 +41,3 @@ func TestTextToHtml(t *testing.T) { assert.Equal(t, TextToHtml("line\r\nbreak"), "line
\nbreak") assert.Equal(t, TextToHtml("line\rbreak"), "line
\nbreak") } - diff --git a/app/controllers/app.go b/web/app.go similarity index 100% rename from app/controllers/app.go rename to web/app.go diff --git a/app/controllers/helpers.go b/web/helpers.go similarity index 100% rename from app/controllers/helpers.go rename to web/helpers.go diff --git a/app/controllers/mailbox.go b/web/mailbox.go similarity index 100% rename from app/controllers/mailbox.go rename to web/mailbox.go