Skip to content

Commit

Permalink
Add makefile to bootstrap addon
Browse files Browse the repository at this point in the history
  • Loading branch information
tiberiuichim committed Mar 12, 2021
1 parent dd94203 commit b976af6
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
SHELL=/bin/bash

DIR=$(shell basename $$(pwd))
ADDON ?= volto-block-style:installDemoStyles

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

make-frontend:
npm install -g yo
npm install -g @plone/generator-volto
npm install -g mrs-developer
yo @plone/volto project --addon ${ADDON} --workspace "src/addons/${DIR}" --no-interactive
ln -sf $$(pwd) project/src/addons/
cp .project.eslintrc.js .eslintrc.js
cd project && yarn
@echo "-------------------"
@echo "Project is ready!"
@echo "Now run: cd project && yarn start"

.PHONY: build-backend
build-backend: ## Build Plone 5.2
(cd api && python3 -m venv .)
(cd api && bin/pip install --upgrade pip)
(cd api && bin/pip install --upgrade wheel)
(cd api && bin/pip install -r requirements.txt)
(cd api && bin/buildout)

.PHONY: build
build:
make build-backend
make build-frontend

all: build

.PHONY: start-backend
start-backend: ## Start Plone Backend
@echo "$(GREEN)==> Start Plone Backend$(RESET)"
(cd api && PYTHONWARNINGS=ignore bin/instance fg)

.PHONY: start-test-backend
start-test-backend: ## Start Test Plone Backend
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
ZSERVER_PORT=55001 CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors,eea.volto.slate APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage,eea.volto.slate:default ./api/bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING


.PHONY: help
help: ## Show this help.
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
109 changes: 109 additions & 0 deletions api/buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[buildout]
index = https://pypi.org/simple/
extends = http://dist.plone.org/release/5.2.3/versions.cfg
find-links += http://dist.plone.org/thirdparty/
parts = instance plonesite robot-server test test-coverage
versions = versions

extensions = mr.developer
auto-checkout =
plone.restapi
eea.volto.slate

[sources]
kitconcept.volto = git https://github.com/kitconcept/kitconcept.volto.git branch=master
plone.rest = git git@github.com:plone/plone.rest.git branch=master
plone.restapi = git git://github.com/plone/plone.restapi.git pushurl=git@github.com:plone/plone.restapi.git branch=master
eea.volto.slate = git git@github.com:eea/eea.volto.slate.git branch=main

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 8080
eggs =
Plone
Pillow
kitconcept.volto
Products.PloneHotfix20200121
eea.volto.slate
plone.restapi [test]
zcml =
eea.volto.slate

zcml-additional =
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:plone="http://namespaces.plone.org/plone">
<plone:CORSPolicy
allow_origin="http://localhost:3000,http://127.0.0.1:3000"
allow_methods="DELETE,GET,OPTIONS,PATCH,POST,PUT"
allow_credentials="true"
expose_headers="Content-Length,X-My-Header"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin"
max_age="3600"
/>
</configure>

[robot-server]
recipe = zc.recipe.egg
eggs =
${instance:eggs}
collective.MockMailHost
plone.app.robotframework
scripts =
robot-server
pybot

[plonesite]
recipe = collective.recipe.plonesite
site-id = Plone
instance = instance
profiles-initial = Products.CMFPlone:dependencies
profiles =
plonetheme.barceloneta:default
plone.app.contenttypes:plone-content
kitconcept.volto:default-homepage
upgrade-portal = False
upgrade-all-profiles = False
site-replace = True

[test]
recipe = zc.recipe.testrunner
eggs = ${instance:eggs}
initialization =
os.environ['TZ'] = 'UTC'
os.environ['ZSERVER_PORT'] = '55001'
defaults = ['-s', 'eea.volto.slate', '--auto-color', '--auto-progress']

[coverage]
recipe = zc.recipe.egg
eggs = coverage

[test-coverage]
recipe = collective.recipe.template
input = inline:
#!/bin/bash
export TZ=UTC
${buildout:directory}/bin/coverage run bin/test $*
${buildout:directory}/bin/coverage html
${buildout:directory}/bin/coverage report -m --fail-under=90
# Fail (exit status 1) if coverage returns exit status 2 (this happens
# when test coverage is below 100%.
output = ${buildout:directory}/bin/test-coverage
mode = 755

[versions]
setuptools =
zc.buildout =
plone.restapi = 7.0.0

kitconcept.volto =

robotframework =
robotframework-debuglibrary =
robotframework-react =
robotframework-requests =
robotframework-selenium2library =
robotframework-seleniumlibrary =
robotframework-webpack=
selenium =
feedparser =
3 changes: 3 additions & 0 deletions api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Keep this file in sync with: https://github.com/kitconcept/buildout/edit/master/requirements.txt
setuptools==42.0.2
zc.buildout==2.13.3

0 comments on commit b976af6

Please sign in to comment.