Possible solution to modify ec2stack-configure to be run non-interactively #62
diff --git a/.deploy-coverage.sh b/.deploy-coverage.sh
deleted file mode 100644
index 3c1d76b..0000000
--- a/.deploy-coverage.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-cd ../
-git config --global user.email "travisci@ianduffy.ie"
-git config --global user.name "travis-ci"
-git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/imduffy15/ec2stack gh-pages > /dev/null
-
-# Commit and Push the Changes
-cd gh-pages
-rm -rf *
-cp -Rf ../ec2stack/cover/* .
-git add -f .
-git commit -a -m "[AUTO-PUSH] Latest coverage report on successful travis build"
-git push -fq origin gh-pages > /dev/null
diff --git a/.travis.yml b/.travis.yml
index a3cabb5..754e914 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,8 +14,4 @@
- pylint --rcfile=pylint.rc *.py ec2stack
- nosetests --with-coverage --cover-erase --cover-package=ec2stack --cover-html
after_success:
-- '[ "${TRAVIS_BRANCH}" = "master" ] && bash .deploy-coverage.sh'
- coveralls
-env:
- global:
- secure: dUNHx6q6ziCb7pXr/fb/OZS8fyB14RF8/rEEggBEzgn2L7KM78LVFyFNmW+QZ7lvJpZ806mfjdmvmz0DpR1k6kfokrr6txBzHDMEUebc9RnVnmsoNNWIRLiV/+YzUsVeFixogVz/z06yaycOC8knVExcNfGMfmiBg5PextydXSQ=
diff --git a/ec2stack/__init__.py b/ec2stack/__init__.py
index 91ca81d..bb61d03 100644
--- a/ec2stack/__init__.py
+++ b/ec2stack/__init__.py
@@ -8,6 +8,9 @@
import sys
import argparse
+from alembic import command
+from alembic.config import Config as AlembicConfig
+
from flask import Flask
from ConfigParser import SafeConfigParser
@@ -140,6 +143,12 @@
)
if not os.path.exists(database_file):
- sys.exit('No database found, please run ec2stack-configure')
+ directory = os.path.join(os.path.dirname(__file__), '../migrations')
+ config = AlembicConfig(os.path.join(
+ directory,
+ 'alembic.ini'
+ ))
+ config.set_main_option('script_location', directory)
+ command.upgrade(config, 'head', sql=False, tag=None)
return 'sqlite:///' + database_file
diff --git a/ec2stack/configure.py b/ec2stack/configure.py
index cc2e6f6..444d029 100644
--- a/ec2stack/configure.py
+++ b/ec2stack/configure.py
@@ -19,7 +19,6 @@
"""
config_folder = _create_config_folder()
_create_config_file(config_folder)
- _create_database()
def _create_config_folder():
@@ -281,16 +280,3 @@
attribute = default
return attribute
-
-
-def _create_database():
- """
- Creates/Updates the database.
- """
- directory = os.path.join(os.path.dirname(__file__), '../migrations')
- config = AlembicConfig(os.path.join(
- directory,
- 'alembic.ini'
- ))
- config.set_main_option('script_location', directory)
- command.upgrade(config, 'head', sql=False, tag=None)
diff --git a/migrations/alembic.ini b/migrations/alembic.ini
index f8ed480..887d9d4 100644
--- a/migrations/alembic.ini
+++ b/migrations/alembic.ini
@@ -26,12 +26,12 @@
[logger_sqlalchemy]
level = WARN
-handlers =
+handlers = console
qualname = sqlalchemy.engine
[logger_alembic]
-level = INFO
-handlers =
+level = WARN
+handlers = console
qualname = alembic
[handler_console]