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 similarity index 98% rename from internal/blog/blog.go rename to 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 similarity index 85% rename from internal/blog/blog_test.go rename to 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 similarity index 82% rename from internal/date.go rename to 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 similarity index 100% rename from internal/front/LICENSE rename to cmd/site/internal/front/LICENSE diff --git a/internal/front/front.go b/cmd/site/internal/front/front.go similarity index 100% rename from internal/front/front.go rename to cmd/site/internal/front/front.go diff --git a/internal/front/front_test.go b/cmd/site/internal/front/front_test.go similarity index 93% rename from internal/front/front_test.go rename to 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 similarity index 100% rename from internal/hash.go rename to cmd/site/internal/hash.go diff --git a/internal/jsonfeed/.travis.yml b/cmd/site/internal/jsonfeed/.travis.yml similarity index 100% rename from internal/jsonfeed/.travis.yml rename to cmd/site/internal/jsonfeed/.travis.yml diff --git a/internal/jsonfeed/LICENSE b/cmd/site/internal/jsonfeed/LICENSE similarity index 100% rename from internal/jsonfeed/LICENSE rename to cmd/site/internal/jsonfeed/LICENSE diff --git a/internal/jsonfeed/README.md b/cmd/site/internal/jsonfeed/README.md similarity index 100% rename from internal/jsonfeed/README.md rename to cmd/site/internal/jsonfeed/README.md diff --git a/internal/jsonfeed/jsonfeed.go b/cmd/site/internal/jsonfeed/jsonfeed.go similarity index 100% rename from internal/jsonfeed/jsonfeed.go rename to cmd/site/internal/jsonfeed/jsonfeed.go diff --git a/internal/jsonfeed/jsonfeed_test.go b/cmd/site/internal/jsonfeed/jsonfeed_test.go similarity index 97% rename from internal/jsonfeed/jsonfeed_test.go rename to 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 similarity index 100% rename from internal/jsonfeed/testdata/feed.json rename to cmd/site/internal/jsonfeed/testdata/feed.json diff --git a/internal/middleware/metrics.go b/cmd/site/internal/middleware/metrics.go similarity index 100% rename from internal/middleware/metrics.go rename to cmd/site/internal/middleware/metrics.go diff --git a/internal/middleware/requestid.go b/cmd/site/internal/middleware/requestid.go similarity index 100% rename from internal/middleware/requestid.go rename to 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" )