Skip to content

Commit

Permalink
Merge pull request #35 from plonegovbr/issue_11_portalpadraorelease
Browse files Browse the repository at this point in the history
  • Loading branch information
idgserpro authored Oct 11, 2016
2 parents 3c34746 + 8b214af commit 1437183
Show file tree
Hide file tree
Showing 24 changed files with 172 additions and 160 deletions.
45 changes: 29 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,42 @@ sudo: false
cache:
directories:
- eggs
- parts/node
env:
- PLONE_VERSION=4.2
- PLONE_VERSION=4.3
- PLONE_VERSION=5.0
matrix:
- PLONE_VERSION=4.2
# Nos demais pacotes plonegovbr, como não testo as versões além do Plone
# 4.3 (ou seja, por padrão testo só a 4.3), não uso a variável
# PLONE_VERSION, apenas a MASTER e a PENDING_RELEASE.
- PLONE_VERSION=4.3 MASTER=true
- PLONE_VERSION=4.3 PENDING_RELEASE=true
- PLONE_VERSION=5.0
matrix:
allow_failures:
- env: PLONE_VERSION=5.0
- env: PLONE_VERSION=4.2
- env: PLONE_VERSION=4.3 MASTER=true
- env: PLONE_VERSION=5.0
fast_finish: true
install:
- sed -ie "s#test-4.3#test-$PLONE_VERSION#" buildout.cfg
- python bootstrap.py
- bin/buildout annotate
- bin/buildout -Nq
# Remova a linha que aponta para o versions do novo release, por padrão 4.3,
# se o job for o 4.2, 5.0 ou o que tem que pegar do master.
- test "$MASTER" -o "$PLONE_VERSION" = 4.2 -o "$PLONE_VERSION" = 5.0 && sed -ie '/https:\/\/raw\.githubusercontent\.com\/plonegovbr\/portal\.buildout\/master\/buildout\.d\/versions\.cfg/d' buildout.cfg || true
- sed -ie "s#test-4.3#test-$PLONE_VERSION#" buildout.cfg
- python bootstrap.py
- bin/buildout annotate
- bin/buildout
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- firefox -v
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- firefox -v
script:
- bin/code-analysis
- bin/test
- bin/code-analysis
- bin/test
after_success:
- bin/createcoverage -t "--layer=!Robot"
- pip install -q coveralls
- coveralls
# barra, no momento, não possui testes do tipo "Robots", ao contrário dos
# demais pacotes em plonegovbr.
- bin/createcoverage -t "--layer=!Robot"
- pip install coveralls
- coveralls
notifications:
irc: irc.freenode.org#plonegovbr
51 changes: 36 additions & 15 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@

from optparse import OptionParser

tmpeggs = tempfile.mkdtemp()
__version__ = '2015-07-01'
# See zc.buildout's changelog if this version is up to date.

tmpeggs = tempfile.mkdtemp(prefix='bootstrap-')

usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Expand All @@ -40,8 +43,9 @@
'''

parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")

parser.add_option("--version",
action="store_true", default=False,
help=("Return bootstrap.py version."))
parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
Expand All @@ -59,25 +63,33 @@
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--buildout-version",
help="Use a specific zc.buildout version")
parser.add_option("--setuptools-version",
help="use a specific setuptools version")

help="Use a specific setuptools version")
parser.add_option("--setuptools-to-dir",
help=("Allow for re-use of existing directory of "
"setuptools versions"))

options, args = parser.parse_args()
if options.version:
print("bootstrap.py version %s" % __version__)
sys.exit(0)


######################################################################
# load/install setuptools

try:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen

ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
if os.path.exists('ez_setup.py'):
exec(open('ez_setup.py').read(), ez)
else:
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)

if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
Expand All @@ -88,12 +100,19 @@
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
# Strip all site-packages directories from sys.path that
# are not sys.prefix; this is because on Windows
# sys.prefix is a site-package directory.
if sitepackage_path != sys.prefix:
sys.path[:] = [x for x in sys.path
if sitepackage_path not in x]

setup_args = dict(to_dir=tmpeggs, download_delay=0)

if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
if options.setuptools_to_dir is not None:
setup_args['to_dir'] = options.setuptools_to_dir

ez['use_setuptools'](**setup_args)
import setuptools
Expand All @@ -110,7 +129,12 @@

ws = pkg_resources.working_set

setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location

# Fix sys.path here as easy_install.pth added before PYTHONPATH
cmd = [sys.executable, '-c',
'import sys; sys.path[0:0] = [%r]; ' % setuptools_path +
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]

Expand All @@ -123,11 +147,8 @@
if find_links:
cmd.extend(['-f', find_links])

setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location

requirement = 'zc.buildout'
version = options.version
version = options.buildout_version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
Expand Down Expand Up @@ -167,7 +188,7 @@ def _final_version(parsed_version):
cmd.append(requirement)

import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
if subprocess.call(cmd) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

Expand Down
20 changes: 11 additions & 9 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
https://raw.github.com/collective/buildout.plonetest/master/qa.cfg
https://raw.github.com/plone/plone.app.robotframework/master/versions.cfg
https://raw.githubusercontent.com/plonegovbr/portal.buildout/master/buildout.d/versions.cfg

package-name = brasil.gov.barra
package-extras = [test]
Expand All @@ -11,27 +11,29 @@ eggs +=

parts +=
createcoverage
i18ndude
node
omelette

[code-analysis]
recipe = plone.recipe.codeanalysis[recommended]
directory = ${buildout:directory}/src/brasil/gov/barra
clean-lines = False
clean-lines = True
csslint = True
csslint-bin = bin/csslint
debug-statements = True
deprecated-aliases = True
flake8-ignore = E501,T000
jshint = True
jshint-bin = bin/jshint
multiprocessing = True
return-status-codes = True
pre-commit-hook = True
prefer-single-quotes = True
return-status-codes = True
flake8 = True
flake8-ignore = D001,E501,P001,Q000,S001

[instance]
zcml += iw.debug

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

[omelette]
recipe = collective.recipe.omelette
eggs = ${test:eggs}
Expand Down
4 changes: 2 additions & 2 deletions src/brasil/gov/barra/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
para o viewlet manager
plone.app.layout.viewlets.interfaces.IPortalTop
apenas se o layer brasil.gov.barra.interfaces.IBarraInstalada
estiver disponivel.
estiver disponivel.
-->
<browser:viewlet
name="brasil.gov.barra"
Expand All @@ -29,5 +29,5 @@
layer="brasil.gov.barra.interfaces.IBarraInstalada"
permission="zope.Public"
/>

</configure>
5 changes: 2 additions & 3 deletions src/brasil/gov/barra/browser/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
from brasil.gov.barra.interfaces import IBarraHelper
from plone import api
from Products.Five import BrowserView
from zope.interface import implements
from zope.interface import implementer


@implementer(IBarraHelper)
class BarraHelper(BrowserView):
"""Browser view que retorna as configuracoes da Barra de Identidade"""

implements(IBarraHelper)

def __init__(self, context, request, *args, **kwargs):
"""Inicializacao da browser view
Expand Down
8 changes: 4 additions & 4 deletions src/brasil/gov/barra/config.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding:utf-8 -*-
from Products.CMFPlone import interfaces as plone_interfaces
from Products.CMFQuickInstallerTool import interfaces as qi_interfaces
from zope.interface import implements
from zope.interface import implementer

PROJECTNAME = "brasil.gov.barra"
PROJECTNAME = 'brasil.gov.barra'


@implementer(qi_interfaces.INonInstallable)
class HiddenProducts(object):
"""Oculta produtos do QuickInstaller"""
implements(qi_interfaces.INonInstallable)

def getNonInstallableProducts(self):
return [
Expand All @@ -18,9 +18,9 @@ def getNonInstallableProducts(self):
]


@implementer(plone_interfaces.INonInstallable)
class HiddenProfiles(object):
"""Oculta profiles da tela inicial de criacao do site"""
implements(plone_interfaces.INonInstallable)

def getNonInstallableProfiles(self):
return [
Expand Down
4 changes: 2 additions & 2 deletions src/brasil/gov/barra/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
i18n_domain="brasil.gov.barra">

<includeDependencies package="." />
<include zcml:condition="have plone-4" package="Products.CMFCore" file="permissions.zcml" />
<include zcml:condition="have plone-4" package="Products.CMFCore" file="permissions.zcml" />

<include package=".browser" />
<include package=".controlpanel" />
Expand All @@ -23,7 +23,7 @@
name="brasil.gov.barra"
directory="static"
/>

<!-- Oculta products -->
<utility
factory=".config.HiddenProducts"
Expand Down
15 changes: 7 additions & 8 deletions src/brasil/gov/barra/controlpanel/barra.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from Products.CMFDefault.formlib.schema import ProxyFieldProperty
from Products.CMFDefault.formlib.schema import SchemaAdapterBase
from Products.CMFPlone.interfaces import IPloneSiteRoot
from zope.component import adapts
from zope.component import adapter
from zope.formlib.form import FormFields
from zope.interface import implements
from zope.interface import implementer
from zope.interface import Interface
from zope.schema import Bool

Expand All @@ -19,24 +19,23 @@ class IBarraConfSchema(Interface):
local = Bool(
title=_(u'Usar barra local'),
description=_(u'help_barra_local',
default=u"Devemos servir esta barra a partir "
u"deste site ou utilizar a versão "
u"disponível em barra.brasil.gov.br?"),
default=u'Devemos servir esta barra a partir '
u'deste site ou utilizar a versão '
u'disponível em barra.brasil.gov.br?'),
required=False,
default=True,
)


@adapter(IPloneSiteRoot)
@implementer(IBarraConfSchema)
class BarraControlPanelAdapter(SchemaAdapterBase):
"""Adapter para a raiz do site Plone suportar o schema
de configuracao da barra de identidade
Esta classe implementa uma maneira da raiz do site armazenar
as configuracoes que serao geridas pelo painel de controle
"""

adapts(IPloneSiteRoot)
implements(IBarraConfSchema)

def __init__(self, context):
super(BarraControlPanelAdapter, self).__init__(context)
# Obtem a tool portal_properties
Expand Down
4 changes: 2 additions & 2 deletions src/brasil/gov/barra/controlpanel/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<!-- Registra a browser view que sera o painel de controle com o nome de
brasil.gov.barra-config.
apenas se o layer brasil.gov.barra.interfaces.IBarraInstalada
estiver disponivel.
-->
estiver disponivel.
-->
<browser:page
name="brasil.gov.barra-config"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
Expand Down
32 changes: 16 additions & 16 deletions src/brasil/gov/barra/profiles.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
xmlns:i18n="http://namespaces.zope.org/i18n"
i18n_domain="brasil.gov.vcge">

<gs:registerProfile
name="default"
title=".gov.br: Barra de identidade visual do governo"
directory="profiles/default"
description="Instala a barra de identidade visual do governo"
provides="Products.GenericSetup.interfaces.EXTENSION"
i18n:attributes="title; description"
/>
<gs:registerProfile
name="default"
title=".gov.br: Barra de identidade visual do governo"
directory="profiles/default"
description="Instala a barra de identidade visual do governo"
provides="Products.GenericSetup.interfaces.EXTENSION"
i18n:attributes="title; description"
/>

<gs:registerProfile
name="uninstall"
title=".gov.br: Barra de identidade visual do governo (Remover)"
directory="profiles/uninstall"
description="Remove a a barra de identidade visual do governo"
provides="Products.GenericSetup.interfaces.EXTENSION"
i18n:attributes="title; description"
/>
<gs:registerProfile
name="uninstall"
title=".gov.br: Barra de identidade visual do governo (Remover)"
directory="profiles/uninstall"
description="Remove a a barra de identidade visual do governo"
provides="Products.GenericSetup.interfaces.EXTENSION"
i18n:attributes="title; description"
/>

</configure>
Loading

0 comments on commit 1437183

Please sign in to comment.