예제 #1
0
 def test_link_local_settings_raises_error_if_settings_py_not_present(self):
     # We don't create settings.py, just call link_local_settings()
     # and see if it dies with the correct error
     local_settings_path = path.join(tasklib.env['django_settings_dir'], 'local_settings.py')
     self.create_local_settings_py_dev(local_settings_path)
     with self.assertRaises(InvalidProjectError):
         tasklib.link_local_settings('dev')
예제 #2
0
 def test_link_local_settings_raises_error_if_settings_py_does_not_import_local_settings(self):
     # We don't create settings.py, just call link_local_settings()
     # and see if it dies with the correct error
     local_settings_path = path.join(tasklib.env["django_settings_dir"], "local_settings.py")
     self.create_local_settings_py_dev(local_settings_path)
     self.create_empty_settings_py()
     with self.assertRaises(InvalidProjectError):
         tasklib.link_local_settings("dev")
예제 #3
0
def deploy(environment=None, svnuser=None, svnpass=None):
    if environment == None:
        environment = tasklib._infer_environment()

    tasklib.create_ve()
    tasklib.link_local_settings(environment)
    tasklib.update_db()
    checkout_or_update_fixtures(svnuser, svnpass)
    load_fixtures()
예제 #4
0
def deploy(environment=None, svnuser=None, svnpass=None):
    if environment == None:
        environment = tasklib._infer_environment()

    tasklib.create_ve()
    tasklib.link_local_settings(environment)
    tasklib.update_db()
    checkout_or_update_fixtures(svnuser, svnpass)
    load_fixtures()
예제 #5
0
    def test_link_local_settings_removes_local_settings_pyc(self):
        self.create_settings_py()
        local_settings_path = path.join(tasklib.env['django_settings_dir'], 'local_settings.py')
        local_settings_pyc_path = local_settings_path + 'c'
        self.create_local_settings_py_dev(local_settings_path)
        open(local_settings_pyc_path, 'a').close()

        tasklib.link_local_settings('dev')

        self.assertFalse(path.exists(local_settings_pyc_path))
예제 #6
0
    def test_link_local_settings_removes_local_settings_pyc(self):
        self.create_settings_py()
        local_settings_path = path.join(tasklib.env["django_settings_dir"], "local_settings.py")
        local_settings_pyc_path = local_settings_path + "c"
        self.create_local_settings_py_dev(local_settings_path)
        open(local_settings_pyc_path, "a").close()

        tasklib.link_local_settings("dev")

        self.assertFalse(path.exists(local_settings_pyc_path))
예제 #7
0
def deploy(environment=None):
    """Do all the required steps in order"""
    if environment == None:
        environment = tasklib._infer_environment()

    tasklib.create_private_settings()
    tasklib.link_local_settings(environment)
    tasklib.update_git_submodules()
    tasklib.create_ve()
    tasklib.update_db(use_migrations=True)
예제 #8
0
    def test_link_local_settings_creates_correct_link(self):
        self.create_settings_py()
        local_settings_path = path.join(tasklib.env['django_settings_dir'], 'local_settings.py')
        self.create_local_settings_py_dev(local_settings_path)

        tasklib.link_local_settings('dev')

        self.assertTrue(path.islink(local_settings_path))
        # assert the link goes to the correct file
        linkto = os.readlink(local_settings_path)
        self.assertEqual(linkto, 'local_settings.py.dev')
예제 #9
0
def deploy(environment=None, svnuser=None, svnpass=None):
    if environment == None:
        environment = tasklib._infer_environment()

    tasklib.create_ve()
    tasklib.create_private_settings()
    tasklib.link_local_settings(environment)
    tasklib.update_db()

    load_admin_user(environment)
    load_django_site_data(environment)
예제 #10
0
def deploy(environment=None, svnuser=None, svnpass=None):
    if environment == None:
        environment = tasklib._infer_environment()

    tasklib.create_ve()
    tasklib.create_private_settings()
    tasklib.link_local_settings(environment)
    tasklib.update_db()

    load_admin_user(environment)
    load_django_site_data(environment)
예제 #11
0
 def test_link_local_settings(self):
     self.create_settings_py()
     local_settings_path = os.path.join(tasklib.env['django_dir'], 'local_settings.py')
     local_settings_dev_path = local_settings_path + '.dev'
     # create local_settings.py.dev, run link_local_settings, confirm it exists
     with open(local_settings_dev_path, 'w') as lsdev:
         lsdev.write('# python file')
     tasklib.link_local_settings('dev')
     self.assertTrue(os.path.islink(local_settings_path))
     # assert the link goes to the correct file
     linkto = os.readlink(local_settings_path)
     self.assertEqual(linkto, 'local_settings.py.dev')
예제 #12
0
파일: localtasks.py 프로젝트: oriel-hub/api
def run_jenkins(apps_to_test=None, local_settings='jenkins'):
    """ make sure the local settings is correct and the database exists """
    if apps_to_test is None:
        apps_to_test = django_apps
    tasklib.env['verbose'] = True
    tasklib.update_ve()
    _install_django_jenkins()
    tasklib.create_private_settings()
    tasklib.link_local_settings(local_settings)
    tasklib.clean_db()
    tasklib.update_db()
    _manage_py_jenkins(apps_to_test)
예제 #13
0
파일: localtasks.py 프로젝트: oriel-hub/api
def deploy(environment=None):
    """Do all the required steps in order"""
    if environment is None:
        environment = tasklib._infer_environment()
        if tasklib.env['verbose']:
            print "Inferred environment as %s" % environment

    tasklib.create_private_settings()
    tasklib.link_local_settings(environment)
    tasklib.create_ve()
    tasklib.update_db()
    update_docs()
예제 #14
0
    def test_link_local_settings_replaces_old_local_settings(self):
        self.create_settings_py()
        local_settings_path = path.join(tasklib.env["django_settings_dir"], "local_settings.py")
        self.create_local_settings_py_dev(local_settings_path)
        open(local_settings_path, "a").close()
        self.assertFalse(path.islink(local_settings_path))

        tasklib.link_local_settings("dev")

        self.assertTrue(path.islink(local_settings_path))
        # assert the link goes to the correct file
        linkto = os.readlink(local_settings_path)
        self.assertEqual(linkto, "local_settings.py.dev")
예제 #15
0
def run_jenkins(svnuser, svnpass):
    """ make sure the local settings is correct and the database exists """
    tasklib.update_ve()
    tasklib._install_django_jenkins()
    tasklib.link_local_settings('jenkins')
    tasklib.clean_db()
    tasklib.update_db()
    checkout_or_update_fixtures(svnuser, svnpass)
    load_fixtures()
    # for jenkins, link to sarpaminfohub directory so that we can read the nice
    # reports
    if not os.path.exists(os.path.join(tasklib.env['project_dir'], 'infohub')):
        subprocess.call(['ln', '-s', 'django/sarpaminfohub/infohub'], cwd=tasklib.env['project_dir'])
    if not os.path.exists(os.path.join(tasklib.env['project_dir'], 'contactlist')):
        subprocess.call(['ln', '-s', 'django/sarpaminfohub/contactlist'], cwd=tasklib.env['project_dir'])
    tasklib._manage_py_jenkins()
예제 #16
0
def run_jenkins(svnuser, svnpass):
    """ make sure the local settings is correct and the database exists """
    tasklib.update_ve()
    tasklib._install_django_jenkins()
    tasklib.link_local_settings('jenkins')
    tasklib.clean_db()
    tasklib.update_db()
    checkout_or_update_fixtures(svnuser, svnpass)
    load_fixtures()
    # for jenkins, link to sarpaminfohub directory so that we can read the nice
    # reports
    if not os.path.exists(os.path.join(tasklib.env['project_dir'], 'infohub')):
        subprocess.call(['ln', '-s', 'django/sarpaminfohub/infohub'],
                        cwd=tasklib.env['project_dir'])
    if not os.path.exists(
            os.path.join(tasklib.env['project_dir'], 'contactlist')):
        subprocess.call(['ln', '-s', 'django/sarpaminfohub/contactlist'],
                        cwd=tasklib.env['project_dir'])
    tasklib._manage_py_jenkins()
예제 #17
0
 def test_link_local_settings_exits_if_settings_py_not_present(self):
     """ We don't create settings.py, just call link_local_settings()
     and see if it dies with the correct error """
     self.assertRaises(tasklib.link_local_settings('dev'), SystemExit)
예제 #18
0
 def test_link_local_settings_raises_error_if_local_settings_py_dev_not_present(self):
     # We don't create settings.py, just call link_local_settings()
     # and see if it dies with the correct error
     self.create_settings_py()
     with self.assertRaises(InvalidProjectError):
         tasklib.link_local_settings('dev')