diff options
| author | Christine Dodrill <me@christine.website> | 2019-12-09 10:48:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-09 10:48:40 -0500 |
| commit | eb26857c1d5973bedc91c3fc1acaf4434809bbd5 (patch) | |
| tree | 926be802355da24afb3cf6ed8496a2b2d656e1a1 | |
| parent | 583cf248b3fe7ebb06d89ba32fddeee70fb14c2c (diff) | |
| download | xesite-eb26857c1d5973bedc91c3fc1acaf4434809bbd5.tar.xz xesite-eb26857c1d5973bedc91c3fc1acaf4434809bbd5.zip | |
Within package layout (#102)
* blog: go package layout
* eat my own dogfood
* internal: test date
* blog/go-package-layout: streamline
* oops
| -rw-r--r-- | cmd/site/html.go | 4 | ||||
| -rw-r--r-- | cmd/site/internal/blog/blog.go (renamed from internal/blog/blog.go) | 2 | ||||
| -rw-r--r-- | cmd/site/internal/blog/blog_test.go (renamed from internal/blog/blog_test.go) | 6 | ||||
| -rw-r--r-- | cmd/site/internal/date.go (renamed from internal/date.go) | 2 | ||||
| -rw-r--r-- | cmd/site/internal/date_test.go | 28 | ||||
| -rw-r--r-- | cmd/site/internal/front/LICENSE (renamed from internal/front/LICENSE) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/front/front.go (renamed from internal/front/front.go) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/front/front_test.go (renamed from internal/front/front_test.go) | 2 | ||||
| -rw-r--r-- | cmd/site/internal/hash.go (renamed from internal/hash.go) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/.travis.yml (renamed from internal/jsonfeed/.travis.yml) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/LICENSE (renamed from internal/jsonfeed/LICENSE) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/README.md (renamed from internal/jsonfeed/README.md) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/jsonfeed.go (renamed from internal/jsonfeed/jsonfeed.go) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/jsonfeed_test.go (renamed from internal/jsonfeed/jsonfeed_test.go) | 2 | ||||
| -rw-r--r-- | cmd/site/internal/jsonfeed/testdata/feed.json (renamed from internal/jsonfeed/testdata/feed.json) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/middleware/metrics.go (renamed from internal/middleware/metrics.go) | 0 | ||||
| -rw-r--r-- | cmd/site/internal/middleware/requestid.go (renamed from internal/middleware/requestid.go) | 0 | ||||
| -rw-r--r-- | cmd/site/main.go | 6 | ||||
| -rw-r--r-- | cmd/site/rss.go | 2 |
19 files changed, 41 insertions, 13 deletions
diff --git a/cmd/site/html.go b/cmd/site/html.go index 912ad77..37acba8 100644 --- a/cmd/site/html.go +++ b/cmd/site/html.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "christine.website/internal" - "christine.website/internal/blog" + "christine.website/cmd/site/internal" + "christine.website/cmd/site/internal/blog" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" "within.website/ln" diff --git a/internal/blog/blog.go b/cmd/site/internal/blog/blog.go index b27cce5..0ea6fb2 100644 --- a/internal/blog/blog.go +++ b/cmd/site/internal/blog/blog.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "christine.website/internal/front" + "christine.website/cmd/site/internal/front" "github.com/russross/blackfriday" ) diff --git a/internal/blog/blog_test.go b/cmd/site/internal/blog/blog_test.go index 4074636..6f44a30 100644 --- a/internal/blog/blog_test.go +++ b/cmd/site/internal/blog/blog_test.go @@ -5,7 +5,7 @@ import ( ) func TestLoadPosts(t *testing.T) { - posts, err := LoadPosts("../../blog", "blog") + posts, err := LoadPosts("../../../../blog", "blog") if err != nil { t.Fatal(err) } @@ -16,7 +16,7 @@ func TestLoadPosts(t *testing.T) { } func TestLoadTalks(t *testing.T) { - talks, err := LoadPosts("../../talks", "talks") + talks, err := LoadPosts("../../../../talks", "talks") if err != nil { t.Fatal(err) } @@ -30,7 +30,7 @@ func TestLoadTalks(t *testing.T) { } func TestLoadGallery(t *testing.T) { - gallery, err := LoadPosts("../../gallery", "gallery") + gallery, err := LoadPosts("../../../../gallery", "gallery") if err != nil { t.Fatal(err) } diff --git a/internal/date.go b/cmd/site/internal/date.go index cc81a1c..960cdc2 100644 --- a/internal/date.go +++ b/cmd/site/internal/date.go @@ -2,7 +2,7 @@ package internal import "time" -const iOS13DetriFormat = `2006 M01 2` +const iOS13DetriFormat = `2006 M1 2` // IOS13Detri formats a datestamp like iOS 13 does with the Lojban locale. func IOS13Detri(t time.Time) string { diff --git a/cmd/site/internal/date_test.go b/cmd/site/internal/date_test.go new file mode 100644 index 0000000..60254f9 --- /dev/null +++ b/cmd/site/internal/date_test.go @@ -0,0 +1,28 @@ +package internal + +import ( + "fmt" + "testing" + "time" +) + +func TestIOS13Detri(t *testing.T) { + cases := []struct { + in time.Time + out string + }{ + { + in: time.Date(2019, time.March, 30, 0, 0, 0, 0, time.FixedZone("UTC", 0)), + out: "2019 M3 30", + }, + } + + for _, cs := range cases { + t.Run(fmt.Sprintf("%s -> %s", cs.in.Format(time.RFC3339), cs.out), func(t *testing.T) { + result := IOS13Detri(cs.in) + if result != cs.out { + t.Fatalf("wanted: %s, got: %s", cs.out, result) + } + }) + } +} diff --git a/internal/front/LICENSE b/cmd/site/internal/front/LICENSE index e8152bb..e8152bb 100644 --- a/internal/front/LICENSE +++ b/cmd/site/internal/front/LICENSE diff --git a/internal/front/front.go b/cmd/site/internal/front/front.go index b2c7f0e..b2c7f0e 100644 --- a/internal/front/front.go +++ b/cmd/site/internal/front/front.go diff --git a/internal/front/front_test.go b/cmd/site/internal/front/front_test.go index 42094f5..bdc56d1 100644 --- a/internal/front/front_test.go +++ b/cmd/site/internal/front/front_test.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "christine.website/internal/front" + "christine.website/cmd/site/internal/front" ) var markdown = []byte(`--- diff --git a/internal/hash.go b/cmd/site/internal/hash.go index ee333da..ee333da 100644 --- a/internal/hash.go +++ b/cmd/site/internal/hash.go diff --git a/internal/jsonfeed/.travis.yml b/cmd/site/internal/jsonfeed/.travis.yml index e872c60..e872c60 100644 --- a/internal/jsonfeed/.travis.yml +++ b/cmd/site/internal/jsonfeed/.travis.yml diff --git a/internal/jsonfeed/LICENSE b/cmd/site/internal/jsonfeed/LICENSE index e87a115..e87a115 100644 --- a/internal/jsonfeed/LICENSE +++ b/cmd/site/internal/jsonfeed/LICENSE diff --git a/internal/jsonfeed/README.md b/cmd/site/internal/jsonfeed/README.md index 27f7cb5..27f7cb5 100644 --- a/internal/jsonfeed/README.md +++ b/cmd/site/internal/jsonfeed/README.md diff --git a/internal/jsonfeed/jsonfeed.go b/cmd/site/internal/jsonfeed/jsonfeed.go index 913880d..913880d 100644 --- a/internal/jsonfeed/jsonfeed.go +++ b/cmd/site/internal/jsonfeed/jsonfeed.go diff --git a/internal/jsonfeed/jsonfeed_test.go b/cmd/site/internal/jsonfeed/jsonfeed_test.go index da8cb04..cd071d7 100644 --- a/internal/jsonfeed/jsonfeed_test.go +++ b/cmd/site/internal/jsonfeed/jsonfeed_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "christine.website/internal/jsonfeed" + "christine.website/cmd/site/internal/jsonfeed" "github.com/stretchr/testify/assert" ) diff --git a/internal/jsonfeed/testdata/feed.json b/cmd/site/internal/jsonfeed/testdata/feed.json index ad4bbe1..ad4bbe1 100644 --- a/internal/jsonfeed/testdata/feed.json +++ b/cmd/site/internal/jsonfeed/testdata/feed.json diff --git a/internal/middleware/metrics.go b/cmd/site/internal/middleware/metrics.go index f9d7e0f..f9d7e0f 100644 --- a/internal/middleware/metrics.go +++ b/cmd/site/internal/middleware/metrics.go diff --git a/internal/middleware/requestid.go b/cmd/site/internal/middleware/requestid.go index 6914137..6914137 100644 --- a/internal/middleware/requestid.go +++ b/cmd/site/internal/middleware/requestid.go diff --git a/cmd/site/main.go b/cmd/site/main.go index eaefb5d..2168dd5 100644 --- a/cmd/site/main.go +++ b/cmd/site/main.go @@ -9,9 +9,9 @@ import ( "sort" "time" - "christine.website/internal/blog" - "christine.website/internal/jsonfeed" - "christine.website/internal/middleware" + "christine.website/cmd/site/internal/blog" + "christine.website/cmd/site/internal/jsonfeed" + "christine.website/cmd/site/internal/middleware" "github.com/gorilla/feeds" "github.com/povilasv/prommod" "github.com/prometheus/client_golang/prometheus" diff --git a/cmd/site/rss.go b/cmd/site/rss.go index e03e07f..cd99bde 100644 --- a/cmd/site/rss.go +++ b/cmd/site/rss.go @@ -5,7 +5,7 @@ import ( "net/http" "time" - "christine.website/internal" + "christine.website/cmd/site/internal" "within.website/ln" "within.website/ln/opname" ) |
