Exemple #1
0
 def test_version_enforcement(self):
     with mock.patch('grow.pods.pods.Pod.grow_version', new_callable=mock.PropertyMock) as mock_version:
         this_version = get_this_version()
         gt_version = '>{0}'.format(semantic_version.Version(this_version))
         mock_version.return_value = gt_version
         with self.assertRaises(LatestVersionCheckError):
             pod = testing.create_test_pod()
Exemple #2
0
 def test_version_enforcement(self):
     with mock.patch('grow.pods.pods.Pod.grow_version',
                     new_callable=mock.PropertyMock) as mock_version:
         this_version = get_this_version()
         gt_version = '>{0}'.format(semantic_version.Version(this_version))
         mock_version.return_value = gt_version
         with self.assertRaises(LatestVersionCheckError):
             pod = testing.create_test_pod()
Exemple #3
0
def check_for_updates(quiet=False):
  their_version = sdk_utils.get_latest_version()
  this_version = sdk_utils.get_this_version()
  if their_version > this_version:
    message = 'A new version of the Grow SDK is ready to download.'
    info_text = 'Your version: {}, Latest version: {}'.format(this_version, their_version)
    resp = alert(message=message, buttons=['Visit site', 'Ignore'], info_text=info_text)
    if resp == 1000:
      webbrowser.open('http://growsdk.org')
      return True
  elif not quiet:
    info_text = 'Your version: {}, Latest version: {}'.format(this_version, their_version)
    alert('You have the latest version of the Grow SDK ({}).'.format(this_version), info_text=info_text)
Exemple #4
0
def find_port_and_start_server(pod, host, port, debug):
    app = main_lib.create_wsgi_app(pod, debug=debug)
    num_tries = 0
    while num_tries < 10:
        try:
            thread_pool = reactor.getThreadPool()
            wsgi_resource = wsgi.WSGIResource(reactor, thread_pool, app)
            site = server.Site(wsgi_resource)
            version = sdk_utils.get_this_version()
            server.version = 'Grow/{}'.format(version)
            reactor.listenTCP(port, site, interface=host)
            return port
        except twisted.internet.error.CannotListenError as e:
            if 'Errno 48' in str(e):
                num_tries += 1
                port += 1
            else:
                raise e
    pod.logger.error('Unable to bind to {}:{}'.format(host, port))
    sys.exit(-1)
Exemple #5
0
"""Base command for grow."""

import os
import click
from grow.common import sdk_utils
from grow.deployments.destinations import local as local_destination
from grow.performance import profile_report

VERSION = sdk_utils.get_this_version()
HELP_TEXT = (
    'Grow is a declarative file-based website generator. Read docs at '
    'https://grow.io. This is version {}.'.format(VERSION))


# pylint: disable=unused-argument
@click.group(help=HELP_TEXT, chain=True)
@click.version_option(VERSION, message='%(version)s')
@click.option('--auth',
              help='Information used to sign in to services that'
              ' require authentication. --auth should be an email address.',
              envvar='GROW_AUTH')
@click.option('--clear-auth',
              default=False,
              is_flag=True,
              help='Clears stored auth information.')
@click.option('--auth-key-file',
              help='Path to a private key file used for'
              ' services that require authentication.',
              envvar='GROW_KEY_FILE')
@click.option(
    '--interactive-auth',
Exemple #6
0
  'packages': ['jinja2', 'google.apputils', 'paste.httpserver'],
}

#setuptools.find_packages() +

# TODO(jeremydw): Executable data files should be moved to "app".
core.setup(
  name='Grow SDK',
    description=(
          'Develop everywhere and deploy anywhere: a declarative '
          'static site generator/CMS for building high-quality web sites.'
    ),
  url='http://growsdk.org',
  author='Grow SDK Authors',
  author_email='*****@*****.**',
  version=sdk_utils.get_this_version(),
  app=[
    'MacGrow.py'
  ],
  data_files=[
    'MacGrow.nib',
    'MainMenu.nib',
    'cocoasudo',
    'icon.png',
    'macgrow_cli.sh',
    'pygrow',
    'symlinks.py',
  ],
  options={'py2app': OPTIONS},
)