summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2018-01-03 14:48:07 -0700
committerSteve Manuel <nilslice@gmail.com>2018-01-03 14:48:07 -0700
commit7b4ce4d9df4768c9bc21dabe988d1287314b9449 (patch)
tree0c4194e161f91e82b4008d1b929f2b071ac300af
parent8355dce9d7c319ea471b46116962659e5bb0462d (diff)
parent188c1350b123d570bb55f348b19f583ef0e6f4b1 (diff)
Merge branch 'master' of https://github.com/ponzu-cms/ponzu into ponzu-dev
-rw-r--r--.circleci/config.yml15
-rw-r--r--.circleci/test-run.sh25
-rwxr-xr-x.circleci/test-setup.sh26
-rw-r--r--Dockerfile2
-rw-r--r--cmd/ponzu/new.go12
5 files changed, 75 insertions, 5 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
new file mode 100644
index 0000000..0def778
--- /dev/null
+++ b/.circleci/config.yml
@@ -0,0 +1,15 @@
+version: 2
+jobs:
+ build:
+ docker:
+ - image: circleci/golang:1.9
+
+ steps:
+ - checkout
+
+ # generate and build project to test
+ - run: curl https://raw.githubusercontent.com/ponzu-cms/ponzu/ponzu-dev/.circleci/test-setup.sh | sh
+
+ # run tests
+ - run: curl https://raw.githubusercontent.com/ponzu-cms/ponzu/ponzu-dev/.circleci/test-run.sh | sh
+
diff --git a/.circleci/test-run.sh b/.circleci/test-run.sh
new file mode 100644
index 0000000..dafef6f
--- /dev/null
+++ b/.circleci/test-run.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# Test that the configuration runs.
+
+set -ex
+
+cd /go/src/github.com/ponzu-cms/ci/test-project
+
+ponzu run --dev-https &
+
+# Smoke test
+sleep 2
+curl -Lk https://localhost:10443/admin | grep https://www.bosssauce.it
+
+# Run unit tests
+touch cookies
+
+# Create initial admin user
+curl -v --cookie-jar cookies \
+ -d "name=Test&domain=localhost&email=test@ponzu-cms.org&password=ponzu" \
+ -X POST localhost:8080/admin/init
+
+#Test that content types were generated
+curl -b cookies -c cookies http://localhost:8080/admin/contents?type=Person \
+ | grep Person \ No newline at end of file
diff --git a/.circleci/test-setup.sh b/.circleci/test-setup.sh
new file mode 100755
index 0000000..76085e3
--- /dev/null
+++ b/.circleci/test-setup.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Set up test environment
+
+set -ex
+
+# Install Ponzu CMS
+go get -u github.com/ponzu-cms/ponzu/...
+
+
+# test install
+ponzu
+
+
+# create a project and generate code
+ponzu new github.com/ponzu-cms/ci/test-project
+
+cd /go/src/github.com/ponzu-cms/ci/test-project
+
+ponzu gen content person name:string hashed_secret:string
+ponzu gen content message from:@person,hashed_secret to:@person,hashed_secret
+
+
+# build and run dev http/2 server with TLS
+ponzu build
+
diff --git a/Dockerfile b/Dockerfile
index 17a496f..6b991f9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
# Base our image on an official, minimal image of our preferred golang
-FROM golang:1.8.1
+FROM golang:1.9
# Note: The default golang docker image, already has the GOPATH env variable set.
# GOPATH is located at /go
diff --git a/cmd/ponzu/new.go b/cmd/ponzu/new.go
index 2f16a53..058fdf6 100644
--- a/cmd/ponzu/new.go
+++ b/cmd/ponzu/new.go
@@ -183,10 +183,14 @@ func createProjectInDir(path string) error {
return err
}
- gitDir := filepath.Join(path, ".git")
- err = os.RemoveAll(gitDir)
- if err != nil {
- fmt.Println("Failed to remove .git directory from your project path. Consider removing it manually.")
+ // remove non-project files and directories
+ rmPaths := []string{".git", ".circleci"}
+ for _, rm := range rmPaths {
+ dir := filepath.Join(path, rm)
+ err = os.RemoveAll(dir)
+ if err != nil {
+ fmt.Println("Failed to remove directory from your project path. Consider removing it manually:", dir)
+ }
}
fmt.Println("New ponzu project created at", path)